summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-06-20 17:59:32 (GMT)
committerGitHub <noreply@github.com>2020-06-20 17:59:32 (GMT)
commit98621817504add1e985e2526614921bbe0d24fb6 (patch)
tree2887c29f6208b9d714e0dd736907fe2c29bfd3ae /Lib
parentc9f83c173b0cc62d6fcdc363e9ab05f6664ff8f3 (diff)
downloadcpython-98621817504add1e985e2526614921bbe0d24fb6.zip
cpython-98621817504add1e985e2526614921bbe0d24fb6.tar.gz
cpython-98621817504add1e985e2526614921bbe0d24fb6.tar.bz2
bpo-41044: Generate valid PEG python parsers for opt+seq rules (GH-20995)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> (cherry picked from commit 55460ee6dc9a4f16bd68d6b6be3a8398c7d4a596) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_peg_generator/test_pegen.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_peg_generator/test_pegen.py b/Lib/test/test_peg_generator/test_pegen.py
index 30e1b67..5b4e964 100644
--- a/Lib/test/test_peg_generator/test_pegen.py
+++ b/Lib/test/test_peg_generator/test_pegen.py
@@ -493,6 +493,14 @@ class TestPegen(unittest.TestCase):
# Would assert False without a special case in compute_left_recursives().
make_parser(grammar)
+ def test_opt_sequence(self) -> None:
+ grammar = """
+ start: [NAME*]
+ """
+ # This case was failing because of a double trailing comma at the end
+ # of a line in the generated source. See bpo-41044
+ make_parser(grammar)
+
def test_left_recursion_too_complex(self) -> None:
grammar = """
start: foo