Skip to content

Commit bcb7f18

Browse files
committed
Handle boxing ternary operators
They list two operators. We just need the first of these in "tokens".
1 parent 8d4aa62 commit bcb7f18

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

mathics_scanner/tokeniser.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,17 @@ def init_module():
210210
("VerticalSeparator", r" \uF432 "),
211211
]
212212

213-
for table in ("box-operators", "no-meaning-infix-operators"):
214-
table_info = OPERATOR_DATA[table]
213+
for table_name in ("box-operators", "no-meaning-infix-operators"):
214+
table_info = OPERATOR_DATA[table_name]
215215
for operator_name, unicode in table_info.items():
216-
if any([tup[0] == operator_name for tup in tokens]):
217-
print(f"Please remove {operator_name}")
216+
# if any([tup[0] == operator_name for tup in tokens]):
217+
# print(f"Please remove {operator_name}")
218+
219+
# Ternary operators have two character symbols
220+
# in a list. For tokens, we just want the first
221+
# of the pair
222+
if isinstance(unicode, list):
223+
unicode = unicode[0]
218224
tokens.append((operator_name, f" {unicode} "))
219225

220226
literal_tokens = {
@@ -264,14 +270,14 @@ def init_module():
264270
"FormBox",
265271
"FractionBox",
266272
"InterpretedBox",
267-
"OverunderscriptBox",
268273
"OverscriptBox",
269274
"RadicalBox",
270275
"RawBackslash",
271276
"SqrtBox",
272277
"SubscriptBox",
273278
"SuperscriptBox",
274279
"UnderscriptBox",
280+
"UnderoverscriptBox",
275281
],
276282
"]": ["RawRightBracket"],
277283
"^": ["UpSetDelayed", "UpSet", "Power"],

0 commit comments

Comments
 (0)