diff --git a/src/scanner.rs b/src/scanner.rs index 981b0c9..0098e14 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -62,6 +62,11 @@ impl Scanner { self.start = self.current; self.scan_token(err_hdl); } + self.tokens.push(Token { + token_type: TokenType::EOF, + lexeme: String::from(""), + line: self.line, + }); self.tokens } diff --git a/src/tokens.rs b/src/tokens.rs index 565265d..f9a91ea 100644 --- a/src/tokens.rs +++ b/src/tokens.rs @@ -43,7 +43,7 @@ pub enum TokenType { Var, While, - _EOF, + EOF, } /// Full information about a token.