mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-13 08:05:17 +00:00
changed the shell logic for handling indents
This commit is contained in:
parent
e4d2344c41
commit
0c35874aec
1 changed files with 16 additions and 4 deletions
|
@ -205,10 +205,22 @@ pub(crate) fn parse_error_from_lalrpop(
|
||||||
source_path,
|
source_path,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LalrpopError::UnrecognizedEOF { location, .. } => ParseError {
|
LalrpopError::UnrecognizedEOF { location, expected } => {
|
||||||
error: ParseErrorType::Eof,
|
// This could be an initial indentation error that we should ignore
|
||||||
location,
|
let indent_error = expected == ["Indent"];
|
||||||
source_path,
|
if indent_error {
|
||||||
|
ParseError {
|
||||||
|
error: ParseErrorType::Lexical(LexicalErrorType::IndentationError),
|
||||||
|
location,
|
||||||
|
source_path,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ParseError {
|
||||||
|
error: ParseErrorType::Eof,
|
||||||
|
location,
|
||||||
|
source_path,
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue