From 980729ceb32dfa94a0e9aeaaa49e8280525025e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Sat, 31 Dec 2022 10:17:25 +0100 Subject: [PATCH] Tokens - Renamed EOF to Eof --- src/errors.rs | 2 +- src/parser.rs | 2 +- src/scanner.rs | 2 +- src/tokens.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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.