MCPcopy Create free account
hub / github.com/davidblewett/rure-python / push_alternate

Method push_alternate

regex/regex-syntax/src/ast/parse.rs:656–665  ·  view source on GitHub ↗

Parse and push a single alternation on to the parser's internal stack. If the top of the stack already has an alternation, then add to that instead of pushing a new one. The concatenation given corresponds to a single alternation branch. The concatenation returned starts the next branch and is empty. This assumes the parser is currently positioned at `|` and will advance the parser to the charac

(&self, mut concat: ast::Concat)

Source from the content-addressed store, hash-verified

654 /// This assumes the parser is currently positioned at `|` and will advance
655 /// the parser to the character following `|`.
656 fn push_alternate(&self, mut concat: ast::Concat) -> Result<ast::Concat> {
657 assert_eq!(self.char(), '|');
658 concat.span.end = self.pos();
659 self.push_or_add_alternation(concat);
660 self.bump();
661 Ok(ast::Concat {
662 span: self.span(),
663 asts: vec![],
664 })
665 }
666
667 /// Pushes or adds the given branch of an alternation to the parser's
668 /// internal stack of state.

Callers 1

parse_with_commentsMethod · 0.80

Calls 4

bumpMethod · 0.80
posMethod · 0.45
spanMethod · 0.45

Tested by

no test coverage detected