From 0c35874aecfb919ace875855f9066ed82feefa5c Mon Sep 17 00:00:00 2001 From: Bijan Naimi Date: Sun, 1 Jan 2023 15:41:51 -0800 Subject: [PATCH 1/2] changed the shell logic for handling indents --- parser/src/error.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/parser/src/error.rs b/parser/src/error.rs index e1e6b2b..091bc77 100644 --- a/parser/src/error.rs +++ b/parser/src/error.rs @@ -205,10 +205,22 @@ pub(crate) fn parse_error_from_lalrpop( source_path, } } - LalrpopError::UnrecognizedEOF { location, .. } => ParseError { - error: ParseErrorType::Eof, - location, - source_path, + LalrpopError::UnrecognizedEOF { location, expected } => { + // This could be an initial indentation error that we should ignore + let indent_error = expected == ["Indent"]; + if indent_error { + ParseError { + error: ParseErrorType::Lexical(LexicalErrorType::IndentationError), + location, + source_path, + } + } else { + ParseError { + error: ParseErrorType::Eof, + location, + source_path, + } + } }, } } From 5f90db1527a11966de8802ac36dc18152ec2fb4d Mon Sep 17 00:00:00 2001 From: Bijan Naimi Date: Sun, 1 Jan 2023 17:28:49 -0800 Subject: [PATCH 2/2] forgot to add formatted errors.rs --- parser/src/error.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser/src/error.rs b/parser/src/error.rs index 091bc77..b6611c2 100644 --- a/parser/src/error.rs +++ b/parser/src/error.rs @@ -221,7 +221,7 @@ pub(crate) fn parse_error_from_lalrpop( source_path, } } - }, + } } }