cpython/Tools/peg_generator/pegen
Miss Islington (bot) ae1732d461
bpo-44180: Fix edge cases in invalid assigment rules in the parser (GH-26283)
The invalid assignment rules are very delicate since the parser can
easily raise an invalid assignment when a keyword argument is provided.
As they are very deep into the grammar tree, is very difficult to
specify in which contexts these rules can be used and in which don't.
For that, we need to use a different version of the rule that doesn't do
error checking in those situations where we don't want the rule to raise
(keyword arguments and generator expressions).

We also need to check if we are in left-recursive rule, as those can try
to eagerly advance the parser even if the parse will fail at the end of
the expression. Failing to do this allows the parser to start parsing a
call as a tuple and incorrectly identify a keyword argument as an
invalid assignment, before it realizes that it was not a tuple after all.
(cherry picked from commit c878a97968)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-05-21 11:20:43 -07:00
..
__init__.py bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503) 2020-04-22 23:29:27 +01:00
__main__.py Add small validator utility for PEG grammars (GH-23519) 2020-12-26 19:11:29 +00:00
ast_dump.py Fix some scripts in the peg generator folder (GH-19853) 2020-05-02 05:23:06 +01:00
build.py bpo-43244: Fix test_peg_generator for PyAST_Validate() (GH-24912) 2021-03-18 02:46:06 +01:00
c_generator.py bpo-44180: Fix edge cases in invalid assigment rules in the parser (GH-26283) 2021-05-21 11:20:43 -07:00
first_sets.py Clean up unused imports for the peg generator module (GH-19891) 2020-05-04 03:03:05 +01:00
grammar.py bpo-42997: Improve error message for missing : before suites (GH-24292) 2021-02-02 19:54:22 +00:00
grammar_parser.py bpo-38605: Revert making 'from __future__ import annotations' the default (GH-25490) 2021-04-21 12:41:19 +01:00
grammar_visualizer.py Clean up unused imports for the peg generator module (GH-19891) 2020-05-04 03:03:05 +01:00
keywordgen.py Delete remaining references to Grammar/Grammar from docs (#21624) 2020-07-26 08:27:52 -07:00
metagrammar.gram bpo-42997: Improve error message for missing : before suites (GH-24292) 2021-02-02 19:54:22 +00:00
parser.py bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503) 2020-04-22 23:29:27 +01:00
parser_generator.py Fix typing problems reported by mypy in pegen (GH-20297) 2020-05-21 21:39:44 +01:00
python_generator.py bpo-38605: Revert making 'from __future__ import annotations' the default (GH-25490) 2021-04-21 12:41:19 +01:00
sccutils.py Revert "Fix all Python Cookbook links (#22205)" (GH-22424) 2020-09-27 01:47:25 +01:00
testutil.py bpo-40750: Support -d flag in the new parser (GH-20340) 2020-05-25 18:38:45 +01:00
tokenizer.py bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503) 2020-04-22 23:29:27 +01:00
validator.py Add small validator utility for PEG grammars (GH-23519) 2020-12-26 19:11:29 +00:00