Skip to content

Commit 769054d

Browse files
authored
Adjust to using current Mathics3-Scanner API (#110)
* Adjust to using current Mathics3-Scanner API * Update CI to use github repo for scanner
1 parent 855482b commit 769054d

File tree

14 files changed

+59
-44
lines changed

14 files changed

+59
-44
lines changed

.github/workflows/macos.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ jobs:
2323
run: |
2424
brew install asymptote
2525
python3 -m pip install --upgrade pip
26-
# Can comment out when next Mathics core and Mathics-scanner are released
27-
# git clone https://github.com/Mathics3/mathics-scanner
28-
# (cd mathics-scanner && pip install -e . && bash ./admin-tools/make-JSON-tables.sh)
29-
# git clone https://github.com/Mathics3/mathics-core
30-
# (cd mathics-core && bash ./admin-tools/make-JSON-tables.sh && pip install -e .[full])
26+
# We can comment out after next Mathics-Scanner release
27+
# python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner[full]
28+
git clone --depth 1 https://github.com/Mathics3/mathics-scanner.git
29+
cd mathics-scanner/
30+
pip install -e .
31+
bash -x admin-tools/make-JSON-tables.sh
32+
cd ..
3133
- name: Install mathicsscript
3234
run: |
3335
make

.github/workflows/ubuntu.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ jobs:
2222
run: |
2323
sudo apt-get update -qq && sudo apt-get install -qq liblapack-dev llvm-dev asymptote
2424
python3 -m pip install --upgrade pip
25-
# We can comment out when next Mathics core and Mathics-scanner are released
26-
# git clone https://github.com/Mathics3/mathics-scanner
27-
# (cd mathics-scanner && pip install -e . && bash ./admin-tools/make-JSON-tables.sh)
28-
# git clone https://github.com/Mathics3/mathics-core
29-
# (cd mathics-core && bash ./admin-tools/make-JSON-tables.sh && pip install -e .[full])
25+
# We can comment out after next Mathics-Scanner release
26+
# python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner[full]
27+
git clone --depth 1 https://github.com/Mathics3/mathics-scanner.git
28+
cd mathics-scanner/
29+
pip install -e .
30+
bash -x admin-tools/make-JSON-tables.sh
31+
cd ..
3032
- name: Install mathicsscript
3133
run: |
3234
make

.github/workflows/windows.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ jobs:
2424
python3 -m pip install --upgrade pip
2525
python3 -m pip install wheel
2626
set LLVM_DIR="C:\Program Files\LLVM"
27-
# We can comment out when next Mathics core and Mathics-scanner are released
28-
# git clone https://github.com/Mathics3/mathics-scanner
29-
# bash -c '(cd mathics-scanner && python -m pip install -e . && bash ./admin-tools/make-JSON-tables.sh)'
30-
# git clone https://github.com/Mathics3/mathics-core
31-
# bash -c '(cd mathics-core && ./admin-tools/make-JSON-tables.sh && python -m pip install -e .)'
32-
# python -m pip install -e .
27+
# We can comment out after next Mathics-Scanner release
28+
python -m pip install -e "Mathics-Scanner[full] @ git+https://github.com/Mathics3/mathics-scanner"
29+
pip install -e .
30+
git clone --depth 1 https://github.com/Mathics3/mathics-scanner.git
31+
cd mathics-scanner/
32+
pip install -e .
33+
bash -x admin-tools/make-JSON-tables.sh
34+
cd ..
3335
- name: Install mathicsscript
3436
run: |
3537
make

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
exclude: ChangeLog-spell-corrected.diff
1111
- id: end-of-file-fixer
1212
exclude: ChangeLog-spell-corrected.diff
13-
stages: [commit]
13+
stages: [pre-commit]
1414
- id: trailing-whitespace
1515
exclude: ChangeLog-spell-corrected.diff
1616
- repo: https://github.com/psf/black

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ check: inputrc
4141
inputrc: mathicsscript/data/inputrc-unicode mathicsscript/data/inputrc-no-unicode
4242

4343
mathicsscript/data/inputrc-unicode mathicsscript/data/inputrc-no-unicode mathicsscript/data/inputrc-unicode/mma-tables.json:
44-
$(SHELL) ./admin-tools/make- @echo "# GNU Readline input unicode translations\n# Autogenerated from mathics_scanner.generate.rl_inputrc on $$(date)\n" > $@
44+
$(SHELL) ./admin-tools/make-JSON-tables.sh
4545

4646
# Check StructuredText long description formatting
4747
check-rst:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mydir=$(dirname $bs)
44
PYTHON=${PYTHON:-python}
55

66
cd $mydir/../mathicsscript/data
7-
mathics3-generate-json-table --field=ascii-operators -o mma-tables.json
7+
mathics3-make-named-character-json --field=ascii-operators -o mma-tables.json
88

99
for file in inputrc-unicode inputrc-no-unicode; do
1010
echo "# GNU Readline input unicode translations" > $file

mathicsscript/completion.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Copyright (C) 2021-2022, 2024-2025 Rocky Bernstein <rb@dustyfeet.com>
3+
# Copyright (C) 2021-2022, 2024-2026 Rocky Bernstein <rb@dustyfeet.com>
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
66
# the Free Software Foundation, either version 3 of the License, or
@@ -21,8 +21,9 @@
2121
from typing import Iterable, List, NamedTuple, Tuple
2222

2323
from mathics.core.symbols import strip_context
24-
from mathics_scanner import named_characters
2524
from mathics_pygments.lexer import Regex
25+
from mathicsscript.settings import NAMED_CHARACTERS
26+
2627
from prompt_toolkit.completion import (
2728
CompleteEvent,
2829
Completer,
@@ -82,11 +83,11 @@ def get_completions(
8283
yield Completion(cmd, -len(word))
8384

8485

85-
class MathicsCompleter(WordCompleter):
86+
class Mathics3Completer(WordCompleter):
8687
def __init__(self, definitions):
8788
self.definitions = definitions
8889
self.completer = WordCompleter([])
89-
self.named_characters = sorted(named_characters.keys())
90+
self.named_characters = sorted(NAMED_CHARACTERS["named-characters"].keys())
9091

9192
# From WordCompleter, adjusted with default values
9293
self.ignore_case = True

mathicsscript/data/inputrc-no-unicode

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# GNU Readline input unicode translations
2-
# Autogenerated from mathics_scanner.generate.rl_inputrc on Wed Feb 12 11:52:14 AM EST 2025
2+
# Autogenerated from mathics_scanner.generate.rl_inputrc on Sun Mar 1 03:40:19 PM EST 2026
33

44
"\ea'\e": "á"
55
"\ea-\e": "ā"
@@ -8,9 +8,9 @@
88
"\eae\e": "æ"
99
"\ea`\e": "à"
1010
"\ea^\e": "â"
11-
"\eal\e": "ℵ"
1211
"\eao\e": "å"
1312
"\ea~\e": "ã"
13+
"\eal\e": "ℵ"
1414
"\eesc\e": "\\[AliasIndicator]"
1515
"\eam\e": "\\[AlignmentMarker]"
1616
"\ea\e": "α"
@@ -146,7 +146,7 @@
146146
"\ediffd\e": "∆"
147147
"\edd\e": "𝑑"
148148
"\edi\e": "ϝ"
149-
"\ede\e": ""
149+
"\ede\e": ""
150150
"\edratio\e": "ϴ"
151151
"\eshift\e": "\\[DiscreteShift]"
152152
"\edhy\e": "\\[DiscretionaryHyphen]"
@@ -597,7 +597,7 @@
597597
"\e]\e": "\\[RightModified]"
598598
"\erT\e": "⊢"
599599
"\evec\e": "⇀"
600-
"\e->\e": ""
600+
"\e->\e": ""
601601
"\e:>\e": "⧴"
602602
"\esv\e": "š"
603603
"\esz\e": "ß"

mathicsscript/data/inputrc-unicode

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# GNU Readline input unicode translations
2-
# Autogenerated from mathics_scanner.generate.rl_inputrc on Wed Feb 12 11:52:14 AM EST 2025
2+
# Autogenerated from mathics_scanner.generate.rl_inputrc on Sun Mar 1 03:40:18 PM EST 2026
33

44
"\ea'\e": "á"
55
"\ea-\e": "ā"
@@ -8,9 +8,9 @@
88
"\eae\e": "æ"
99
"\ea`\e": "à"
1010
"\ea^\e": "â"
11-
"\eal\e": "ℵ"
1211
"\eao\e": "å"
1312
"\ea~\e": "ã"
13+
"\eal\e": "ℵ"
1414
"\eesc\e": "\\[AliasIndicator]"
1515
"\eam\e": "\\[AlignmentMarker]"
1616
"\ea\e": "α"
@@ -146,7 +146,7 @@
146146
"\ediffd\e": "∆"
147147
"\edd\e": "𝑑"
148148
"\edi\e": "ϝ"
149-
"\ede\e": ""
149+
"\ede\e": ""
150150
"\edratio\e": "ϴ"
151151
"\eshift\e": "\\[DiscreteShift]"
152152
"\edhy\e": "\\[DiscretionaryHyphen]"
@@ -597,7 +597,7 @@
597597
"\e]\e": "\\[RightModified]"
598598
"\erT\e": "⊢"
599599
"\evec\e": "⇀"
600-
"\e->\e": ""
600+
"\e->\e": ""
601601
"\e:>\e": "⧴"
602602
"\esv\e": "š"
603603
"\esz\e": "ß"

0 commit comments

Comments
 (0)