From 6cb57b2075137d7b3da43670dbb73aeab616e5e9 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 e1e6b2b81269b..091bc7717fde9 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 530a20cc9659cc90f65742cc4dddaddb059f669e 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 091bc7717fde9..b6611c2963538 100644 --- a/parser/src/error.rs +++ b/parser/src/error.rs @@ -221,7 +221,7 @@ pub(crate) fn parse_error_from_lalrpop( source_path, } } - }, + } } }