ChildContextImpl

inner class ChildContextImpl(grammar: Grammar<T, E>) : ParserContext<T, E>

Functions

back
Link copied to clipboard
common
open override fun back(): Token<T>
Move the index backwards one token and returns it.
eat
Link copied to clipboard
common
open override fun eat(): Token<T>
Eats the current token, advancing the index by one.
open override fun eat(type: T): Token<T>
Eats the current token, advancing the index by one.
match
Link copied to clipboard
common
open override fun match(type: T): Boolean
Equivalent to nextIs, but eats the current token if true.
matchAny
Link copied to clipboard
common
open override fun matchAny(vararg type: T): Boolean
Equivalent to nextIsAny, but eats the current token if true.
nextIs
Link copied to clipboard
common
open override fun nextIs(type: T): Boolean
Peeks the next token and if the token types are equal, returns true.
nextIsAny
Link copied to clipboard
common
open override fun nextIsAny(vararg types: T): Boolean
Peeks the next token and if the token type is equal to any of the types, returns true.
parseExpression
Link copied to clipboard
common
open override fun Grammar<T, E>.parseExpression(precedence: Int): E
Parses the expression using another grammar.
open override fun parseExpression(precedence: Int): E
Parses the expression using this parser's grammar.
peek
Link copied to clipboard
common
open override fun peek(distance: Int): Token<T>
Peeks a token a distance far away of the reader.
peekAheadUntil
Link copied to clipboard
common
open override fun peekAheadUntil(vararg type: T): List<Token<T>>
Peeks the tokens ahead until a token of any of the types is found.
skipUntil
Link copied to clipboard
common
open override fun skipUntil(vararg type: T)
Skips tokens ahead until a token of any of the types is found.
withGrammar
Link copied to clipboard
common
open override fun withGrammar(grammar: Grammar<T, E>): ParserContext<T, E>
Creates a child parser context with the specified grammar.

Properties

eof
Link copied to clipboard
common
open override val eof: Boolean
A property which is true if there's no more tokens.
grammar
Link copied to clipboard
common
open override val grammar: Grammar<T, E>
The grammar of this parser's context.
index
Link copied to clipboard
common
open override val index: Int
The current index in the list of tokens.
last
Link copied to clipboard
common
open override val last: Token<T>
A property which contains the last token.