summaryrefslogtreecommitdiffstats
path: root/vendor/pest_meta/src/ast.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/pest_meta/src/ast.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/pest_meta/src/ast.rs')
-rw-r--r--vendor/pest_meta/src/ast.rs19
1 files changed, 17 insertions, 2 deletions
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<String>),
/// Matches an expression and pushes it to the stack, e.g. `push(e)`
Push(Box<Expr>),
+ /// Matches an expression and assigns a label to it, e.g. #label = exp
+ #[cfg(feature = "grammar-extras")]
+ NodeTag(Box<Expr>, 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;
}