mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
Allow multiple indented blocks in REPL (#6097)
There aren't any tests but being able to do nested for loops seems like a pretty big win to me so I'm going to put up for review. The original returned boolean clearly had **false positives** for detecting bad errors for things like nested `if` and `for` statements. What is less clear is if there are any **true positives** which I am no longer catching with the updated return value. Co-authored-by: Jack O'Connor <jack@jackoconnor.dev>
This commit is contained in:
1 parent
ceb7046bc4
commit
109e64c2ba
1 file changed
+1
-5
+1
-5
@@ -86,11 +86,7 @@ fn shell_exec(
|
||||
continuing_block
|
||||
} // && p.location.is_some()
|
||||
ParseErrorType::OtherError(msg) => {
|
||||
if msg.starts_with("Expected an indented block") {
|
||||
continuing_block
|
||||
} else {
|
||||
true
|
||||
}
|
||||
!msg.starts_with("Expected an indented block")
|
||||
}
|
||||
_ => true, // !matches!(p, ParseErrorType::UnrecognizedToken(Tok::Dedent, _))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user