Expand description
§Meta-variable Environment and Utilities
This module provides types and functions for handling meta-variables in AST pattern matching. Meta-variables allow patterns to flexibly match and capture code fragments, supporting single and multi-capture semantics.
§Key Components
MetaVarEnv: Stores meta-variable instantiations during pattern matching.MetaVariable: Enum representing different meta-variable forms (single, multi, dropped).extract_meta_var: Utility to parse meta-variable strings.- Insertion, retrieval, and transformation APIs for meta-variable environments.
§Example
use thread_ast_engine::meta_var::{MetaVarEnv, MetaVariable, extract_meta_var};
let mut env = MetaVarEnv::new();
env.insert("$A", node);
let meta = extract_meta_var("$A", '$');See MetaVarEnv for details on usage in AST matching and rewriting.
Structs§
- Meta
VarEnv - a dictionary that stores metavariable instantiation const a = 123 matched with const a = $A will produce env: $A => 123
Enums§
Type Aliases§
- Meta
VariableID - Interned string type for meta-variable identifiers.
- Underlying