Skip to content

Commit 6cb57b2

Browse files
committed
changed the shell logic for handling indents
1 parent 95fb938 commit 6cb57b2

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

‎parser/src/error.rs‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,22 @@ pub(crate) fn parse_error_from_lalrpop(
205205
source_path,
206206
}
207207
}
208-
LalrpopError::UnrecognizedEOF { location, .. } => ParseError {
209-
error: ParseErrorType::Eof,
210-
location,
211-
source_path,
208+
LalrpopError::UnrecognizedEOF { location, expected } => {
209+
// This could be an initial indentation error that we should ignore
210+
let indent_error = expected == ["Indent"];
211+
if indent_error {
212+
ParseError {
213+
error: ParseErrorType::Lexical(LexicalErrorType::IndentationError),
214+
location,
215+
source_path,
216+
}
217+
} else {
218+
ParseError {
219+
error: ParseErrorType::Eof,
220+
location,
221+
source_path,
222+
}
223+
}
212224
},
213225
}
214226
}

0 commit comments

Comments
 (0)