Expand description
Shared validated-parse surface for generated recognizers.
Every generated parser exposes a strict parsing mode that rejects syntax
errors, recovered error nodes, and missing generated required children
before handing out a tree whose typed accessors are infallible. The types
backing that surface are grammar-agnostic — all grammar-specific
information they carry (context and child names) arrives as data from the
generated validate_tree_structure — so they are defined once here and
aliased by generated modules.
ValidatedTree and ValidatedRuleNode are branded with a Grammar
type parameter. Each generated module instantiates them with its
module-local ValidatedTreeContext marker
(pub type TomlValidatedTree = antlr4_runtime::ValidatedTree<ValidatedTreeContext>;),
so trees and nodes of different grammars remain distinct types and
ValidatedRuleNode::downcast_ref cannot resolve a node against another
grammar’s contexts, whose rule indexes and context kinds are grammar-local
numbers. ValidationError is deliberately unbranded: a binary linking
several generated parsers handles one error type and compiles one copy of
its Display/Error/From machinery.
Structs§
- Validated
Rule Node - A rule node borrowed from a
ValidatedTreewith the sameGrammarbrand. - Validated
Tree - A completed, syntax-clean parse tree whose generated child cardinalities have been structurally validated.
Enums§
- Validation
Error - Failure to recognize or validate a strict generated parse.
Traits§
- From
Validated Rule Node - Constructs a generated validated context from a validated rule node of the same grammar.
Functions§
- require_
min_ count - Checks one generated repeated-child minimum-cardinality invariant.