Expand description
The native executor of the grammar feature union, the Rust port of
js/src/grammar-runtime.js.
Compile a grammar once, then parse sources into lossless concrete syntax
trees. Loading (load.rs, compile.rs)
resolves imports, macros and parameterized rules and checks every
scanner, action and predicate; the executor (executor.rs, rules.rs)
runs it within explicit resource limits; tree.rs copies and renders the
result. docs/grammar/feature-union.md is the specification both
runtimes follow.
Structs§
- Ambiguity
- An ambiguous node outside the declared conflicts.
- Feature
Grammar Parser - A grammar compiled for the native executor.
- Feature
Parse Options - The limits and policies of a parse. Every field left
Nonekeeps the value the parser was compiled with, and then the default. - Grammar
Parse Error - A source the grammar rejects.
- Grammar
Runtime Error - A grammar that cannot be loaded or a parse that cannot run;
reasonnames the step:import,macro,parameter,reference,declaration,operation,patternorembed. - Parse
Outcome - The outcome of one parse:
okonly without a rejection; the tree is kept whenever one was built. - Parse
Rejection - Why a parse rejects its input, and where.
Enums§
- Leaf
Text - The text of a leaf: the exact UTF-8 text, or the hexadecimal spelling of bytes that are not well-formed UTF-8.
- Operation
Value - A value of the operation language: an integer or a text.
- Parse
With Grammar Error - Why
parse_with_grammarproduced no tree: the grammar did not compile, or the source did not parse. - Syntax
Tree - One node of a concrete syntax tree; offsets are byte offsets into the input.
Functions§
- compile_
feature_ grammar - Compiles
grammarfor the native executor.resolve_grammar(name)returns the grammar an import or an embedded language names;optionsare the defaults of every parse. - parse_
with_ grammar - Compiles
grammarwithoptionsand parsessourcewith the same options, as the JavaScriptparseWithGrammardoes.
Type Aliases§
- Grammar
Resolver - Returns the grammar an import or an embedded language names.
- Syntax
Attributes - The attributes semantic actions set on a node or token, by name.