classafPegger::Parser
sys::Obj afPegger::Parser
@
Js
The main parser class; use to run your rules against an InStream
.
- make
new make(Rule rootRule)
Create a
Parser
with the given rootRule
.- match
Str? match(InStream in, Obj? ctx := null)
Runs the parsing rules against characters in the given
InStream
. Returns the characters (if any) that were matched.- matches
Bool matches(InStream in, Obj? ctx := null)
Runs the parsing rules against characters in the given
InStream
. Returnstrue
if anything was matched.Convenience for
match(in, ctx) != null
- parse
Obj? parse(InStream in, Obj? ctx := null)
Runs the parsing rules against characters in the given
InStream
. The givenctx
object is passed to all successful actions, and returned.- parseAll
Obj? parseAll(InStream in, Obj? ctx := null)
Continually parses the given
InStream
until the end of the stream is reached, or nothing was matched. Returns the given actionctx
object.