luaur_ast/methods/
parser_expect_match_and_consume.rs1use crate::records::lexeme::Type;
2use crate::records::match_lexeme::MatchLexeme;
3use crate::records::parser::Parser;
4
5impl Parser {
6 pub fn expect_match_and_consume(
7 &mut self,
8 value: char,
9 begin: &MatchLexeme,
10 search_for_missing: bool,
11 ) -> bool {
12 let r#type = Type(value as i32);
13
14 if self.lexer.current().r#type != r#type {
15 self.expect_match_and_consume_fail(r#type, begin, None);
16
17 self.expect_match_and_consume_recover(value, begin, search_for_missing)
18 } else {
19 self.next_lexeme();
20
21 true
22 }
23 }
24}