]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-42997: Improve error message for missing : before suites (GH-24292)
authorPablo Galindo <Pablogsal@gmail.com>
Tue, 2 Feb 2021 19:54:22 +0000 (19:54 +0000)
committerGitHub <noreply@github.com>
Tue, 2 Feb 2021 19:54:22 +0000 (19:54 +0000)
commit58fb156edda1a0e924a38bfed494bd06cb09c9a3
tree6d09348120225209479d011aa83be95d488e3380
parent802b645e81a72399a7ef47ef000d468c775dcd3e
bpo-42997: Improve error message for missing : before suites (GH-24292)

* Add to the peg generator a new directive ('&&') that allows to expect
  a token and hard fail the parsing if the token is not found. This
  allows to quickly emmit syntax errors for missing tokens.

* Use the new grammar element to hard-fail if the ':' is missing before
  suites.
Doc/tools/extensions/peg_highlight.py
Grammar/python.gram
Lib/test/test_syntax.py
Misc/NEWS.d/next/Core and Builtins/2021-01-24-20-19-55.bpo-42997.QUOPgP.rst [new file with mode: 0644]
Parser/parser.c
Parser/pegen.c
Parser/pegen.h
Tools/peg_generator/pegen/c_generator.py
Tools/peg_generator/pegen/grammar.py
Tools/peg_generator/pegen/grammar_parser.py
Tools/peg_generator/pegen/metagrammar.gram