mixinafPegger::RuleCtx
afPegger::RuleCtx
@Js
(Advanced) Handed to Rule classes during the matching process.
- currentPos
- abstract Int currentPos()- Returns the current position in the underlying input stream. 
- eos
- abstract Bool eos()- Returns - trueif at the End-Of-Stream.
- getMeta
- abstract Obj? getMeta()- Returns any previously set, user-defined meta from the last Rule processed. 
- log
- Logs the given message to debug. It is formatted to be the same as the other Pegger debug messages. 
- parseErr
- abstract PegParseErr parseErr(Str errMsg)- Returns a PEG specific - ParseErrto be thrown.
- peekChar
- abstract Int? peekChar(Int offset := 0)- Peeks a character relative to the current position (Does not consume any characters). For example: - peekChar(2)- returns char at- currentPos + 2
- peekChar(-1)- returns char at- currentPos - 1
 - Returns - nullif out of bounds.
- peekStr
- abstract Str? peekStr(Int size)- Peeks and returns as a string, the next XX characters. - peekChar()is much more performant (creates less objects), but use- peekStr()for a quick win!- Returns - nullif out of bounds.
- process
- abstract Bool process(Rule rule)- Call to process a sub-rule. Returns - trueif it matched successfully.
- readChar
- abstract Int readChar()- Consumes 1 character from the underlying input stream. - Retuns - 0if out of bounds.
- readStr
- abstract Str? readStr(Int size)- Consumes and returns as a string, the next XX characters. - readChar()is much more performant (creates less objects), but use- readStr()for a quick win!- Returns - nullif out of bounds.
- rollbackToPos
- abstract Void rollbackToPos(Int pos)- Rolls back the underlying input stream to the given position. 
- setMeta
- abstract Void setMeta(Obj? meta)- Sets user-defined meta to be returned in the resultant - Match. This should be called by Rule subclasses during their- doProcess()method, should they expect to return- true.
- sos
- abstract Bool sos()- Returns - trueif at the Start-Of-Stream.
- str
- abstract Str str()- Returns the string we are matching against.