summaryrefslogtreecommitdiff
path: root/Parser/asdl.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-07-31 21:41:56 -0700
committerBenjamin Peterson <benjamin@python.org>2012-07-31 21:41:56 -0700
commit481ae50ccd32a767fbe986803703f6c217fc76fc (patch)
treec0e5eb45eda03718e2b1893efe50741a9eab0e3f /Parser/asdl.py
parent0efcf99c9eebfd65f6dd7ecc5c94b1c340ad6513 (diff)
downloadcpython-git-481ae50ccd32a767fbe986803703f6c217fc76fc.tar.gz
construct fields in the right order (closes #15517)
Patch from Taihyun Hwang.
Diffstat (limited to 'Parser/asdl.py')
-rw-r--r--Parser/asdl.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/Parser/asdl.py b/Parser/asdl.py
index 01a8b5ebf7..08aa05b897 100644
--- a/Parser/asdl.py
+++ b/Parser/asdl.py
@@ -156,15 +156,11 @@ class ASDLParser(spark.GenericParser, object):
if id.value != "attributes":
raise ASDLSyntaxError(id.lineno,
msg="expected attributes, found %s" % id)
- if attributes:
- attributes.reverse()
return Sum(sum, attributes)
def p_product(self, info):
" product ::= ( fields ) "
_0, fields, _1 = info
- # XXX can't I just construct things in the right order?
- fields.reverse()
return Product(fields)
def p_sum_0(self, constructor):
@@ -188,8 +184,6 @@ class ASDLParser(spark.GenericParser, object):
def p_constructor_1(self, info):
" constructor ::= Id ( fields ) "
id, _0, fields, _1 = info
- # XXX can't I just construct things in the right order?
- fields.reverse()
return Constructor(id, fields)
def p_fields_0(self, field):
@@ -197,8 +191,8 @@ class ASDLParser(spark.GenericParser, object):
return [field[0]]
def p_fields_1(self, info):
- " fields ::= field , fields "
- field, _, fields = info
+ " fields ::= fields , field "
+ fields, _, field = info
return fields + [field]
def p_field_0(self, type_):