Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/user-more-JSON-info' into using_…
Browse files Browse the repository at this point in the history
…modified_stopit_for_timeconstrained
  • Loading branch information
mmatera committed Jan 8, 2025
2 parents bff2e36 + 3e143ea commit fb9b09d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ latexdoc texdoc doc:

#: Build JSON ASCII to unicode opcode table and operator table
mathics/data/operator-tables.json mathics/data/op-tables.json mathics/data/operators.json:
$(BASH) ./admin-tools/make-op-tables.sh
$(BASH) ./admin-tools/make-JSON-tables.sh

#: Remove ChangeLog
rmChangeLog:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mathics3-generate-json-table \
--field=ascii-operator-to-unicode \
--field=ascii-operator-to-wl-unicode \
--field=operator-to-ascii \
--field=operator-to-amslatex \
--field=operator-to-unicode \
-o op-tables.json
mathics3-generate-operator-json-table -o operator-tables.json
Expand Down
4 changes: 2 additions & 2 deletions mathics/core/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,10 +1159,10 @@ class Operator(Builtin):
default_formats = True

def get_precedence(self, name: str) -> int:
operator_info = OPERATOR_DATA.get("operator-precedence")
operator_info = OPERATOR_DATA.get("operator-precedences")
assert isinstance(
operator_info, dict
), 'Internal error: "operator-precedence" should be found in operators.json'
), 'Internal error: "operator-precedences" should be found in operators.json'
precedence = operator_info.get(name)
assert isinstance(
precedence, int
Expand Down
1 change: 1 addition & 0 deletions mathics/core/convert/op.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
OPERATOR_CONVERSION_TABLES = ujson.load(f)

ascii_operator_to_symbol = OPERATOR_CONVERSION_TABLES["ascii-operator-to-symbol"]
builtin_constants = OPERATOR_CONVERSION_TABLES["builtin-constants"]
operator_to_unicode = OPERATOR_CONVERSION_TABLES["operator-to-unicode"]
operator_to_ascii = OPERATOR_CONVERSION_TABLES["operator-to-ascii"]

Expand Down
3 changes: 2 additions & 1 deletion mathics/core/parser/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
left_binary_operators = OPERATOR_DATA["left-binary-operators"]
misc_operators = OPERATOR_DATA["miscellaneous-operators"]
nonassoc_binary_operators = OPERATOR_DATA["non-associative-binary-operators"]
operator_precedences = OPERATOR_DATA["operator-precedence"]
operator_precedences = OPERATOR_DATA["operator-precedences"]
operator_to_amslatex = OPERATOR_DATA["operator-to-amslatex"]
postfix_operators = OPERATOR_DATA["postfix-operators"]
prefix_operators = OPERATOR_DATA["prefix-operators"]
right_binary_operators = OPERATOR_DATA["right-binary-operators"]
Expand Down
15 changes: 6 additions & 9 deletions mathics/core/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from mathics_scanner import InvalidSyntaxError, TranslateError
from mathics_scanner.tokeniser import Token, Tokeniser, is_symbol_name

from mathics.core.convert.op import builtin_constants
from mathics.core.parser.ast import (
Filename,
Node,
Expand All @@ -39,15 +40,11 @@
ternary_operators,
)

# FIXME: get from JSON
special_symbols = {
"\u03C0": "Pi", # Pi
"\uF74D": "E", # ExponentialE
"\uF74E": "I", # ImaginaryI
"\uF74F": "I", # ImaginaryJ
"\u221E": "Infinity", # Infinity
"\u00B0": "Degree", # Degree
}
special_symbols = builtin_constants.copy()
# FIXME: should rework so we don't have to do this
# We have the character name ImaginaryI and ImaginaryJ, but we should
# have the *operator* name, "I".
special_symbols["\uF74F"] = special_symbols["\uF74E"] = "I"


# An operator precedence value that will ensure that whatever operator
Expand Down

0 comments on commit fb9b09d

Please sign in to comment.