Table of Contents

Namespace Utils.Parser.Model

Classes

Alternation

A set of mutually exclusive alternatives: A | B | C. This is the top-level content of every Rule.

Alternative

A single alternative inside an Alternation, with its priority, associativity, content, and optional label.

AnyChar

Matches any single character (the . wildcard in lexer rules).

CharSetMatch

Matches a single character that is (or is not) a member of an explicit set, e.g. [a-zA-Z_] or [^0-9].

EffectiveGrammarOptions

Represents normalized and runtime-consumable grammar options.

EmbeddedAction

An opaque action block embedded in the grammar, captured with its context. Label references ($xxx) are extracted from the raw code to allow later resolution without re-parsing the action text.

GatingPredicate

A gating semantic predicate in ANTLR3 syntax: { condition }? =>. Retained for compatibility with grammars that still use this older form.

GrammarAction

Represents a named action block declared at grammar level, such as @header { import ... } or @members { int count = 0; }.

GrammarExtensionBinding

Binds a grammar declared superClass to runtime lexer extensions.

GrammarImport

Represents a grammar import directive: import CommonLexer; or an aliased import: import alias=CommonLexer;.

GrammarOptions

Represents the key/value pairs declared in an options { ... } block, such as tokenVocab=MyLexer or superClass=MyBase.

LabelRef

A reference to a labelled value inside action code: $e.text, $value, $ctx.start.

LeftRecursiveRuleInfo

Describes a parser rule that uses direct left recursion and how its alternatives are split for seed parsing and left-push extension.

LexerCommand

A structured lexer command such as -> skip, -> channel(HIDDEN), or -> pushMode(MyMode). Unlike EmbeddedAction, these commands have direct runtime semantics and are not opaque code.

LexerMode

A named lexer mode containing an ordered list of lexer rules. The default mode is always named DEFAULT_MODE. Additional modes are declared via mode NAME; in the grammar. Rules are ordered by DeclarationOrder to ensure correct maximal-munch priority during tokenization.

LiteralMatch

Matches an exact literal string, e.g. 'class' or '=='.

ModeSwitch

A lexer mode switch: pushMode, popMode, or mode directive.

Negation

Negation of an element (~expr): matches any single token or character that does not match Inner.

ParserDefinition

Complete, immutable description of a grammar produced either by loading a .g4 file through Antlr4GrammarConverter or by constructing the meta-grammar programmatically (as done in Antlr4Grammar.Build()).

A ParserDefinition is consumed by:

After construction, call RuleResolver.Resolve(definition) to populate AllRules and validate rule references.

PrecedencePredicate

A precedence predicate of the form { precpred(_ctx, n) }?, used by ANTLR4 to handle left-recursive rules. The numeric level is parsed from the raw code rather than stored verbatim.

Quantifier

A quantified repetition: , +, ?, or {n,m}. Greedy is true by default; setting it to false enables non-greedy matching (the ??, ?, +? suffixes).

RangeMatch

Matches any single character within an inclusive range, e.g. 'a'..'z'.

Rule

A single grammar rule — either a lexer rule (upper-case name by convention) or a parser rule (lower-case name by convention).

RuleCatchClause

A parser rule catch clause preserved as passive metadata only.

RuleContent

Abstract root for all grammar elements that can appear inside a rule body. Concrete subtypes fall into three categories: tokenizer content (character-level matching), composite structures (sequences, alternations, quantifiers), and meta-instructions (predicates, embedded actions, lexer commands).

RuleExceptionMetadata

Parser rule exception metadata preserved without runtime exception semantics.

RuleLabel

A label attached to a rule reference inside a parser alternative.

RuleLocal

A parser rule local declaration preserved as passive metadata only.

RuleOptions

Key/value options attached to an individual rule: options { greedy=false; }.

RuleParameter

A typed parameter declared on a parser rule: rule[int x, String y].

RuleRef

A reference to another rule, either lexer or parser depending on context. Optionally carries a label (x=child or xs+=child) and raw call-site argument text preserved from callee[...] syntax. Labels and raw arguments are metadata only: they are not evaluated, not bound automatically, and do not populate invocation-frame parameters.

RuleReturn

A typed return value declared on a parser rule: rule returns [int value].

Sequence

An ordered sequence of grammar elements that must all match in order: A B C.

TokenizerContent

Base for all character-level match operations used inside lexer rules.

ValidatingPredicate

A validating semantic predicate { condition }? placed before an element. If the condition evaluates to false the enclosing alternative is rejected.

Enums

ActionContext

Describes where in a grammar an embedded action or predicate was declared.

ActionPosition

Describes where relative to the surrounding element an action appears.

Associativity

Left/right/no associativity for an alternative, used when resolving left-recursive ambiguity.

GrammarType

Indicates the kind of grammar declared in a .g4 file.

LexerCommandType

Identifies the kind of a structured lexer command.

RuleKind

Identifies whether a rule belongs to the lexer or parser.