mirror of
https://github.com/RustPython/Parser.git
synced 2025-08-26 05:14:40 +00:00
Merge pull request #4399 from branai/shell-continuing-fix
Fix IndentationError works differently with cpython in interective shell
This commit is contained in:
commit
3d03439618
1 changed files with 17 additions and 5 deletions
|
@ -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,
|
||||||
},
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue