Skip to content

Commit

Permalink
unpack for nested loops done
Browse files Browse the repository at this point in the history
  • Loading branch information
mathcat4 committed Apr 8, 2022
1 parent dc98790 commit 77a5880
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ def structure(tokens):


if __name__ == "__main__":
print(structure(tokenize("2↹4{1↹{9}}5")))
print(structure(tokenize("3↹2{1↹{9}}5")))
4 changes: 2 additions & 2 deletions unpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def unpack_forLoop(tokens):
unpacked_tokens.append(token)
elif isinstance(token, ForLoop):
for _ in range(token.number.value):
unpacked_tokens.extend(token.body)
unpacked_tokens.extend(unpack_forLoop(token.body))

return unpacked_tokens

Expand All @@ -21,4 +21,4 @@ def unpack(tokens):


if __name__ == "__main__":
print(unpack(structure(tokenize("+2 3↹4{¶1} 5"))))
print(unpack(structure(tokenize("3↹2{1↹{9}}5"))))

0 comments on commit 77a5880

Please sign in to comment.