Skip to main content

emit_tree_sitter_json

Function emit_tree_sitter_json 

Source
pub fn emit_tree_sitter_json(
    grammar: &Grammar,
) -> Result<(String, EmitReport), GrammarEmitError>
Expand description

Emits the declarative tree-sitter grammar.json form, the inverse of crate::grammar::import_tree_sitter_json.

Captures produced by the importer map back to their FIELD, ALIAS, PREC*, TOKEN, IMMEDIATE_TOKEN, RESERVED, and PATTERN nodes. The text matches JavaScript JSON.stringify(document, null, 2) so both runtimes emit byte-identical documents.