Tokens - Renamed EOF to Eof
This commit is contained in:
parent
e918d90e39
commit
980729ceb3
4 changed files with 4 additions and 4 deletions
|
@ -38,7 +38,7 @@ impl ParserError {
|
||||||
pub fn new(token: &Token, message: &str) -> Self {
|
pub fn new(token: &Token, message: &str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
line: token.line,
|
line: token.line,
|
||||||
pos: if token.token_type == TokenType::EOF {
|
pos: if token.token_type == TokenType::Eof {
|
||||||
String::from(" at end of input")
|
String::from(" at end of input")
|
||||||
} else {
|
} else {
|
||||||
format!("at '{}'", token.lexeme)
|
format!("at '{}'", token.lexeme)
|
||||||
|
|
|
@ -209,7 +209,7 @@ impl Parser {
|
||||||
/// Check whether the end of token stream has been reached by checking
|
/// Check whether the end of token stream has been reached by checking
|
||||||
/// for the `EOF` token.
|
/// for the `EOF` token.
|
||||||
fn is_at_end(&self) -> bool {
|
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.
|
/// Return a reference to the current token in the stream.
|
||||||
|
|
|
@ -63,7 +63,7 @@ impl Scanner {
|
||||||
self.scan_token(err_hdl);
|
self.scan_token(err_hdl);
|
||||||
}
|
}
|
||||||
self.tokens.push(Token {
|
self.tokens.push(Token {
|
||||||
token_type: TokenType::EOF,
|
token_type: TokenType::Eof,
|
||||||
lexeme: String::from(""),
|
lexeme: String::from(""),
|
||||||
line: self.line,
|
line: self.line,
|
||||||
});
|
});
|
||||||
|
|
|
@ -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