]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-42123: Run the parser two times and only enable invalid rules on the second run...
authorLysandros Nikolaou <lisandrosnik@gmail.com>
Mon, 26 Oct 2020 22:42:04 +0000 (00:42 +0200)
committerGitHub <noreply@github.com>
Mon, 26 Oct 2020 22:42:04 +0000 (00:42 +0200)
commitbca701403253379409dece03053dbd739c0bd059
tree9222677d56d4669ac00f734ffeb7d72797bb6a89
parentc8c4200b65b2159bbb13cee10d67dfb3676fef26
bpo-42123: Run the parser two times and only enable invalid rules on the second run (GH-22111)

* 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.
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/parser.c
Parser/pegen.c
Parser/pegen.h
Tools/peg_generator/pegen/c_generator.py