diff options
Diffstat (limited to 'vendor/pest_meta/src/optimizer/mod.rs')
-rw-r--r-- | vendor/pest_meta/src/optimizer/mod.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/vendor/pest_meta/src/optimizer/mod.rs b/vendor/pest_meta/src/optimizer/mod.rs index f9cde831c..b69163ed3 100644 --- a/vendor/pest_meta/src/optimizer/mod.rs +++ b/vendor/pest_meta/src/optimizer/mod.rs @@ -68,6 +68,8 @@ fn rule_to_optimized_rule(rule: Rule) -> OptimizedRule { Expr::Rep(expr) => OptimizedExpr::Rep(Box::new(to_optimized(*expr))), Expr::Skip(strings) => OptimizedExpr::Skip(strings), Expr::Push(expr) => OptimizedExpr::Push(Box::new(to_optimized(*expr))), + #[cfg(feature = "grammar-extras")] + Expr::NodeTag(expr, tag) => OptimizedExpr::NodeTag(Box::new(to_optimized(*expr)), tag), Expr::RepOnce(_) | Expr::RepExact(..) | Expr::RepMin(..) @@ -137,6 +139,9 @@ pub enum OptimizedExpr { Skip(Vec<String>), /// Matches an expression and pushes it to the stack, e.g. `push(e)` Push(Box<OptimizedExpr>), + /// Matches an expression and assigns a label to it, e.g. #label = exp + #[cfg(feature = "grammar-extras")] + NodeTag(Box<OptimizedExpr>, String), /// Restores an expression's checkpoint RestoreOnErr(Box<OptimizedExpr>), } @@ -159,7 +164,6 @@ impl OptimizedExpr { let expr = f(expr); match expr { - // TODO: Use box syntax when it gets stabilized. OptimizedExpr::PosPred(expr) => { let mapped = Box::new(map_internal(*expr, f)); OptimizedExpr::PosPred(mapped) @@ -208,7 +212,6 @@ impl OptimizedExpr { { let mapped = match expr { OptimizedExpr::PosPred(expr) => { - // TODO: Use box syntax when it gets stabilized. let mapped = Box::new(map_internal(*expr, f)); OptimizedExpr::PosPred(mapped) } |