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.start = self.current;
|
||||||
self.scan_token(err_hdl);
|
self.scan_token(err_hdl);
|
||||||
}
|
}
|
||||||
|
self.tokens.push(Token {
|
||||||
|
token_type: TokenType::EOF,
|
||||||
|
lexeme: String::from(""),
|
||||||
|
line: self.line,
|
||||||
|
});
|
||||||
self.tokens
|
self.tokens
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub enum TokenType {
|
||||||
Var,
|
Var,
|
||||||
While,
|
While,
|
||||||
|
|
||||||
_EOF,
|
EOF,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Full information about a token.
|
/// Full information about a token.
|
||||||
|
|
Loading…
Reference in a new issue