Skip to content

Commit 2ebf6aa

Browse files
committed
Catch "Repeating the repeat" RecursionError
1 parent 5e0cce8 commit 2ebf6aa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

piduck.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ def pharse(line, known, deltrue):
3030
elif command[0] == "REM":
3131
return
3232
elif command[0] == "REPEAT":
33-
for i in range(int(command[1])):
34-
pharse(last_line.strip(), [[], []], False)
35-
return # todo
33+
try:
34+
for i in range(int(command[1])):
35+
pharse(last_line.strip(), [[], []], False)
36+
return # todo
37+
except RecursionError:
38+
eprint("You can not repeat the repeat")
39+
exit(4)
3640
elif command[0] == "DEFAULTCHARDELAY":
3741
string_delay = int(command[1])
3842
return

0 commit comments

Comments
 (0)