]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] bpo-42123: Run the parser two times and only enable invalid rules on the second...
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Wed, 28 Oct 2020 00:14:15 +0000 (02:14 +0200)
committerGitHub <noreply@github.com>
Wed, 28 Oct 2020 00:14:15 +0000 (02:14 +0200)
commit24a7c298d47658295673dc04d1b6d59f2b200a7c
tree9045adac177946b15f31eb22033fbc912bbf1703
parentc4b58cea4771afc0ddfdb857b0fb5115b9f4bc9f
[3.9] bpo-42123: Run the parser two times and only enable invalid rules on the second run (GH-22111) (GH-23011)

* Implement running the parser a second time for the errors messages

The first parser run is only responsible for detecting whether
there is a `SyntaxError` or not. If there isn't the AST gets returned.
Otherwise, the parser is run a second time with all the `invalid_*`
rules enabled so that all the customized error messages get produced.

(cherry picked from commit bca701403253379409dece03053dbd739c0bd059)
Grammar/python.gram
Misc/NEWS.d/next/Core and Builtins/2020-10-23-02-43-24.bpo-42123.64gJWC.rst [new file with mode: 0644]
Parser/pegen/parse.c
Parser/pegen/pegen.c
Parser/pegen/pegen.h
Tools/peg_generator/pegen/c_generator.py