MCPcopy Create free account
hub / github.com/Glyphack/enderpy / expect_any

Method expect_any

parser/src/parser/parser.rs:224–235  ·  view source on GitHub ↗

Expect any of `Kinds` or return error

(&mut self, kind: Vec<Kind>)

Source from the content-addressed store, hash-verified

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) {

Callers 1

parse_match_statementMethod · 0.80

Calls 1

bump_anyMethod · 0.80

Tested by

no test coverage detected