|
|
@@ -197,7 +197,7 @@ class ModelverseKernel(object):
|
|
|
else:
|
|
|
false = ""
|
|
|
|
|
|
- instruction = " " * indent + "if(" + cond + "):\n" + true + "\n" + false
|
|
|
+ instruction = " " * indent + "if (" + cond + "):\n" + true + "\n" + false
|
|
|
elif inst_type["value"] == "constant":
|
|
|
node, = yield [("RD", [inst, "node"])]
|
|
|
node, = yield [("RV", [node])]
|
|
|
@@ -213,8 +213,11 @@ class ModelverseKernel(object):
|
|
|
instruction = ""
|
|
|
elif inst_type["value"] == "resolve":
|
|
|
value, = yield [("RD", [inst, "var"])]
|
|
|
- #instruction, = yield [("CALL_ARGS", [self.print_instruction, (value, 0)])]
|
|
|
- instruction = "var_%s" % value
|
|
|
+ str_value, = yield [("RV", [value])]
|
|
|
+ if str_value:
|
|
|
+ instruction = str_value
|
|
|
+ else:
|
|
|
+ instruction = str(value)
|
|
|
elif inst_type["value"] == "assign":
|
|
|
var, val = yield [("RD", [inst, "var"]),
|
|
|
("RD", [inst, "value"])]
|
|
|
@@ -222,9 +225,14 @@ class ModelverseKernel(object):
|
|
|
("CALL_ARGS", [self.print_instruction, (val, 0)])]
|
|
|
instruction = " " * indent + var + " = " + val + "\n"
|
|
|
elif inst_type["value"] == "call":
|
|
|
- instruction = " " * indent + "call(X)"
|
|
|
+ func_name, = yield [("RD", [inst, "func"])]
|
|
|
+ func_name, = yield [("CALL_ARGS", [self.print_instruction, (func_name, 0)])]
|
|
|
+ instruction = " " * indent + func_name + "(X)"
|
|
|
if indent:
|
|
|
instruction += "\n"
|
|
|
+ elif inst_type["value"] == "access":
|
|
|
+ value, = yield [("RD", [inst, "var"])]
|
|
|
+ instruction, = yield [("CALL_ARGS", [self.print_instruction, (value, 0)])]
|
|
|
elif inst_type["value"] == "while":
|
|
|
cond, body = yield [("RD", [inst, "cond"]),
|
|
|
("RD", [inst, "body"])]
|