Return an "unclosed class" error whose span points to the most recently opened class. This should only be called while parsing a character class.
(&self)
| 908 | /// |
| 909 | /// This should only be called while parsing a character class. |
| 910 | fn unclosed_class_error(&self) -> ast::Error { |
| 911 | for state in self.parser().stack_class.borrow().iter().rev() { |
| 912 | match *state { |
| 913 | ClassState::Open { ref set, .. } => { |
| 914 | return self.error(set.span, ast::ErrorKind::ClassUnclosed); |
| 915 | } |
| 916 | _ => {} |
| 917 | } |
| 918 | } |
| 919 | // We are guaranteed to have a non-empty stack with at least |
| 920 | // one open bracket, so we should never get here. |
| 921 | panic!("no open character class found") |
| 922 | } |
| 923 | |
| 924 | /// Push the current set of class items on to the class parser's stack as |
| 925 | /// the left hand side of the given operator. |
no test coverage detected