From 63af15cc948900f277ee63b7169eb73633c1ab6d Mon Sep 17 00:00:00 2001 From: Erin Date: Sat, 2 Jul 2022 00:22:40 +0200 Subject: [PATCH] EOF -> EOI --- ablescript/src/error.rs | 12 ++++++------ ablescript/src/parser.rs | 8 ++++---- ablescript_cli/src/repl.rs | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ablescript/src/error.rs b/ablescript/src/error.rs index fd06cd95..321ec18c 100644 --- a/ablescript/src/error.rs +++ b/ablescript/src/error.rs @@ -9,7 +9,7 @@ pub struct Error { #[derive(Debug)] pub enum ErrorKind { - UnexpectedEof, + UnexpectedEoi, UnexpectedToken(Token), UnknownVariable(String), MeloVariable(String), @@ -25,10 +25,10 @@ impl Error { Self { kind, span } } - /// Create an UnexpectedEof error, where the EOF occurs at the - /// given index in the file. - pub fn unexpected_eof(index: usize) -> Self { - Self::new(ErrorKind::UnexpectedEof, index..index) + /// Create an UnexpectedEoi error, where the EOI occurs at the + /// given index in the input. + pub fn unexpected_eoi(index: usize) -> Self { + Self::new(ErrorKind::UnexpectedEoi, index..index) } } @@ -46,7 +46,7 @@ impl std::error::Error for Error {} impl Display for ErrorKind { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - ErrorKind::UnexpectedEof => write!(f, "unexpected end of file"), + ErrorKind::UnexpectedEoi => write!(f, "unexpected end of input"), ErrorKind::UnexpectedToken(Token::Melo) => write!(f, "unexpected marten"), ErrorKind::UnexpectedToken(token) => write!(f, "unexpected token {:?}", token), ErrorKind::UnknownVariable(name) => write!(f, "unknown identifier \"{}\"", name), diff --git a/ablescript/src/parser.rs b/ablescript/src/parser.rs index 22003ce4..5cd89ab0 100644 --- a/ablescript/src/parser.rs +++ b/ablescript/src/parser.rs @@ -50,7 +50,7 @@ impl<'source> Parser<'source> { match self .lexer .next() - .ok_or_else(|| Error::unexpected_eof(self.lexer.span().start))? + .ok_or_else(|| Error::unexpected_eoi(self.lexer.span().start))? { Token::Comment => (), token => break Ok(token), @@ -195,7 +195,7 @@ impl<'source> Parser<'source> { cart.push(( value, buf.take().ok_or_else(|| { - Error::unexpected_eof(self.lexer.span().start) + Error::unexpected_eoi(self.lexer.span().start) })?, )); @@ -205,7 +205,7 @@ impl<'source> Parser<'source> { t => buf = Some(self.parse_expr(t, &mut buf)?), } } - .ok_or_else(|| Error::unexpected_eof(self.lexer.span().start))?; + .ok_or_else(|| Error::unexpected_eoi(self.lexer.span().start))?; cart.push((value, key)); } @@ -259,7 +259,7 @@ impl<'source> Parser<'source> { let next = self .lexer .next() - .ok_or_else(|| Error::unexpected_eof(self.lexer.span().start))?; + .ok_or_else(|| Error::unexpected_eoi(self.lexer.span().start))?; Box::new(self.parse_expr(next, &mut None)?) }, kind, diff --git a/ablescript_cli/src/repl.rs b/ablescript_cli/src/repl.rs index 2aebbcff..4c4bfd01 100644 --- a/ablescript_cli/src/repl.rs +++ b/ablescript_cli/src/repl.rs @@ -31,7 +31,7 @@ pub fn repl(ast_print: bool) { Err(ablescript::error::Error { // Treat "Unexpected EOF" errors as "we need // more data". - kind: ablescript::error::ErrorKind::UnexpectedEof, + kind: ablescript::error::ErrorKind::UnexpectedEoi, .. }) => Some(partial_data), Err(e) => {