produces

fun produces(producer: Node.ParserCapture.() -> N): RuleBuilder<N>

Finalizes the current Production with a Node factory function.

The producer function is called with a Node.ParserCapture receiver containing all tokens and nodes matched by this production's pattern. It should construct and return the appropriate node type for this production. After calling this function, a new production can be started.

Return

this RuleBuilder for chaining

Parameters

producer

A function that constructs a Node from the captured elements

Throws

if no pattern elements have been added


Finalizes the current production with a default Generic node factory.

This convenience method is available when the Rule produces generic nodes. It automatically wraps the captured elements in a Node.Generic instance.

Return

this RuleBuilder for chaining