Skip to main content

import_pest

Function import_pest 

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

Parses PEG .pest grammar text into the grammar IR.

Rules are name = modifier? { expression } with the modifiers _ (silent), @ (atomic), $ (token), and ! (normal). Expressions use ordered choice |, sequence ~, the predicates & and !, the postfix operators ?, *, +, and counted repetition {n}, {n,}, {,m}, {n,m}, over strings, ^"…" case-insensitive strings, 'a'..'z' ranges, and rule references, where ANY matches any character. // and /* */ comments are skipped.

§Errors

Returns GrammarImportError when the pest grammar cannot be parsed, when a parsed construct (such as PUSH(…) or PEEK[…]) cannot be represented in the grammar IR, or when a non-terminal reference does not resolve to a local rule or pest built-in.