Skip to main content

import_lark

Function import_lark 

Source
pub fn import_lark(text: &str) -> Result<Grammar, GrammarImportError>
Expand description

Parses Lark .lark grammar text into the grammar IR.

The importer is a clean-room recursive-descent parser for Lark’s structural EBNF surface: rules, terminals, unordered alternation, grouping, optional groups, postfix repetition, counted ~ repetition, string literals, and regex terminals.

§Errors

Returns GrammarImportError when the source cannot be parsed as the supported Lark subset or when an explicitly unsupported directive such as %import is encountered.