DescribedTypeBuilder

Builder for the description of a node. This typically should be used like this:

MyNodeType {
expect(TokenType)
expect(MyOtherNodeType)
}

Constructors

Link copied to clipboard
constructor(typeDeclaration: ParserNodeDeclaration<T>)

Properties

Link copied to clipboard

Used with storeIn, allows placing some state as the item of the output list.

Functions

Link copied to clipboard
open override fun build(): DescribedType<T>

Builds this as a described type

Link copied to clipboard

Build an "either" construct, with different branches the parsing process can take.

Link copied to clipboard

Adds an expectation that always succeeds and emits the provided value.

Link copied to clipboard

Adds an expectation to this node descriptor based on a node

Adds an expectation to this node descriptor based on a token type.

Link copied to clipboard

Expect the end-of-file to be reached at this point.

Link copied to clipboard

Create a lookahead expectation.

Link copied to clipboard

Create an optional branch. If the optional branch matches, what it stores will is passed transparently, just like if the optional { } was not there. If the optional branch does not match, nothing happens, just like if the entire optional branch was not there.

Link copied to clipboard
open operator override fun plusAssign(expectationBuilder: Buildable<Expectation<T, *>>)

Add an expectation that will be built when the description gets built.

Link copied to clipboard
operator fun <T, R> ExpectationReceiver<T>.plusAssign(expectation: Expectation<T, R>)

Add an expectation directly instead of a builder. This is a shortcut for this += Buildable.of(expectation)

Link copied to clipboard
fun <T, R> ExpectationReceiver<T>.repeated(min: Int? = null, max: Int? = null, itemBuilder: ItemExpectationBuilder<R>.() -> Unit): ExpectationStateCallbackBuilder<T, List<R>>

Repeatedly runs the provided expectations until they no longer match, then collects the items (specified via storeIn item in one of the expectations in the repeated block) into a list that you can then store.

Link copied to clipboard

Repeatedly runs the provided expectations without storing anything.

Link copied to clipboard
inline fun <T, R : T> ExpectationReceiver<T>.self(): NodeParameterKey<T, R>

Used with storeIn self(), provides the actual value of a node declaration that is implemented with by subtype()

Link copied to clipboard

Concise notation for the expect function.