diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-07-07 00:17:11 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-07-07 00:17:11 (GMT) |
commit | 3a62b164e7c6115a90a928e00c7383a614296bd7 (patch) | |
tree | 809a52a2bba4fbe38de35bf3e62ca4b40f0988f1 /TurtleArt | |
parent | 4c49dee1049dff9a3e1adfac544c4afe7cbab464 (diff) |
recommit lost commit 3ff08dcad6a5b25c170631646bef42da9aef2010
Diffstat (limited to 'TurtleArt')
-rw-r--r-- | TurtleArt/talogo.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index c422d29..844f9e3 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -195,7 +195,14 @@ class LogoCode: for b in blocks: # Hidden macro expansions - if b.name in ['while', 'until', 'forever']: + if b.name in ['while', 'until']: + action_blk, new_blocks = self._expand_forever(b, blk, blocks) + blocks = new_blocks[:] + if b == blk: + blk = action_blk + + for b in blocks: + if b.name in ['forever']: action_blk, new_blocks = self._expand_forever(b, blk, blocks) blocks = new_blocks[:] if b == blk: @@ -255,10 +262,10 @@ class LogoCode: code.append(dock[4]) if blk.primitive is not None: # make a tuple (prim, blk) # special case: expand 'while' and 'until' primitives - try: + if blk in self.tw.block_list.list: code.append((blk.primitive, self.tw.block_list.list.index(blk))) - except ValueError: + else: code.append(blk.primitive) # Hidden block elif len(blk.values) > 0: # Extract the value from content blocks. if blk.name == 'number': |