diff --git a/src/errors.rs b/src/errors.rs index aff25a3..f3f65bb 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -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) diff --git a/src/parser.rs b/src/parser.rs index 3656b0e..5df20d1 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -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. diff --git a/src/scanner.rs b/src/scanner.rs index 34f11fc..5228002 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -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, }); diff --git a/src/tokens.rs b/src/tokens.rs index de10921..cb8f13f 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.