Scanner - Add the EOF token
This commit is contained in:
parent
ed03d565ea
commit
aab0e0a591
2 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ pub enum TokenType {
|
|||
Var,
|
||||
While,
|
||||
|
||||
_EOF,
|
||||
EOF,
|
||||
}
|
||||
|
||||
/// Full information about a token.
|
||||
|
|
Loading…
Reference in a new issue