parse
Parses the input token sequence into an AST node of type N using this Grammar's default startRule.
The parser attempts to match the entire input token sequence against the grammar's startRule. Parsing succeeds only if the entire input is consumed and produces a node of type N.
Return
The root AST node of type N
Parameters
The expected root node type
The list of tokens to parse
Throws
if the root node is not of type N
if parsing fails
Parses the input token sequence into an AST node of type N using the specified rule name.
The parser attempts to match the entire input token sequence against the named rule. Parsing succeeds only if the entire input is consumed and produces a node of type N.
Return
The root AST node of type N
Parameters
The expected root node type
The list of tokens to parse
The name of the rule to use as the parse root
Throws
Parses the input token sequence into an AST node of type N using the specified rule.
The parser attempts to match the entire input token sequence against the given rule. Parsing succeeds only if the entire input is consumed and produces a node of type N.
Return
The root AST node of type N
Parameters
The expected root node type
The list of tokens to parse
The rule to use as the parse root
Throws
if the rule is not part of this Grammar
if the root node is not of type N
if parsing fails or not all input is consumed
Parses the input CharSequence into an AST node of type N using this Grammar's default startRule.
This convenience method combines lexing and parsing in a single call. The input is first tokenized using tokenize, then parsed using the Grammar's startRule. When lexerDiscardEnabled is true, discardable tokens are excluded before parsing.
Return
The root AST node of type N
Parameters
The expected root node type
The character sequence to lex and parse
Whether to exclude discardable tokens during parsing
Throws
Parses the input CharSequence into an AST node of type N using the specified rule name.
This convenience method combines lexing and parsing in a single call. The input is first tokenized using tokenize, then parsed using the named rule. When lexerDiscardEnabled is true, discardable tokens are excluded before parsing.
Return
The root AST node of type N
Parameters
The expected root node type
The character sequence to lex and parse
The name of the rule to use as the parse root
Whether to exclude discardable tokens during lexing
Throws
if the input cannot be fully tokenized
if the named rule is not found in this Grammar
if the root node is not of type N
if parsing fails
Parses character input into an AST node of type N using the specified rule.
This convenience method combines lexing and parsing in a single call. The input is first tokenized using tokenize, then parsed using the given rule. When lexerDiscardEnabled is true, discardable tokens are excluded before parsing.
Return
The root AST node of type N
Parameters
The expected root node type
The character sequence to lex and parse
The rule to use as the parse root
Whether to exclude discardable tokens during lexing
Throws
if the input cannot be fully tokenized
if the rule is not part of this Grammar
if the root node is not of type N
if parsing fails