summaryrefslogtreecommitdiffstats
path: root/Modules/parsermodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-05-24 15:47:06 (GMT)
committerGuido van Rossum <guido@python.org>2002-05-24 15:47:06 (GMT)
commit2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4 (patch)
treedf063351c064542b1694701577ad4e14dd5e00a5 /Modules/parsermodule.c
parenta0a6c5a042818461fa199c8a3daefb7fd00ffe1b (diff)
downloadcpython-2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4.zip
cpython-2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4.tar.gz
cpython-2d3b986480f5a01329cc66b2bdf50fdb94e1c1e4.tar.bz2
Disambiguate the grammar for backtick.
The old syntax suggested that a trailing comma was OK inside backticks, but in fact (due to ideosyncrasies of pgen) it was not. Fix the grammar to avoid the ambiguity. Fred: you may want to update the refman.
Diffstat (limited to 'Modules/parsermodule.c')
-rw-r--r--Modules/parsermodule.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index ca0531d..24dec1f 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -844,6 +844,7 @@ VALIDATER(subscriptlist); VALIDATER(sliceop);
VALIDATER(exprlist); VALIDATER(dictmaker);
VALIDATER(arglist); VALIDATER(argument);
VALIDATER(listmaker); VALIDATER(yield_stmt);
+VALIDATER(testlist1);
#undef VALIDATER
@@ -1057,6 +1058,14 @@ validate_testlist(node *tree)
static int
+validate_testlist1(node *tree)
+{
+ return (validate_repeating_list(tree, testlist1,
+ validate_test, "testlist1"));
+}
+
+
+static int
validate_testlist_safe(node *tree)
{
return (validate_repeating_list(tree, testlist_safe,
@@ -2185,7 +2194,7 @@ validate_atom(node *tree)
break;
case BACKQUOTE:
res = ((nch == 3)
- && validate_testlist(CHILD(tree, 1))
+ && validate_testlist1(CHILD(tree, 1))
&& validate_ntype(CHILD(tree, 2), BACKQUOTE));
break;
case NAME:
@@ -2671,6 +2680,9 @@ validate_node(node *tree)
case testlist:
res = validate_testlist(tree);
break;
+ case testlist1:
+ res = validate_testlist1(tree);
+ break;
case test:
res = validate_test(tree);
break;