Skip to main content

luaur_ast/methods/
parser_expect_and_consume_parser_alt_b.rs

1use crate::records::lexeme::Type;
2use crate::records::parser::Parser;
3
4impl Parser {
5    pub fn expect_and_consume_type(&mut self, type_: Type, context: &str) -> bool {
6        if self.lexer.current().r#type != type_ {
7            self.expect_and_consume_fail_with_lookahead(type_, context);
8
9            false
10        } else {
11            self.next_lexeme();
12
13            true
14        }
15    }
16}