Skip to content

Commit 944d66c

Browse files
committed
Update piduck.py
1 parent c4308f1 commit 944d66c

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

piduck.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@
3030
exit(3)
3131

3232

33-
def divide_chunks(l, n):
34-
for i in range(0, len(l), n):
35-
yield l[i : i + n]
36-
37-
3833
def string(string):
3934
for char in string:
4035
pharse(char, [], True)
@@ -65,22 +60,22 @@ def pharse(line, known, deltrue):
6560
if not deltrue:
6661
sleep(default_delay / 100)
6762
if command[0] == "STRING":
68-
string(line[len("STRING "):])
69-
return
70-
elif command[0] in keymap.aliasmap:
71-
pharse(keymap.aliasmap[command[0]] + " " + " ".join(command[1:]), known, True)
63+
string(line[len("STRING ") :])
7264
return
7365
elif command[0] in keymap.commap:
74-
known.append(keymap.commap[command[0]])
66+
known[0].append(keymap.commap[command[0]])
7567
pharse(" ".join(command[1:]), known, True)
7668
return
7769
elif command[0] in keymap.c1map:
78-
known.append(keymap.c1map[command[0]])
70+
known[1].append(keymap.c1map[command[0]])
7971
out(known)
8072
return
8173
elif command[0] in keymap.c2map:
8274
pharse(keymap.c2map[command[0]], known, True)
8375
return
76+
elif command[0] in keymap.aliasmap:
77+
pharse(keymap.aliasmap[command[0]] + " " + " ".join(command[1:]), known, True)
78+
return
8479
else:
8580
exit(2)
8681

@@ -108,14 +103,14 @@ def main():
108103
line = file1.readline()
109104
if not line:
110105
break
111-
pharse(line.strip(), [], False)
106+
pharse(line.strip(), [[], []], False)
112107
file1.close()
113108
else:
114109
while True:
115110
line = input()
116111
if not line:
117112
break
118-
pharse(line.strip(), [], False)
113+
pharse(line.strip(), [[], []], False)
119114

120115

121116
main()

0 commit comments

Comments
 (0)