Pushes or adds the given branch of an alternation to the parser's internal stack of state.
(&self, concat: ast::Concat)
| 667 | /// Pushes or adds the given branch of an alternation to the parser's |
| 668 | /// internal stack of state. |
| 669 | fn push_or_add_alternation(&self, concat: ast::Concat) { |
| 670 | use self::GroupState::*; |
| 671 | |
| 672 | let mut stack = self.parser().stack_group.borrow_mut(); |
| 673 | if let Some(&mut Alternation(ref mut alts)) = stack.last_mut() { |
| 674 | alts.asts.push(concat.into_ast()); |
| 675 | return; |
| 676 | } |
| 677 | stack.push(Alternation(ast::Alternation { |
| 678 | span: Span::new(concat.span.start, self.pos()), |
| 679 | asts: vec![concat.into_ast()], |
| 680 | })); |
| 681 | } |
| 682 | |
| 683 | /// Parse and push a group AST (and its parent concatenation) on to the |
| 684 | /// parser's internal stack. Return a fresh concatenation corresponding |
no test coverage detected