Skip to main content

read_lexer_conf

Function read_lexer_conf 

pub fn read_lexer_conf(
    grammar_json: &str,
) -> Result<LexerConf, LexerConfReadError>
Expand description

Read data.parser.lexer_conf out of a Lark tools.serialize JSON document into a LexerConf (callbacks empty, skip_validation false).

The terminals array holds memo refs ({"@": n}) — resolve each against the top-level memo table; the TerminalDef payloads are inline past that one hop (verified on the corpus files). Also reads the inline ignore list and g_regex_flags. A serialized PatternRE carries Lark’s own _width pair — capture it into crate::pattern::Pattern::serialized_width (test oracle; the build recomputes widths). lexer_type stays unread — lexer selection is the caller’s, via frontends::resolve_lexer.