ensureEOF

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.

Receiver

The context of this extension function.

Return

The block's result, if no tokens are found in the ParserContext after execution.

Parameters

R

The block's return type.

block

A function to execute, which receives no arguments and may return anything.

Throws

if tokens are found in the ParserContext after executing the given block.