Skip to main content

Module interchange

Module interchange 

Source
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§

GrammarCommandOutput
What one meta-language grammar run printed and its exit status.
GrammarLayout
The layout that reconstructs a source from its grammar.
GrammarLayoutDefinition
One definition of a layout with the fingerprint of its rule.
GrammarLayoutImplicit
A rule the importer adds without a definition in the source.
GrammarLowering
A grammar lowered into one notation.
GrammarLoweringFailure
One failure of a lowering check.
GrammarLoweringMetadata
The reconstruction metadata of a lowering.
GrammarLoweringOptions
The emitter, importer, samples and metadata edit a lowering runs with.
GrammarLoweringReport
The outcome of check_grammar_lowering.
GrammarSourceDefinition
One rule definition of a source and the text after it.
GrammarSourceSplit
A source split into the text before its first definition and the definitions.

Enums§

GrammarLosslessError
Why the lossless mode could not run.
GrammarLoweringEncoding
Whether one helper accepts the same texts as the expression it replaces.
GrammarLoweringError
A lowering or reconstruction that cannot be carried out.
GrammarLoweringFailureKind
The way a lowering check failed.
GrammarLoweringStatus
Whether a lowering kept every encoding exact.
GrammarLoweringStep
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_emitter and the --to options write.
GRAMMAR_IMPORT_FORMATS
The formats grammar_importer and the --from options 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 source for grammar, 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 grammar into format, reconstructs it from the package and reports every way the lowering failed.
deserialize_grammar
Reads a document serialize_grammar (or serializeGrammar of js/src/grammar.js) wrote.
dropped_grammar_features
The features of expected that actual does 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 grammar with layout, 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 source of format with the layout that reconstructs it.
lower_grammar
Lowers grammar into format.
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 value as LinkNetwork LiNo terms 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> ... over args.
serialize_grammar
Serializes grammar as JSON.stringify(grammar.normalized(), null, 2) followed by a newline, as serializeGrammar of js/src/grammar.js does.
split_grammar_source
Splits source into the text before the first rule definition and the definitions of the rules in names, each with the text after it.

Type Aliases§

GrammarEmitter
Emits a grammar in one notation, with its fidelity report.
GrammarFileReader
Reads a file’s text for run_grammar_command.
GrammarImporter
Imports a grammar from one notation.