eatMulti

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.

If any of the types on the sequence do not match, a SyntaxException will be thrown.

Deprecation Notice:

This function was renamed to eatSequence and will be removed in the next major release.

Receiver

The context of this extension function.

Return

A list of all the consumed tokens, if all the specified types matched successfully.

See also

Parameters

T

The parser's (and underlying grammar's) token type.

types

a sequence of token types to match against the context.

Throws

if any of the types on the sequence do not match.