Skip to main content

emit_grammar_lossless

Function emit_grammar_lossless 

Source
pub fn emit_grammar_lossless(
    grammar: &Grammar,
    layout: &GrammarLayout,
) -> Result<(String, EmitReport), GrammarLosslessError>
Expand description

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.

The report carries the fresh emission’s notes, plus a note when the layout could not place a rule and the whole grammar was emitted fresh instead.

§Errors

Returns GrammarLosslessError::UnsupportedFormat for a layout format outside GRAMMAR_LOSSLESS_FORMATS and the emitter’s error.