Tokens - Renamed EOF to Eof

This commit is contained in:
Emmanuel BENOîT 2022-12-31 10:17:25 +01:00
parent e918d90e39
commit 980729ceb3
4 changed files with 4 additions and 4 deletions

View file

@ -38,7 +38,7 @@ impl ParserError {
pub fn new(token: &Token, message: &str) -> Self {
Self {
line: token.line,
pos: if token.token_type == TokenType::EOF {
pos: if token.token_type == TokenType::Eof {
String::from(" at end of input")
} else {
format!("at '{}'", token.lexeme)

View file

@ -209,7 +209,7 @@ impl Parser {
/// Check whether the end of token stream has been reached by checking
/// for the `EOF` token.
fn is_at_end(&self) -> bool {
self.peek().token_type == TokenType::EOF
self.peek().token_type == TokenType::Eof
}
/// Return a reference to the current token in the stream.

View file

@ -63,7 +63,7 @@ impl Scanner {
self.scan_token(err_hdl);
}
self.tokens.push(Token {
token_type: TokenType::EOF,
token_type: TokenType::Eof,
lexeme: String::from(""),
line: self.line,
});

View file

@ -43,7 +43,7 @@ pub enum TokenType {
Var,
While,
EOF,
Eof,
}
/// Full information about a token.