Skip to main content

import_ebnf

Function import_ebnf 

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

Parses Extended Backus-Naur Form text into the grammar IR.

The parser accepts the ISO-style name = expression ; spelling used by the issue fixtures and the ::= spelling. Concatenation (, or juxtaposition) binds tighter than alternation (|); ( ), [ ], and { } group, make optional, and repeat; a postfix ?, *, or + follows an element. ISO (* ... *) comments outside string literals are skipped, as in the JavaScript importer.

ยงErrors

Returns GrammarImportError when the EBNF text cannot be parsed, when a parsed construct cannot be represented, or when a non-terminal reference does not resolve to a rule in the imported grammar.