self.elsepart = elsepart
+def makeBlock(x):
+ if(type(x) == Assignment):
+ return [x]
+ else:
+ return x.statements
+
+
class Absyn:
def __init__(self, outputfn):
self.outputfn = outputfn
stmts.children.append(Leaf(token.STRING, "):"))
stmts.children.append(self.nl())
- for c1 in c.ifpart.statements:
+ for c1 in makeBlock(c.ifpart):
if(type(c1) == Assignment):
self.do_assign(c1, stmts, indent+1)
else:
stmts.children.append(Leaf(token.STRING, "with m.Else():"))
stmts.children.append(self.nl())
- for c1 in c.elsepart.statements:
+ for c1 in makeBlock(c.elsepart):
if(type(c1) == Assignment):
self.do_assign(c1, stmts, indent+1)
else: