chapter 8 done

This commit is contained in:
Moritz Gmeiner 2023-01-22 23:33:57 +01:00
commit 956c4d0f28
13 changed files with 570 additions and 177 deletions

View file

@ -71,7 +71,7 @@ impl Lexer {
me.scan_token();
}
me.tokens.push(Token::new(TokenType::EOF, "".to_owned(), me.code_pos));
me.tokens.push(Token::new(TokenType::EOF, me.code_pos));
if me.errors.is_empty() {
Ok(me.tokens)
@ -234,7 +234,7 @@ impl Lexer {
fn push_token(&mut self, token_type: TokenType) {
let lexeme: String = self.source[self.start..self.current].iter().collect();
self.tokens.push(Token::new(token_type, lexeme, self.code_pos));
self.tokens.push(Token::new(token_type, self.code_pos));
}
fn try_parse_string(&mut self) -> Option<TokenType> {