Mercurial > cpython-lru_cache-weakref
diff Modules/parsermodule.c @ 23538:9e67a0d5705f legacy-trunk
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 24 May 2002 15:47:06 +0000 |
| parents | 91dd223829c6 |
| children | ed1ba37a46b7 |
line wrap: on
line diff
--- a/Modules/parsermodule.c Fri May 24 15:24:38 2002 +0000 +++ b/Modules/parsermodule.c Fri May 24 15:47:06 2002 +0000 @@ -844,6 +844,7 @@ VALIDATER(exprlist); VALIDATER(dictmaker); VALIDATER(arglist); VALIDATER(argument); VALIDATER(listmaker); VALIDATER(yield_stmt); +VALIDATER(testlist1); #undef VALIDATER @@ -1057,6 +1058,14 @@ 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 @@ 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 @@ case testlist: res = validate_testlist(tree); break; + case testlist1: + res = validate_testlist1(tree); + break; case test: res = validate_test(tree); break;
