summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-08-23 15:35:26 (GMT)
committerFred Drake <fdrake@acm.org>2000-08-23 15:35:26 (GMT)
commit85bf3bb44afe996cd806e3be8f82b40ddbe11bc3 (patch)
treed6c48c96426c3a8a3b889df86fd6637d4b38be54 /Modules
parent03c06ee7fc62512c4b2af0ed3c57a09128f4b2ce (diff)
downloadcpython-85bf3bb44afe996cd806e3be8f82b40ddbe11bc3.zip
cpython-85bf3bb44afe996cd806e3be8f82b40ddbe11bc3.tar.gz
cpython-85bf3bb44afe996cd806e3be8f82b40ddbe11bc3.tar.bz2
validate_listmaker(): Revise to match Skip's latest changes to the
Grammar file. This makes the test suite pass once again.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/parsermodule.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index 65ca084..ef8ec9b 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -2193,6 +2193,9 @@ validate_atom(node *tree)
}
+/* listmaker:
+ * test ( list_for | (',' test)* [','] )
+ */
static int
validate_listmaker(node *tree)
{
@@ -2207,19 +2210,22 @@ validate_listmaker(node *tree)
/*
* list_iter | (',' test)* [',']
*/
- if (nch == 2 && TYPE(CHILD(tree, 1)) == list_iter)
- ok = validate_list_iter(CHILD(tree, 1));
+ if (nch == 2 && TYPE(CHILD(tree, 1)) == list_for)
+ ok = validate_list_for(CHILD(tree, 1));
else {
/* (',' test)* [','] */
int i = 1;
while (ok && nch - i >= 2) {
ok = (validate_comma(CHILD(tree, i))
&& validate_test(CHILD(tree, i+1)));
- if (ok)
- i += 2;
+ i += 2;
+ }
+ if (ok && i == nch-1)
+ ok = validate_comma(CHILD(tree, i));
+ else if (i != nch) {
+ ok = 0;
+ err_string("illegal trailing nodes for listmaker");
}
- if (ok && nch-i)
- ok = validate_comma(CHILD(tree, nch-1));
}
return ok;
}