From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/pest_meta/src/ast.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'vendor/pest_meta/src/ast.rs') diff --git a/vendor/pest_meta/src/ast.rs b/vendor/pest_meta/src/ast.rs index 77c48e879..d7316832e 100644 --- a/vendor/pest_meta/src/ast.rs +++ b/vendor/pest_meta/src/ast.rs @@ -94,6 +94,9 @@ pub enum Expr { Skip(Vec), /// Matches an expression and pushes it to the stack, e.g. `push(e)` Push(Box), + /// Matches an expression and assigns a label to it, e.g. #label = exp + #[cfg(feature = "grammar-extras")] + NodeTag(Box, String), } impl Expr { @@ -114,7 +117,6 @@ impl Expr { let expr = f(expr); match expr { - // TODO: Use box syntax when it gets stabilized. Expr::PosPred(expr) => { let mapped = Box::new(map_internal(*expr, f)); Expr::PosPred(mapped) @@ -165,6 +167,11 @@ impl Expr { let mapped = Box::new(map_internal(*expr, f)); Expr::Push(mapped) } + #[cfg(feature = "grammar-extras")] + Expr::NodeTag(expr, tag) => { + let mapped = Box::new(map_internal(*expr, f)); + Expr::NodeTag(mapped, tag) + } expr => expr, } } @@ -183,7 +190,6 @@ impl Expr { { let mapped = match expr { Expr::PosPred(expr) => { - // TODO: Use box syntax when it gets stabilized. let mapped = Box::new(map_internal(*expr, f)); Expr::PosPred(mapped) } @@ -233,6 +239,11 @@ impl Expr { let mapped = Box::new(map_internal(*expr, f)); Expr::Push(mapped) } + #[cfg(feature = "grammar-extras")] + Expr::NodeTag(expr, tag) => { + let mapped = Box::new(map_internal(*expr, f)); + Expr::NodeTag(mapped, tag) + } expr => expr, }; @@ -285,6 +296,10 @@ impl ExprTopDownIterator { | Expr::Push(expr) => { self.next = Some(*expr); } + #[cfg(feature = "grammar-extras")] + Expr::NodeTag(expr, _) => { + self.next = Some(*expr); + } _ => { self.next = None; } -- cgit v1.2.3