Expect any of `Kinds` or return error
(&mut self, kind: Vec<Kind>)
| 222 | |
| 223 | /// Expect any of `Kinds` or return error |
| 224 | pub fn expect_any(&mut self, kind: Vec<Kind>) -> Result<(), ParsingError> { |
| 225 | if !kind.contains(&self.cur_token.kind) { |
| 226 | let mut expected = String::new(); |
| 227 | for kind in kind { |
| 228 | expected.push_str(&format!("{:?}, ", kind)); |
| 229 | } |
| 230 | let found = self.cur_token.kind; |
| 231 | panic!("Expected one of {:?} but found {:?}", expected, found); |
| 232 | } |
| 233 | self.bump_any(); |
| 234 | Ok(()) |
| 235 | } |
| 236 | |
| 237 | fn get_offset_line_number(&self, pos: u32) -> u32 { |
| 238 | match self.lexer.line_starts.binary_search(&pos) { |
no test coverage detected