summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-04-11 08:06:50 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-04-11 08:06:50 (GMT)
commit01b810106c348db2e3242126adf655b686aa2a1c (patch)
tree05720ebb7aced194421b69bb1ea225af60ac0092 /Parser
parent9b26122ec0f0b2dd219070b19efd95f54aade034 (diff)
downloadcpython-01b810106c348db2e3242126adf655b686aa2a1c.zip
cpython-01b810106c348db2e3242126adf655b686aa2a1c.tar.gz
cpython-01b810106c348db2e3242126adf655b686aa2a1c.tar.bz2
Make _kind types global for C++ compilation.
Explicitly cast void* to int to cmpop_ty.
Diffstat (limited to 'Parser')
-rwxr-xr-xParser/asdl_c.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index fdbbeaf..0639789 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -155,8 +155,10 @@ class StructVisitor(EmitVisitor):
type = sum.types[i]
enum.append("%s_kind=%d" % (type.name, i + 1))
+ emit("enum _%(name)s_kind {" + ", ".join(enum) + "};")
+
emit("struct _%(name)s {")
- emit("enum { " + ", ".join(enum) + " } kind;", depth + 1)
+ emit("enum _%(name)s_kind kind;", depth + 1)
emit("union {", depth + 1)
for t in sum.types:
self.visit(t, depth + 2)
@@ -679,8 +681,8 @@ class ObjVisitor(PickleVisitor):
self.emit("if (!value) goto failed;", depth+1)
self.emit("for(i = 0; i < n; i++)", depth+1)
# This cannot fail, so no need for error handling
- self.emit("PyList_SET_ITEM(value, i, ast2obj_%s((%s_ty)asdl_seq_GET(%s, i)));" %
- (field.type, field.type, value), depth+2, reflow=False)
+ self.emit("PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)(int)asdl_seq_GET(%s, i)));" % value,
+ depth+2, reflow=False)
self.emit("}", depth)
else:
self.emit("value = ast2obj_list(%s, ast2obj_%s);" % (value, field.type), depth)