|
@@ -351,15 +351,20 @@ class ModelverseKernel(object):
|
|
|
("RD", [inst, "body"])]
|
|
|
(prev_cond, instruction_cond), = yield [("CALL_ARGS", [self.print_instruction, (cond, 0, indent+1)])]
|
|
|
(prev_body, instruction_body), = yield [("CALL_ARGS", [self.print_instruction, (body, indent+1)])]
|
|
|
- instruction = " " * indent + "while 1:\n" + prev_cond + \
|
|
|
+ instruction = " " * indent + "__counter_%s = 0\n" % inst + \
|
|
|
+ " " * indent + "while 1:\n" + prev_cond + \
|
|
|
" " * (indent + 1) + "if 'value' not in %s:\n" % instruction_cond + \
|
|
|
" " * (indent + 2) + "%s['value'], = yield [('RV', [%s['id']])]\n" % (instruction_cond, instruction_cond) + \
|
|
|
" " * (indent + 1) + "if not (%s['value']):\n" % instruction_cond + \
|
|
|
" " * (indent + 2) + "break\n" + \
|
|
|
" " * (indent + 1) + "else:\n" + \
|
|
|
- " " * (indent + 2) + "yield None\n" + \
|
|
|
+ " " * (indent + 2) + "__counter_%s += 1\n" % inst + \
|
|
|
+ " " * (indent + 2) + "if __counter_%s > 20:\n" % inst + \
|
|
|
+ " " * (indent + 3) + "yield None\n" + \
|
|
|
+ " " * (indent + 3) + "__counter_%s = 0\n" % inst + \
|
|
|
prev_body + instruction_body
|
|
|
|
|
|
+
|
|
|
next_inst, = yield [("RD", [inst, "next"])]
|
|
|
if next_inst:
|
|
|
(prev_next, inst_next), = yield [("CALL_ARGS", [self.print_instruction, (next_inst, indent)])]
|