Skip to main content

rename_grammar_rule

Function rename_grammar_rule 

Source
pub fn rename_grammar_rule(
    grammar: &Grammar,
    from: &str,
    to: &str,
    namespace: Option<&str>,
    aliases: &[RuleAlias],
) -> Result<RenamedGrammar, GrammarRenameError>
Expand description

Renames one rule and every reference to it.

Recursive references, references inside captures and references qualified with namespace (as namespace.rule or namespace::rule) are renamed. Capture labels are a separate scope and are never renamed. The returned aliases map canonical names back to the original source names, so the grammar can be exported with them.