Skip to main content

Module feature_runtime

Module feature_runtime 

Source
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.
FeatureGrammarParser
A grammar compiled for the native executor.
FeatureParseOptions
The limits and policies of a parse. Every field left None keeps the value the parser was compiled with, and then the default.
GrammarParseError
A source the grammar rejects.
GrammarRuntimeError
A grammar that cannot be loaded or a parse that cannot run; reason names the step: import, macro, parameter, reference, declaration, operation, pattern or embed.
ParseOutcome
The outcome of one parse: ok only without a rejection; the tree is kept whenever one was built.
ParseRejection
Why a parse rejects its input, and where.

Enums§

LeafText
The text of a leaf: the exact UTF-8 text, or the hexadecimal spelling of bytes that are not well-formed UTF-8.
OperationValue
A value of the operation language: an integer or a text.
ParseWithGrammarError
Why parse_with_grammar produced no tree: the grammar did not compile, or the source did not parse.
SyntaxTree
One node of a concrete syntax tree; offsets are byte offsets into the input.

Functions§

compile_feature_grammar
Compiles grammar for the native executor. resolve_grammar(name) returns the grammar an import or an embedded language names; options are the defaults of every parse.
parse_with_grammar
Compiles grammar with options and parses source with the same options, as the JavaScript parseWithGrammar does.

Type Aliases§

GrammarResolver
Returns the grammar an import or an embedded language names.
SyntaxAttributes
The attributes semantic actions set on a node or token, by name.