luaur-ast 0.1.0

Lexer, parser, and AST for Luau (faithful Rust port).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::records::lexeme::Type;
use crate::records::parser::Parser;

impl Parser {
    pub fn expect_and_consume_type(&mut self, type_: Type, context: &str) -> bool {
        if self.lexer.current().r#type != type_ {
            self.expect_and_consume_fail_with_lookahead(type_, context);

            false
        } else {
            self.next_lexeme();

            true
        }
    }
}