Expand description
Grammar interchange commands shared by the Rust and JavaScript tools.
The commands import, validate, convert, merge, rename, export and round
trip grammars. run_grammar_command is the whole command-line behavior
with file reading injected, so the library and the meta-language binary
report the same standard output, standard error and exit status. It mirrors
js/src/grammar-interchange.js, and the native grammar listing read by
parse_native_grammar and written by render_native_grammar mirrors
the same file.
Structs§
- Grammar
Command Output - What one
meta-language grammarrun printed and its exit status. - Grammar
Layout - The layout that reconstructs a source from its grammar.
- Grammar
Layout Definition - One definition of a layout with the fingerprint of its rule.
- Grammar
Layout Implicit - A rule the importer adds without a definition in the source.
- Grammar
Lowering - A grammar lowered into one notation.
- Grammar
Lowering Failure - One failure of a lowering check.
- Grammar
Lowering Metadata - The reconstruction metadata of a lowering.
- Grammar
Lowering Options - The emitter, importer, samples and metadata edit a lowering runs with.
- Grammar
Lowering Report - The outcome of
check_grammar_lowering. - Grammar
Source Definition - One rule definition of a source and the text after it.
- Grammar
Source Split - A source split into the text before its first definition and the definitions.
Enums§
- Grammar
Lossless Error - Why the lossless mode could not run.
- Grammar
Lowering Encoding - Whether one helper accepts the same texts as the expression it replaces.
- Grammar
Lowering Error - A lowering or reconstruction that cannot be carried out.
- Grammar
Lowering Failure Kind - The way a lowering check failed.
- Grammar
Lowering Status - Whether a lowering kept every encoding exact.
- Grammar
Lowering Step - One step of the reconstruction metadata.
Constants§
- GRAMMAR_
COMMAND_ USAGE - The help text of
meta-language grammar, the same in both runtimes. - GRAMMAR_
EXPORT_ FORMATS - The formats
grammar_emitterand the--tooptions write. - GRAMMAR_
IMPORT_ FORMATS - The formats
grammar_importerand the--fromoptions read. - GRAMMAR_
LOSSLESS_ FORMATS - The formats the lossless mode reads and writes.
- GRAMMAR_
LOWERING_ FORMATS - The notations the lowering writes.
- MAX_
LOWERED_ CHARACTERS - The most characters a character set is expanded to before it is approximated.
Functions§
- capture_
grammar_ layout - The layout of
sourceforgrammar, the grammar imported from it: its definitions with the fingerprints of their rules, and the fingerprints of the rules defined nowhere in the source. - check_
grammar_ lowering - Lowers
grammarintoformat, reconstructs it from the package and reports every way the lowering failed. - deserialize_
grammar - Reads a document
serialize_grammar(orserializeGrammarofjs/src/grammar.js) wrote. - dropped_
grammar_ features - The features of
expectedthatactualdoes not carry, as readable details: the rule names and their order, the start rule, and every rule’s kind, definition and documentation. - emit_
grammar_ lossless - Emits
grammarwithlayout, the layout of the source it was imported from: unchanged definitions keep their original text and only changed or new rules are written fresh. - grammar_
emitter - The emitter of one of
GRAMMAR_EXPORT_FORMATS. - grammar_
importer - The importer of one of
GRAMMAR_IMPORT_FORMATS. - import_
grammar_ lossless - Imports
sourceofformatwith the layout that reconstructs it. - lower_
grammar - Lowers
grammarintoformat. - parse_
grammar_ layout_ links - Reads the links form written by
render_grammar_layout_links. - parse_
grammar_ links - Reads the native links form written by
render_grammar_links. - parse_
links_ expression - Reads one expression of the native links form.
- parse_
lowering_ metadata - Reads the metadata written by
render_lowering_metadata. - parse_
native_ expression - Parses one expression written by
render_native_expression. - parse_
native_ grammar - Parses a native grammar listing written by
render_native_grammar. - percent_
decode_ links_ text - Reverses
percent_encode_links_text. - percent_
encode_ links_ text - Percent-encodes
valueasLinkNetworkLiNoterms are. - reconstruct_
grammar - Reconstructs the original grammar from an executable text and its lowering metadata.
- render_
declaration_ links - The declaration links between the grammar link and the first rule.
- render_
grammar_ layout_ links - Renders the links form of
layout, one link per line. - render_
grammar_ links - Renders the native links form of
grammar, one link per line. - render_
links_ expression - Renders one expression of the native links form.
- render_
lowering_ metadata - Renders the reconstruction metadata as links, one link per line.
- render_
native_ expression - Renders one expression with the native listing spelling.
- render_
native_ feature - Renders one feature union expression with the native listing spelling.
- render_
native_ grammar - Renders the native grammar listing of
grammar. - render_
rule_ fields - The rule fields before the
(doc TEXT)field. - render_
rule_ link - Renders the
(rule NAME KIND EXPRESSION [FIELDS...] [(concept ID)] [(source-names (SOURCE NAME)...)] [(doc TEXT)])link of one rule. - run_
grammar_ command - Runs
meta-language grammar <command> ...overargs. - serialize_
grammar - Serializes
grammarasJSON.stringify(grammar.normalized(), null, 2)followed by a newline, asserializeGrammarofjs/src/grammar.jsdoes. - split_
grammar_ source - Splits
sourceinto the text before the first rule definition and the definitions of the rules innames, each with the text after it.
Type Aliases§
- Grammar
Emitter - Emits a grammar in one notation, with its fidelity report.
- Grammar
File Reader - Reads a file’s text for
run_grammar_command. - Grammar
Importer - Imports a grammar from one notation.