@@ -118,6 +118,13 @@ def compile_tables(data: dict) -> dict:
118118 if "operator-name" in v and ("unicode-equivalent" in v or "ascii" in v )
119119 }
120120
121+ # operator-to-ascii or character symbol name
122+ operator_to_ascii = {
123+ v ["operator-name" ]: v .get ("ascii" , rf'\[{ v ["operator-name" ]} ]' )
124+ for k , v in data .items ()
125+ if "operator-name" in v and ("unicode-equivalent" in v or "ascii" in v )
126+ }
127+
121128 # Conversion from unicode or ascii to wl dictionary entry.
122129 # We filter the dictionary after it's first created to redundant entries
123130 unicode_to_wl_dict = {
@@ -145,7 +152,8 @@ def compile_tables(data: dict) -> dict:
145152 operator_names = sorted ([k for k , v in data .items () if "operator-name" in v ])
146153
147154 ascii_operators = []
148- ascii_operator_to_name = {}
155+ ascii_operator_to_character_symbol = {}
156+ ascii_operator_to_symbol = {}
149157 ascii_operator_to_unicode = {}
150158 ascii_operator_to_wl_unicode = {}
151159
@@ -155,7 +163,8 @@ def compile_tables(data: dict) -> dict:
155163 ascii_name = v .get ("ascii" , None )
156164 if ascii_name is not None :
157165 ascii_operators .append (v ["ascii" ])
158- ascii_operator_to_name [ascii_name ] = rf'\[{ v ["operator-name" ]} ]'
166+ ascii_operator_to_character_symbol [ascii_name ] = rf'\[{ v ["operator-name" ]} ]'
167+ ascii_operator_to_symbol [ascii_name ] = v ["operator-name" ]
159168 # Mathics core stores the ascii operator value, Use that to get standard unicode
160169 # symbol, and failing use the ASCII sequence.
161170 ascii_operator_to_unicode [ascii_name ] = v .get (
@@ -193,13 +202,15 @@ def compile_tables(data: dict) -> dict:
193202 return {
194203 "aliased-characters" : aliased_characters ,
195204 "ascii-operators" : ascii_operators ,
196- "ascii-operator-to-name" : ascii_operator_to_name ,
205+ "ascii-operator-to-symbol" : ascii_operator_to_symbol ,
206+ "ascii-operator-to-character-symbol" : ascii_operator_to_character_symbol ,
197207 "ascii-operator-to-unicode" : ascii_operator_to_unicode ,
198208 "ascii-operator-to-wl-unicode" : ascii_operator_to_wl_unicode ,
199209 "letterlikes" : letterlikes ,
200210 "named-characters" : named_characters ,
201211 "operator-names" : operator_names ,
202212 "operator-to-precedence" : operator_to_precedence ,
213+ "operator-to-ascii" : operator_to_ascii ,
203214 "operator-to-unicode" : operator_to_unicode ,
204215 # unicode-operators is irregular, but this is what
205216 # mathics-pygments uses
@@ -219,12 +230,14 @@ def compile_tables(data: dict) -> dict:
219230ALL_FIELDS = [
220231 "aliased-characters" ,
221232 "ascii-operators" ,
222- "ascii-operator-to-name" ,
233+ "ascii-operator-to-character-symbol" ,
234+ "ascii-operator-to-symbol" ,
223235 "ascii-operator-to-unicode" ,
224236 "ascii-operator-to-wl-unicode" ,
225237 "letterlikes" ,
226238 "named-characters" ,
227239 "operator-names" ,
240+ "operator-to-ascii" ,
228241 "operator-to-precedence" ,
229242 "operator-to-unicode" ,
230243 "unicode-operators" ,
0 commit comments