diff options
Diffstat (limited to 'vendor/regex-syntax/src/ast/visitor.rs')
-rw-r--r-- | vendor/regex-syntax/src/ast/visitor.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/vendor/regex-syntax/src/ast/visitor.rs b/vendor/regex-syntax/src/ast/visitor.rs index ab136739e..c1bb24d97 100644 --- a/vendor/regex-syntax/src/ast/visitor.rs +++ b/vendor/regex-syntax/src/ast/visitor.rs @@ -48,6 +48,11 @@ pub trait Visitor { Ok(()) } + /// This method is called between child nodes of a concatenation. + fn visit_concat_in(&mut self) -> Result<(), Self::Err> { + Ok(()) + } + /// This method is called on every [`ClassSetItem`](ast::ClassSetItem) /// before descending into child nodes. fn visit_class_set_item_pre( @@ -228,8 +233,14 @@ impl<'a> HeapVisitor<'a> { // If this is a concat/alternate, then we might have additional // inductive steps to process. if let Some(x) = self.pop(frame) { - if let Frame::Alternation { .. } = x { - visitor.visit_alternation_in()?; + match x { + Frame::Alternation { .. } => { + visitor.visit_alternation_in()?; + } + Frame::Concat { .. } => { + visitor.visit_concat_in()?; + } + _ => {} } ast = x.child(); self.stack.push((post_ast, x)); @@ -253,7 +264,7 @@ impl<'a> HeapVisitor<'a> { visitor: &mut V, ) -> Result<Option<Frame<'a>>, V::Err> { Ok(match *ast { - Ast::Class(ast::Class::Bracketed(ref x)) => { + Ast::ClassBracketed(ref x) => { self.visit_class(x, visitor)?; None } |