diff options
author | Marion <marion.zepf@gmail.com> | 2013-07-22 08:15:33 (GMT) |
---|---|---|
committer | Marion <marion.zepf@gmail.com> | 2013-07-22 08:15:33 (GMT) |
commit | 75271bb387a70a047b3258813d55e1e517c5bd44 (patch) | |
tree | e78a24d28a4454a9a63ee6a9281bed8f5b7027d4 /TurtleArt/taexportpython.py | |
parent | deecec084b202f9907457596415312e79eb66702 (diff) |
add special handling for 'repeat' loops
- easily extensible to other loop types
Diffstat (limited to 'TurtleArt/taexportpython.py')
-rw-r--r-- | TurtleArt/taexportpython.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/TurtleArt/taexportpython.py b/TurtleArt/taexportpython.py index bca2119..11033a7 100644 --- a/TurtleArt/taexportpython.py +++ b/TurtleArt/taexportpython.py @@ -93,6 +93,7 @@ def _action_stack_to_python(block, lc, name="start"): # traverse the block stack and get the AST for every block ast_list = _walk_action_stack(block, lc) action_stack_ast = ast.Module(body=ast_list) + #debug_output(str(action_stack_ast)) # serialize the ASTs into python code generated_code = codegen.to_source(action_stack_ast) @@ -153,11 +154,11 @@ def _walk_action_stack(top_block, lc): new_arg_asts = _walk_action_stack(conn, lc) if dock[0] == 'flow': # body of conditional or loop - arg_asts.append(ast.List(elts=new_arg_asts, ctx=ast.Load)) + arg_asts.extend(new_arg_asts) + #arg_asts.append(ast.List(elts=new_arg_asts, ctx=ast.Load)) else: # argument block arg_asts.append(*new_arg_asts) - # TODO There could be a '(', ')', '[' or ']' ??? # finish off last block _finish_off(block) |