Expect a `Kind` or return error
(&mut self, kind: Kind)
| 211 | |
| 212 | /// Expect a `Kind` or return error |
| 213 | pub fn expect(&mut self, kind: Kind) -> Result<(), ParsingError> { |
| 214 | if !self.at(kind) { |
| 215 | let found = &self.cur_token; |
| 216 | let line = &self.get_offset_line_number(found.start); |
| 217 | panic!("Expected {:?} but found {:?} line: {line:}", kind, found); |
| 218 | } |
| 219 | self.bump_any(); |
| 220 | Ok(()) |
| 221 | } |
| 222 | |
| 223 | /// Expect any of `Kinds` or return error |
| 224 | pub fn expect_any(&mut self, kind: Vec<Kind>) -> Result<(), ParsingError> { |