From 77a5880cfb3afc11fd466d30cee612d004ad61b7 Mon Sep 17 00:00:00 2001 From: Tams-Tams Date: Fri, 8 Apr 2022 21:04:34 +0200 Subject: [PATCH] unpack for nested loops done --- structure.py | 2 +- unpack.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/structure.py b/structure.py index 85bb2df..ce8d6d4 100644 --- a/structure.py +++ b/structure.py @@ -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"))) diff --git a/unpack.py b/unpack.py index d518a92..4978077 100644 --- a/unpack.py +++ b/unpack.py @@ -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 @@ -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"))))