ruff/crates/ruff_python_parser
Andrew Gallant 6a1fa4778f
Reject more syntactically invalid Python programs (#8524)
## Summary

This commit adds some additional error checking to the parser such that
assignments that are invalid syntax are rejected. This covers the
obvious cases like `5 = 3` and some not so obvious cases like `x + y =
42`.

This does add an additional recursive call to the parser for the cases
handling assignments. I had initially been concerned about doing this,
but `set_context` is already doing recursion during assignments, so I
didn't feel as though this was changing any fundamental performance
characteristics of the parser. (Also, in practice, I would expect any
such recursion here to be quite shallow since the recursion is done on
the target of an assignment. Such things are rarely nested much in
practice.)

Fixes #6895

## Test Plan

I've added unit tests covering every case that is detected as invalid on
an `Expr`.
2023-11-07 07:16:06 -05:00
..
src Reject more syntactically invalid Python programs (#8524) 2023-11-07 07:16:06 -05:00
build.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
Cargo.toml perf(parser): use memchr for lexing comments (#8193) 2023-10-27 02:07:43 +01:00