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)
| 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 | |
| 969 | impl<'s, P: Borrow<Parser>> ParserI<'s, P> { |