mxsdoc

And.ms

依存

struct AndStruct

与えられたパーサが全て成功した時、最後のパーサの結果を返すパーサ。

補足

最後以外のパーサが成功している間は解析対象の文字列を消費しない。
もし最後以外のパーサが失敗するとその時点でパース失敗となる。

トークンの頭文字に一致する
(
local parser = AndStruct #(
  (ChoiceStruct #((TokenStruct "foo"), (TokenStruct "bar"))),
  (AnyCharStruct())
)
parser (ContextStruct "foo")
)
-- 結果
f
d以外の文字に一致する
(
local parser = ManyStruct (
  AndStruct #(
    (IsNotStruct (CharStruct "d")),
    (AnyCharStruct())
  )
)
parser (ContextStruct "abcd")
)
-- 結果
#("a", "b", "c")

public Parsers

プロパティ
<Array[<Struct>]>

public Debug

プロパティ
<BooleanClass>

public fn Parse

パラメータ
content
<Struct:ContextStruct>
戻り値
<Any|Struct:FailureStruct>

成功した場合はパース結果、失敗した場合はFailureStructを返す。

public fn StructName

戻り値
<Name>

public fn Dump

パラメータ
indent:
<String>
パラメータ
out:
<FileStream|StringStream|WindowStream>

出力先。既定値はlistener

戻り値
<OkClass>

public fn Equals

パラメータ
obj
<Any>
戻り値
<BooleanClass>
補足

大文字と小文字を区別する。