mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 12:22:42 +00:00
Chapter 10 done
This commit is contained in:
parent
956c4d0f28
commit
46f1030207
16 changed files with 1173 additions and 201 deletions
|
|
@ -9,9 +9,10 @@ use super::{Token, TokenType};
|
|||
|
||||
static KEYWORDS: phf::Map<&'static str, TokenType> = phf_map! {
|
||||
"and" => TokenType::And,
|
||||
"break" => TokenType::Break,
|
||||
"class" => TokenType::Class,
|
||||
"else" => TokenType::Else,
|
||||
"false" => TokenType::Else,
|
||||
"false" => TokenType::False,
|
||||
"for" => TokenType::For,
|
||||
"fun" => TokenType::Fun,
|
||||
"if" => TokenType::If,
|
||||
|
|
@ -232,7 +233,7 @@ impl Lexer {
|
|||
}
|
||||
|
||||
fn push_token(&mut self, token_type: TokenType) {
|
||||
let lexeme: String = self.source[self.start..self.current].iter().collect();
|
||||
// let lexeme: String = self.source[self.start..self.current].iter().collect();
|
||||
|
||||
self.tokens.push(Token::new(token_type, self.code_pos));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue