|
14 | 14 | rWhitespace = re.compile(r"[ \t]+", re.M) |
15 | 15 | rCommandSeparator = re.compile(r"[\r\n;]+", re.M) |
16 | 16 | rBits = re.compile(r"[01]+") |
17 | | -rName = re.compile(r"(?!\binp\b|\b__scope__\b)[a-zA-Z0-9_$]+") |
| 17 | +rName = re.compile(r"(?!\b[ab]inp\b|\b__scope__\b)[a-zA-Z0-9_$]+") |
18 | 18 | rRandom = re.compile(r"\?") |
19 | | -rInput = re.compile(r"\binp\b") |
| 19 | +rInput = re.compile(r"\b[ab]inp\b") |
20 | 20 | rScope = re.compile(r"\b__scope__\b") |
21 | 21 | rInfix = re.compile(r"[&|]") |
22 | 22 | rPrefix = re.compile(r"[!~@]") |
@@ -74,7 +74,7 @@ def Random(result): |
74 | 74 |
|
75 | 75 |
|
76 | 76 | def Input(result): |
77 | | - return lambda scope: GetInput(scope) |
| 77 | + return lambda scope: GetInput(scope, result[0][0]) |
78 | 78 |
|
79 | 79 |
|
80 | 80 | def ScopeTransform(result): |
@@ -175,9 +175,18 @@ def Out(result): |
175 | 175 | return lambda scope: Print(result[1](scope)) |
176 | 176 |
|
177 | 177 |
|
178 | | -def GetInput(scope): |
| 178 | +def GetInput(scope, inputarg): |
179 | 179 | if not len(scope["input"]): |
180 | | - scope["input"] = [list(map(int, filter(lambda c: c == "0" or c == "1", raw_input("Input: "))))] |
| 180 | + if inputarg == "a": |
| 181 | + temp = list(x for x in raw_input("Input: ") if ord(x) < 256) |
| 182 | + for a in range(len(temp)): |
| 183 | + temp[a] = bin(ord(temp[a]))[2:] |
| 184 | + while len(temp[a]) < 8: |
| 185 | + temp[a] = "0" + temp[a] |
| 186 | + temp = "".join(temp) |
| 187 | + scope["input"] = [[int(x) for x in temp]] |
| 188 | + if inputarg == "b": |
| 189 | + scope["input"] = [list(map(int, filter(lambda c: c == "0" or c == "1", raw_input("Input: "))))] |
181 | 190 | return scope["input"].pop() |
182 | 191 |
|
183 | 192 |
|
|
0 commit comments