regex_to_grammar

Function regex_to_grammar 

Source
pub fn regex_to_grammar(regex: &str) -> Result<GrammarData, RegexToGrammarError>
Expand description

Convert a regex string straight to a parsed GrammarData AST.

This is the regex→grammar-AST path: it lowers the regex to EBNF (via regex_to_ebnf) and parses that with the existing EBNF parser, so the result is a fully-formed grammar usable by the rest of the crate. Upstream xgrammar’s Grammar::FromRegex does the same composition.