Merge pull request #4399 from branai/shell-continuing-fix

Fix IndentationError works differently with cpython in interective shell
This commit is contained in:
Jeong YunWon 2023-01-03 04:32:03 +09:00 committed by GitHub
commit 3d03439618

View file

@ -205,11 +205,23 @@ pub(crate) fn parse_error_from_lalrpop(
source_path, source_path,
} }
} }
LalrpopError::UnrecognizedEOF { location, .. } => ParseError { 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, error: ParseErrorType::Eof,
location, location,
source_path, source_path,
}, }
}
}
} }
} }