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

Method pop_class_op

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

Pop a character class set from the character class parser stack. If the top of the stack is just an item (not an operation), then return the given set unchanged. If the top of the stack is an operation, then the given set will be used as the rhs of the operation on the top of the stack. In that case, the binary operation is returned as a set.

(&self, rhs: ast::ClassSet)

Source from the content-addressed store, hash-verified

947 /// given set will be used as the rhs of the operation on the top of the
948 /// stack. In that case, the binary operation is returned as a set.
949 fn pop_class_op(&self, rhs: ast::ClassSet) -> ast::ClassSet {
950 let mut stack = self.parser().stack_class.borrow_mut();
951 let (kind, lhs) = match stack.pop() {
952 Some(ClassState::Op { kind, lhs }) => (kind, lhs),
953 Some(state @ ClassState::Open { .. }) => {
954 stack.push(state);
955 return rhs;
956 }
957 None => unreachable!(),
958 };
959 let span = Span::new(lhs.span().start, rhs.span().end);
960 ast::ClassSet::BinaryOp(ast::ClassSetBinaryOp {
961 span: span,
962 kind: kind,
963 lhs: Box::new(lhs),
964 rhs: Box::new(rhs),
965 })
966 }
967}
968
969impl<'s, P: Borrow<Parser>> ParserI<'s, P> {

Callers 2

pop_classMethod · 0.80
push_class_opMethod · 0.80

Calls 4

parserMethod · 0.80
popMethod · 0.45
pushMethod · 0.45
spanMethod · 0.45

Tested by

no test coverage detected