Package com.github.adriantodt.tartar.extensions.parser

Functions

eatMulti
Link copied to clipboard
common
fun <T, K : Token<T>> ParserContext<T, K, *>.eatMulti(vararg types: T): List<K>

Eats a sequence of tokens in a row of the specified types, returning a list of the consumed tokens if all the specified types matched successfully.

eatSequence
Link copied to clipboard
common
fun <T, K : Token<T>> ParserContext<T, K, *>.eatSequence(vararg types: T): List<K>

Eats a sequence of tokens in a row of the specified types, returning a list of the consumed tokens if all the specified types matched successfully.

ensureEOF
Link copied to clipboard
common
fun <R> ParserContext<*, *, *>.ensureEOF(block: () -> R): R

After executing a given block, throws a SyntaxException if remaining tokens are found in the ParserContext. Otherwise, returns the block's computed result.