|
30 | 30 | exit(3)
|
31 | 31 |
|
32 | 32 |
|
33 |
| -def divide_chunks(l, n): |
34 |
| - for i in range(0, len(l), n): |
35 |
| - yield l[i : i + n] |
36 |
| - |
37 |
| - |
38 | 33 | def string(string):
|
39 | 34 | for char in string:
|
40 | 35 | pharse(char, [], True)
|
@@ -65,22 +60,22 @@ def pharse(line, known, deltrue):
|
65 | 60 | if not deltrue:
|
66 | 61 | sleep(default_delay / 100)
|
67 | 62 | 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 ") :]) |
72 | 64 | return
|
73 | 65 | elif command[0] in keymap.commap:
|
74 |
| - known.append(keymap.commap[command[0]]) |
| 66 | + known[0].append(keymap.commap[command[0]]) |
75 | 67 | pharse(" ".join(command[1:]), known, True)
|
76 | 68 | return
|
77 | 69 | elif command[0] in keymap.c1map:
|
78 |
| - known.append(keymap.c1map[command[0]]) |
| 70 | + known[1].append(keymap.c1map[command[0]]) |
79 | 71 | out(known)
|
80 | 72 | return
|
81 | 73 | elif command[0] in keymap.c2map:
|
82 | 74 | pharse(keymap.c2map[command[0]], known, True)
|
83 | 75 | return
|
| 76 | + elif command[0] in keymap.aliasmap: |
| 77 | + pharse(keymap.aliasmap[command[0]] + " " + " ".join(command[1:]), known, True) |
| 78 | + return |
84 | 79 | else:
|
85 | 80 | exit(2)
|
86 | 81 |
|
@@ -108,14 +103,14 @@ def main():
|
108 | 103 | line = file1.readline()
|
109 | 104 | if not line:
|
110 | 105 | break
|
111 |
| - pharse(line.strip(), [], False) |
| 106 | + pharse(line.strip(), [[], []], False) |
112 | 107 | file1.close()
|
113 | 108 | else:
|
114 | 109 | while True:
|
115 | 110 | line = input()
|
116 | 111 | if not line:
|
117 | 112 | break
|
118 |
| - pharse(line.strip(), [], False) |
| 113 | + pharse(line.strip(), [[], []], False) |
119 | 114 |
|
120 | 115 |
|
121 | 116 | main()
|
|
0 commit comments