phyx 1.7.1__tar.gz → 1.7.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {phyx-1.7.1/phyx.egg-info → phyx-1.7.2}/PKG-INFO +2 -2
- {phyx-1.7.1 → phyx-1.7.2}/README.md +1 -1
- {phyx-1.7.1 → phyx-1.7.2}/docs/cookbook.md +1 -1
- {phyx-1.7.1 → phyx-1.7.2}/docs/guide.md +1 -1
- {phyx-1.7.1 → phyx-1.7.2}/docs/index.md +1 -1
- {phyx-1.7.1 → phyx-1.7.2}/docs/rationale.md +2 -2
- {phyx-1.7.1 → phyx-1.7.2}/docs/reference.md +1 -1
- {phyx-1.7.1 → phyx-1.7.2}/docs/releasing.md +12 -0
- {phyx-1.7.1 → phyx-1.7.2}/docs/roadmap.md +2 -3
- {phyx-1.7.1 → phyx-1.7.2}/docs/toolchain.md +21 -2
- {phyx-1.7.1 → phyx-1.7.2}/editors/README.md +6 -6
- {phyx-1.7.1 → phyx-1.7.2}/editors/package.json +1 -1
- {phyx-1.7.1 → phyx-1.7.2}/phyx/cli.py +55 -19
- {phyx-1.7.1 → phyx-1.7.2}/phyx/compiler.py +74 -13
- {phyx-1.7.1 → phyx-1.7.2}/phyx/fonts.py +115 -18
- {phyx-1.7.1 → phyx-1.7.2}/phyx/lint.py +10 -4
- {phyx-1.7.1 → phyx-1.7.2}/phyx/lsp.py +3 -2
- {phyx-1.7.1 → phyx-1.7.2}/phyx/parser.py +39 -7
- {phyx-1.7.1 → phyx-1.7.2}/phyx/repl.py +10 -10
- {phyx-1.7.1 → phyx-1.7.2/phyx.egg-info}/PKG-INFO +2 -2
- {phyx-1.7.1 → phyx-1.7.2}/phyx.egg-info/SOURCES.txt +2 -0
- {phyx-1.7.1 → phyx-1.7.2}/pyproject.toml +1 -1
- phyx-1.7.2/tests/test_fetch.py +340 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_host_faults.py +218 -30
- phyx-1.7.2/tests/test_lint_imported.py +203 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_parity_fuzz.py +369 -16
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_repl.py +77 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_tools.py +4 -4
- {phyx-1.7.1 → phyx-1.7.2}/LICENSE +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/MANIFEST.in +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/docs/python.md +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/docs/spec.md +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/docs/stdlib.md +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/docs/tour.md +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/editors/ftdetect/phyx.vim +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/editors/language-configuration.json +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/editors/phyx.tmLanguage.json +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/editors/syntax/phyx.vim +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/01_welcome.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/02_compleation.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/03_abilities.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/04_herd.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/05_mistakes.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/06_ask.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/07_ascii.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/08_vertical.vphyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/09_sieve.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/10_command.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/11_machine.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/12_sort.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/13_notes.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/14_compleat.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/15_conjugation.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/lib_as/311/231r/316/270.phyx" +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/examples/lib_/305/245ewn.phyx" +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/__init__.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/__main__.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/ast.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/builtins.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/conjugation.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/errors.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/fmt.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/hints.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/interpreter.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/lexer.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/lib/as/311/231r/316/270.phyx" +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/lib/compleat.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/lib//305/245ewn.phyx" +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/limits.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/numerals.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/paths.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/render.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/scaffold.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/testing.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/values.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/vertical.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx/vocabulary.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx.egg-info/dependency_links.txt +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx.egg-info/entry_points.txt +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx.egg-info/requires.txt +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/phyx.egg-info/top_level.txt +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/setup.cfg +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/phyx/test_as/311/231r/316/270.phyx" +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/phyx/test_compleat.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/phyx/test_conjugation.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/phyx/test_core_ability.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/phyx/test_core_list.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/phyx/test_core_loop.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/phyx/test_core_must.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/phyx/test_speak.phyx +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/phyx/test_/305/245ewn.phyx" +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_conjugation.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_docs.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_dx.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_engine_parity.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_interpreter.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_lexer.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_lsp.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_machine.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_new.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_parser.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_spec_verbs.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_stdlib.py +0 -0
- {phyx-1.7.1 → phyx-1.7.2}/tests/test_versions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: phyx
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.2
|
|
4
4
|
Summary: φyrx (PhyrxScript / PhyrexianScript) — a programming language written in Phyrexian
|
|
5
5
|
Author: Brage
|
|
6
6
|
License-Expression: MIT
|
|
@@ -40,7 +40,7 @@ Dynamic: license-file
|
|
|
40
40
|
|
|
41
41
|
φyrx is a programming language written in Phyrexian. Its orthography, vocabulary, and grammar are not invented: they come from the community [Phyrexian Dictionary](https://fxbuson.github.io/PhyrexianDictionary/) (tutorial chapters 1–3). A program is a sequence of Phyrexian sentences. The verb comes last. Numbers are hexadecimal. Text is read in vertical columns.
|
|
42
42
|
|
|
43
|
-
The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The
|
|
43
|
+
The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The Phyrexian Regular font belongs to Wizards of the Coast and is used under their [Fan Content Policy](https://company.wizards.com/en/legal/fancontentpolicy); Basilica is by GuruJ (CC-BY 4.0); the optional dictionary JSON comes from the [PhyrexianDictionary](https://github.com/fxbuson/PhyrexianDictionary) repository, whose LICENSE file is GPL-3.0. None of them is bundled: `python -m phyx fetch` downloads them. Details are in [docs/toolchain.md](docs/toolchain.md#fonts-and-licences). Source: [github.com/Brage1025/phyrexianscript](https://github.com/Brage1025/phyrexianscript).
|
|
44
44
|
|
|
45
45
|
```
|
|
46
46
|
python -m phyx examples/01_welcome.phyx
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
φyrx is a programming language written in Phyrexian. Its orthography, vocabulary, and grammar are not invented: they come from the community [Phyrexian Dictionary](https://fxbuson.github.io/PhyrexianDictionary/) (tutorial chapters 1–3). A program is a sequence of Phyrexian sentences. The verb comes last. Numbers are hexadecimal. Text is read in vertical columns.
|
|
13
13
|
|
|
14
|
-
The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The
|
|
14
|
+
The toolchain is a small Python 3.11+ interpreter with no third-party dependencies. The language and interpreter are **MIT**. The Phyrexian Regular font belongs to Wizards of the Coast and is used under their [Fan Content Policy](https://company.wizards.com/en/legal/fancontentpolicy); Basilica is by GuruJ (CC-BY 4.0); the optional dictionary JSON comes from the [PhyrexianDictionary](https://github.com/fxbuson/PhyrexianDictionary) repository, whose LICENSE file is GPL-3.0. None of them is bundled: `python -m phyx fetch` downloads them. Details are in [docs/toolchain.md](docs/toolchain.md#fonts-and-licences). Source: [github.com/Brage1025/phyrexianscript](https://github.com/Brage1025/phyrexianscript).
|
|
15
15
|
|
|
16
16
|
```
|
|
17
17
|
python -m phyx examples/01_welcome.phyx
|
|
@@ -159,7 +159,7 @@ python -m phyx examples/10_command.phyx red blue
|
|
|
159
159
|
|
|
160
160
|
```
|
|
161
161
|
python -m phyx explain if # English → ba
|
|
162
|
-
python -m phyx lint FILE # dropped 'iţpənn, unused objects, English keywords, short calls in this file
|
|
162
|
+
python -m phyx lint FILE # dropped 'iţpənn, unused objects, English keywords, short calls in this file or brought in with bukð
|
|
163
163
|
python -m phyx --ascii FILE # Te is ťe, TTE'' is ţə''
|
|
164
164
|
```
|
|
165
165
|
|
|
@@ -95,7 +95,7 @@ The number-words `'ii` (1), `ķu` (2), `ķi` (3) are constants. There is no deci
|
|
|
95
95
|
|
|
96
96
|
A word is a **verb** if it is in the standard lexicon (`babg`, `ţə''`, `'uxq`, …) or a `ťe` name in this file (or in a file this file `bukð`s). Otherwise it is a **name**, and must already have been bound with `ţə''` when the sentence runs.
|
|
97
97
|
|
|
98
|
-
You may not bind a reserved word. `python -m phyx words` is the authoritative list; `python -m phyx explain if` maps English to the marker; `python -m phyx lookup add` searches the lexicon (no fetch required). `python -m phyx lint FILE` names a dropped `'iţpənn`, an unused object, an English keyword used as a name, and an ability defined in this file
|
|
98
|
+
You may not bind a reserved word. `python -m phyx words` is the authoritative list; `python -m phyx explain if` maps English to the marker; `python -m phyx lookup add` searches the lexicon (no fetch required). `python -m phyx lint FILE` names a dropped `'iţpənn`, an unused object, an English keyword used as a name, and an ability of arity 1 or more, defined in this file or brought in with `bukð`, written with fewer objects than it wants (quote it with `naķm` if you wanted the ability as a value).
|
|
99
99
|
|
|
100
100
|
```
|
|
101
101
|
^xe-5-x-ţə''. x = 5
|
|
@@ -22,7 +22,7 @@ Start here, then pick the page that matches the job.
|
|
|
22
22
|
|
|
23
23
|
The standard library is φyrx: `phyx/lib/` is on the `bukð` search path. `python -m phyx test` runs tests written in φyrx (`ǩaπa` is the assertion; a sibling `.expected` file is exact stdout). `python -m phyx lookup` searches the lexicon without a fetch.
|
|
24
24
|
|
|
25
|
-
Faults name the fix and the ability stack. `python -m phyx explain if` answers in Phyrexian. `fmt` rewrites a file into canonical separators and indent. `lint` names a dropped `'iţpənn`, an unused object, an English keyword used as a name, and a short call of an ability defined in the same file
|
|
25
|
+
Faults name the fix and the ability stack. `python -m phyx explain if` answers in Phyrexian. `fmt` rewrites a file into canonical separators and indent. `lint` names a dropped `'iţpənn`, an unused object, an English keyword used as a name, and a short call of an ability defined in the same file or brought in with `bukð`.
|
|
26
26
|
|
|
27
27
|
A program can bind names, close over them, store abilities, build lists and books, cast modules, read and write UTF-8 notes (`brøtjt` / `mɴyrx`), read program arguments, and run in the REPL. `render` sets the text in vertical columns in the official Phyrexian font.
|
|
28
28
|
|
|
@@ -53,9 +53,9 @@ A competent engineer who joined last week and has never read the compiler should
|
|
|
53
53
|
|
|
54
54
|
A language that cannot test itself in itself is a host API. `python -m phyx test` runs φyrx files; Python's `unittest` still covers the interpreter.
|
|
55
55
|
|
|
56
|
-
## MIT interpreter,
|
|
56
|
+
## MIT interpreter, separate font and dictionary
|
|
57
57
|
|
|
58
|
-
The language and toolchain are MIT so they can be used like Python.
|
|
58
|
+
The language and toolchain are MIT so they can be used like Python. Phyrexian Regular is Wizards of the Coast's font (© 2019 Wizards of the Coast, all rights reserved; made by Delve Fonts). It is not part of this project's licence and is not bundled. It is downloaded for the user and used under Wizards of the Coast's Fan Content Policy (https://company.wizards.com/en/legal/fancontentpolicy). Basilica by GuruJ, CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/). The dictionary JSON comes from the PhyrexianDictionary repository, whose LICENSE file is GPL-3.0. `phyx fetch` downloads that repository's `_data/PhyrexianAPI.json` from a pinned commit, checks its SHA-256, and saves it as `dictionary.json`. The font and the dictionary JSON are fetched, not vendored. Rendered HTML embeds the font as family `Phyrexian` (the TTF's family name).
|
|
59
59
|
|
|
60
60
|
## What will not be added
|
|
61
61
|
|
|
@@ -247,7 +247,7 @@ The language has unbounded integers, unbounded lists (`bɬølπ` grows a tape in
|
|
|
247
247
|
|
|
248
248
|
## Provenance
|
|
249
249
|
|
|
250
|
-
Phyrexian script, romanisation, grammar and lexicon: [fxbuson/PhyrexianDictionary](https://fxbuson.github.io/PhyrexianDictionary/), itself a compilation of the community reading of Wizards of the Coast’s Phyrexian.
|
|
250
|
+
Phyrexian script, romanisation, grammar and lexicon: [fxbuson/PhyrexianDictionary](https://fxbuson.github.io/PhyrexianDictionary/), itself a compilation of the community reading of Wizards of the Coast’s Phyrexian. Phyrexian Regular is Wizards of the Coast's font (© 2019 Wizards of the Coast, all rights reserved; made by Delve Fonts). It is not part of this project's licence and is not bundled. It is downloaded for the user and used under Wizards of the Coast's Fan Content Policy (https://company.wizards.com/en/legal/fancontentpolicy). The dictionary JSON comes from the PhyrexianDictionary repository, whose LICENSE file is GPL-3.0. `python -m phyx fetch` downloads that repository's `_data/PhyrexianAPI.json` from a pinned commit, checks its SHA-256, and saves it as `dictionary.json`; this toolchain does not vendor it. φyrx (PhyrxScript / PhyrexianScript) the language and interpreter are **MIT**.
|
|
251
251
|
|
|
252
252
|
Reserved words are dictionary entries. The mapping of mood markers onto statement forms, and of verbs onto operations, is the language design: it is consistent, but it is still a mapping.
|
|
253
253
|
|
|
@@ -107,3 +107,15 @@ Extension listings, version equal to `editors/package.json`:
|
|
|
107
107
|
|
|
108
108
|
- Visual Studio Marketplace: `https://marketplace.visualstudio.com/items?itemName=brage1025.phyx`
|
|
109
109
|
- Open VSX: `https://open-vsx.org/extension/brage1025/phyx`
|
|
110
|
+
|
|
111
|
+
## Updating the pinned fonts and dictionary
|
|
112
|
+
|
|
113
|
+
`editors/fonts.js` and `phyx/fonts.py` name the PhyrexianDictionary commits and the SHA-256 of each file `phyx fetch` downloads.
|
|
114
|
+
|
|
115
|
+
1. Find the new commit with `git ls-remote` (`refs/heads/main` for the fonts, `refs/heads/gh-pages` for the dictionary).
|
|
116
|
+
2. Download each file and compute its SHA-256.
|
|
117
|
+
3. Update `FONT_COMMIT` and the two font hashes in both `editors/fonts.js` and `phyx/fonts.py`. A test checks that they agree.
|
|
118
|
+
4. Update the dictionary commit and hash in `phyx/fonts.py`.
|
|
119
|
+
5. Run the tests.
|
|
120
|
+
6. Add a CHANGELOG line.
|
|
121
|
+
7. Release.
|
|
@@ -20,16 +20,15 @@ Nothing below is a promise, and nothing below adds a word or a form the Phyrexia
|
|
|
20
20
|
|
|
21
21
|
## Known issues
|
|
22
22
|
|
|
23
|
-
- **`'u` on a name already bound in the same ability.** The compiled engine and the tree-walker still disagree in a few cases. Pinned as expected failures `test_BUG_R_enclosing_loop_name_persistent`, `test_BUG_S_fix_in_handler_of_try_name`, and `test_BUG_T_second_fix_message` in [tests/test_parity_fuzz.py](../tests/test_parity_fuzz.py) (`BUG_R`, `BUG_S`, `BUG_T`). GitHub: [#1](https://github.com/Brage1025/phyrexianscript/issues/1)
|
|
24
|
-
- **`phyx lint` and abilities brought in with `bukð`.** A short call of an ability defined in the same file is a note. A short call of an ability brought in with `bukð` is not: `lint` collects arities from this file's `ťe` sentences only ([phyx/lint.py](../phyx/lint.py)). GitHub: [#2](https://github.com/Brage1025/phyrexianscript/issues/2)
|
|
25
23
|
- **Guarded arithmetic.** Compiled programs keep a kind guard on operators, so arithmetic-heavy code is slower than the same code in CPython. `python -m phyx bench` prints the ratio. On the defaults (`--size 16`, `--loops 20000`) the ratio is typically two to four times and varies by machine. A specialised fast path is a possible optimisation. It is unscheduled. Compiling ordering to raw Python `<` stays rejected: `1 == True` is not Phyrexian (1.4.1). GitHub: [#3](https://github.com/Brage1025/phyrexianscript/issues/3)
|
|
26
|
-
- **Ctrl-C and out-of-memory on CI.**
|
|
24
|
+
- **Ctrl-C and out-of-memory on CI.** Ctrl-C is tested on Linux, macOS, and Windows ([tests/test_host_faults.py](../tests/test_host_faults.py)). Windows starts the child in its own process group and sends `CTRL_BREAK_EVENT` (`SIGBREAK` raises `KeyboardInterrupt`); Linux and macOS send `SIGINT`. The out-of-memory fault is tested on Linux with `RLIMIT_AS` and on Windows with a Job Object process memory limit. It is still not tested on macOS, because macOS does not enforce `RLIMIT_AS` ([docs/toolchain.md](toolchain.md)). GitHub: [#4](https://github.com/Brage1025/phyrexianscript/issues/4)
|
|
27
25
|
|
|
28
26
|
## Planned work
|
|
29
27
|
|
|
30
28
|
Unscheduled. Taking an item up is a later decision.
|
|
31
29
|
|
|
32
30
|
- An optional `--safe` flag for running other people's programs. Today a program can read and write files, cast other files, and exit the process ([SECURITY.md](../SECURITY.md)).
|
|
31
|
+
- Editor diagnostics. `phyx.lsp.diagnostics_for` computes parse errors and lint notes but the language server does not publish them, and the extension's client ignores server notifications.
|
|
33
32
|
- Fixes for the known issues above, if one of them is taken up. The arithmetic fast path, if it is ever written, still has to keep Phyrexian kinds.
|
|
34
33
|
|
|
35
34
|
## Will not be added
|
|
@@ -120,7 +120,26 @@ python -m phyx render examples/09_sieve.phyx -o sieve.html
|
|
|
120
120
|
|
|
121
121
|
`render` writes a page in the official card font. The file is `Phyrexian-Regular.ttf`; its **family name is `Phyrexian`** (full name `Phyrexian Regular`). That is the name CSS and Windows use. `python -m phyx render` downloads and **embeds** a validated copy so the page cannot flash Latin fallbacks.
|
|
122
122
|
|
|
123
|
-
`python -m phyx fetch` also pulls **Basilica** (native hexadecimal glyphs, CC-BY)
|
|
123
|
+
`python -m phyx fetch` also pulls **Basilica** (native hexadecimal glyphs). Basilica by GuruJ, CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/). On Windows it installs both fonts into the current user’s font folder so editors can select **Phyrexian**. The editor extension installs those same fonts on its own, from a pinned commit, and does not run `phyx fetch`. The lexer already reads those Mathematical Monospace digits as the same hex as `0–9a–f`. In a source checkout, fetched fonts and the dictionary live in `assets/` (gitignored). An installed phyx keeps them in a per-user data folder: `%LOCALAPPDATA%\phyx` on Windows, `~/Library/Application Support/phyx` on macOS, and `$XDG_DATA_HOME/phyx` or `~/.local/share/phyx` elsewhere. `PHYX_ASSETS` overrides that directory. When that per-user folder has no fonts yet, a valid font file still next to the installed package is read from there. A download is written to that per-user folder.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Fonts and licences
|
|
128
|
+
|
|
129
|
+
Phyrexian Regular is Wizards of the Coast's font (© 2019 Wizards of the Coast, all rights reserved; made by Delve Fonts). It is not part of this project's licence and is not bundled. It is downloaded for the user and used under Wizards of the Coast's Fan Content Policy (https://company.wizards.com/en/legal/fancontentpolicy). Basilica by GuruJ, CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/).
|
|
130
|
+
|
|
131
|
+
The six fonts below are the faces in the PhyrexianDictionary repository. The licence column is what the font file itself states.
|
|
132
|
+
|
|
133
|
+
| Font | Maker | Licence stated in the file | Used | Why |
|
|
134
|
+
| --- | --- | --- | --- | --- |
|
|
135
|
+
| `Phyrexian-Regular.ttf` | Wizards of the Coast; manufactured by Delve Fonts LLC | None. Copyright © 2019 by Wizards of the Coast, a Hasbro Subsidiary. All rights reserved. | Yes | Card font (family name `Phyrexian`) for `render` and the editor. |
|
|
136
|
+
| `Basilica.otf` | GuruJ (2023) | CC-BY (https://creativecommons.org/licenses/by/4.0/). Derived from Progress Engine and remapped to the official Wizards transliteration. | Yes | Native hexadecimal glyphs. |
|
|
137
|
+
| `Phi_horizontal_gbrsh_9.8.ttf` | Phie (Stas.tk), 2022 | SIL Open Font License 1.1 | No | Missing glyphs for `! : ; ^ ' " ( ) * = < > ? @ #`. |
|
|
138
|
+
| `PhyrexianCompleat.ttf` | Osmago, built with FontStruct | "Open Font License", no version stated | No | No digits and little punctuation, and the licence names no version. |
|
|
139
|
+
| `Phyrexian_Engraved.otf` | Aldurethar | SIL Open Font License (OFL), no version stated | No | Lacks many lowercase letters, and the licence names no version. |
|
|
140
|
+
| `ProgressEngine.otf` | GuruJ, 2020 | None stated | No | No licence is stated. Basilica is derived from this face. |
|
|
141
|
+
|
|
142
|
+
Phi_horizontal, Phyrexian Compleat, Phyrexian Engraved and ProgressEngine are not offered because their glyph coverage or licence statement is not good enough for source code. Fonts are downloaded at a pinned commit with a SHA-256 check rather than bundled: the editor fetches Phyrexian Regular and Basilica from PhyrexianDictionary commit `f3ea2bd41c433976493862325d91435dc3522cc3` and checks each file's SHA-256. `python -m phyx fetch` downloads the fonts and the dictionary from pinned commits and checks each file's SHA-256. The dictionary is saved as `dictionary.json`. `python -m phyx lookup` searches that file when it is present.
|
|
124
143
|
|
|
125
144
|
---
|
|
126
145
|
|
|
@@ -170,7 +189,7 @@ run_source('!"šdeχd".', argv=["ignored-by-this-program"])
|
|
|
170
189
|
|
|
171
190
|
## CI and the index
|
|
172
191
|
|
|
173
|
-
GitHub Actions (`.github/workflows/ci.yml`) runs on pull requests and on pushes to `main` only. It runs `python -m unittest discover -s tests -v` and `python -m phyx test` on Ubuntu, Windows, and macOS for Python 3.11 and 3.13, and on Ubuntu for 3.12 and 3.14. Ubuntu 3.11 and 3.14 also run that suite with `PHYX_TREEWALK=1`. Ubuntu 3.13 writes a coverage report and does not set a minimum. Other jobs run `ruff check .`, `PHYX_FUZZ=3000` on `tests.test_parity_fuzz`, and `python -m build` / `twine check`, then install the wheel and the sdist outside the checkout. The extension job runs `node editors/check.js` and `node --test "editors/*.test.js"`. The last job is `ci-passed`. The out-of-memory fault is tested on Linux
|
|
192
|
+
GitHub Actions (`.github/workflows/ci.yml`) runs on pull requests and on pushes to `main` only. It runs `python -m unittest discover -s tests -v` and `python -m phyx test` on Ubuntu, Windows, and macOS for Python 3.11 and 3.13, and on Ubuntu for 3.12 and 3.14. Ubuntu 3.11 and 3.14 also run that suite with `PHYX_TREEWALK=1`. Ubuntu 3.13 writes a coverage report and does not set a minimum. Other jobs run `ruff check .`, `PHYX_FUZZ=3000` on `tests.test_parity_fuzz`, and `python -m build` / `twine check`, then install the wheel and the sdist outside the checkout. The extension job runs `node editors/check.js` and `node --test "editors/*.test.js"`. The last job is `ci-passed`. Ctrl-C is tested on Linux, macOS, and Windows. The out-of-memory fault is tested on Linux with `RLIMIT_AS` and on Windows with a Job Object process memory limit. It is still not tested on macOS, because macOS does not enforce `RLIMIT_AS`.
|
|
174
193
|
|
|
175
194
|
`pip install phyx` installs the latest release from the Python Package Index ([PyPI badge](https://img.shields.io/pypi/v/phyx), [project page](https://pypi.org/project/phyx/)). A GitHub Release retriggers `.github/workflows/publish.yml` (trusted publishing). `brage1025.phyx` is on the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=brage1025.phyx) and [Open VSX](https://open-vsx.org/extension/brage1025/phyx) (Cursor’s in-editor marketplace). `.github/workflows/publish-extension.yml` packages `editors/` and publishes with `vsce publish --oidc` and `ovsx publish --trusted-publishing`. Both publish workflows run CI first. An extension publish step is skipped when the registry already has the same version. After Eclipse grants namespace ownership ([claim](https://github.com/EclipseFdn/open-vsx.org/issues/14213)), Open VSX Settings → Trusted Publishers: GitHub user `Brage1025`, repo `phyrexianscript`, workflow `publish-extension.yml`.
|
|
176
195
|
|
|
@@ -20,18 +20,18 @@ Or copy the folder into the editor’s extensions directory (restart the editor
|
|
|
20
20
|
|
|
21
21
|
```
|
|
22
22
|
# Cursor, Windows
|
|
23
|
-
xcopy /E /I editors %USERPROFILE%\.cursor\extensions\brage1025.phyx-1.8.
|
|
23
|
+
xcopy /E /I editors %USERPROFILE%\.cursor\extensions\brage1025.phyx-1.8.1
|
|
24
24
|
|
|
25
25
|
# VS Code, Windows
|
|
26
|
-
xcopy /E /I editors %USERPROFILE%\.vscode\extensions\brage1025.phyx-1.8.
|
|
26
|
+
xcopy /E /I editors %USERPROFILE%\.vscode\extensions\brage1025.phyx-1.8.1
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
```
|
|
30
30
|
# Cursor, macOS / Linux
|
|
31
|
-
cp -R editors ~/.cursor/extensions/brage1025.phyx-1.8.
|
|
31
|
+
cp -R editors ~/.cursor/extensions/brage1025.phyx-1.8.1
|
|
32
32
|
|
|
33
33
|
# VS Code, macOS / Linux
|
|
34
|
-
cp -R editors ~/.vscode/extensions/brage1025.phyx-1.8.
|
|
34
|
+
cp -R editors ~/.vscode/extensions/brage1025.phyx-1.8.1
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
A VSIX, if you have Node:
|
|
@@ -40,7 +40,7 @@ A VSIX, if you have Node:
|
|
|
40
40
|
npx --yes @vscode/vsce package --no-dependencies
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
That writes `phyx-1.8.
|
|
43
|
+
That writes `phyx-1.8.1.vsix` in `editors/`. Then **Install from VSIX…**.
|
|
44
44
|
|
|
45
45
|
`.phyx` and `.vphyx` are associated with language id `phyx` (scope `source.phyx`).
|
|
46
46
|
|
|
@@ -76,7 +76,7 @@ The first time a φyrx file is open, if Phyrexian Regular is not already install
|
|
|
76
76
|
|
|
77
77
|
The extension turns off VS Code's non-ASCII and ambiguous-character highlighting for φyrx files only, so Restricted Mode does not box every character. Invisible characters are still flagged.
|
|
78
78
|
|
|
79
|
-
Phyrexian Regular is
|
|
79
|
+
Phyrexian Regular is Wizards of the Coast's font (© 2019 Wizards of the Coast, all rights reserved; made by Delve Fonts). It is not part of this project's licence and is not bundled. It is downloaded for the user and used under Wizards of the Coast's Fan Content Policy (https://company.wizards.com/en/legal/fancontentpolicy). Basilica by GuruJ, CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/).
|
|
80
80
|
|
|
81
81
|
φyrx is unofficial Fan Content permitted under the Fan Content Policy. Not approved/endorsed by Wizards. Portions of the materials used are property of Wizards of the Coast. ©Wizards of the Coast LLC.
|
|
82
82
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "phyx",
|
|
3
3
|
"displayName": "φyrx",
|
|
4
4
|
"description": "φyrx (PhyrxScript / PhyrexianScript) — a programming language written in Phyrexian",
|
|
5
|
-
"version": "1.8.
|
|
5
|
+
"version": "1.8.1",
|
|
6
6
|
"publisher": "brage1025",
|
|
7
7
|
"icon": "phyx-original.png",
|
|
8
8
|
"license": "MIT",
|
|
@@ -13,7 +13,6 @@ import argparse
|
|
|
13
13
|
import io
|
|
14
14
|
import json
|
|
15
15
|
import sys
|
|
16
|
-
import urllib.request
|
|
17
16
|
from collections.abc import Iterable
|
|
18
17
|
from pathlib import Path
|
|
19
18
|
|
|
@@ -23,13 +22,24 @@ from .compiler import compile_to_python
|
|
|
23
22
|
from .errors import PhyrexianError, format_error
|
|
24
23
|
from .fmt import format_source
|
|
25
24
|
from .fonts import (
|
|
25
|
+
BASILICA_CDN,
|
|
26
|
+
BASILICA_REMOTE,
|
|
27
|
+
BASILICA_SHA256,
|
|
28
|
+
DICT_CDN,
|
|
29
|
+
DICT_REMOTE,
|
|
30
|
+
DICT_SHA256,
|
|
31
|
+
FONT_CDN,
|
|
26
32
|
FONT_FAMILY,
|
|
33
|
+
FONT_REMOTE,
|
|
34
|
+
PHYREXIAN_SHA256,
|
|
27
35
|
assets_dir,
|
|
28
|
-
ensure_basilica,
|
|
29
36
|
ensure_font,
|
|
37
|
+
ensure_pinned,
|
|
30
38
|
install_user_font,
|
|
31
39
|
is_font_file,
|
|
40
|
+
local_basilica,
|
|
32
41
|
local_font,
|
|
42
|
+
matches_pin,
|
|
33
43
|
)
|
|
34
44
|
from .hints import explain_missing, explain_word, search_lexicon
|
|
35
45
|
from .interpreter import Interpreter
|
|
@@ -68,7 +78,6 @@ SUBCOMMANDS = {
|
|
|
68
78
|
"lsp",
|
|
69
79
|
}
|
|
70
80
|
|
|
71
|
-
DICT_REMOTE = "https://raw.githubusercontent.com/fxbuson/PhyrexianDictionary/gh-pages/_data/PhyrexianAPI.json"
|
|
72
81
|
VERTICAL_EXT = ".vphyx"
|
|
73
82
|
|
|
74
83
|
|
|
@@ -184,12 +193,14 @@ def cmd_fmt(args: argparse.Namespace) -> int:
|
|
|
184
193
|
|
|
185
194
|
def cmd_lint(args: argparse.Namespace) -> int:
|
|
186
195
|
source = load_source(args.file, args.ascii, args.vertical)
|
|
196
|
+
root = Path(args.file).resolve().parent
|
|
187
197
|
try:
|
|
188
|
-
|
|
198
|
+
brought: dict[str, int] = {}
|
|
199
|
+
program = parse(source, base_dir=root, imported=brought)
|
|
189
200
|
except PhyrexianError as err:
|
|
190
201
|
print(format_error(err, source), file=sys.stderr)
|
|
191
202
|
return 1
|
|
192
|
-
notes = lint_program(program)
|
|
203
|
+
notes = lint_program(program, imported=brought)
|
|
193
204
|
if not notes:
|
|
194
205
|
print(f"{args.file}: no notes")
|
|
195
206
|
return 0
|
|
@@ -248,25 +259,50 @@ def cmd_translit(args: argparse.Namespace) -> int:
|
|
|
248
259
|
return 0
|
|
249
260
|
|
|
250
261
|
|
|
262
|
+
def _fetch_pinned(heading: str, dest: Path, urls: list[str], sha256: str, *, require_font: bool) -> Path:
|
|
263
|
+
print(heading)
|
|
264
|
+
already = matches_pin(dest, sha256)
|
|
265
|
+
path = ensure_pinned(dest, urls, sha256, require_font=require_font)
|
|
266
|
+
if already:
|
|
267
|
+
print(" already up to date")
|
|
268
|
+
print(f" -> {path}")
|
|
269
|
+
return path
|
|
270
|
+
|
|
271
|
+
|
|
251
272
|
def cmd_fetch(args: argparse.Namespace) -> int:
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
273
|
+
try:
|
|
274
|
+
font = _fetch_pinned(
|
|
275
|
+
"fetching Phyrexian Regular (official card font, family name: Phyrexian)",
|
|
276
|
+
local_font(),
|
|
277
|
+
[FONT_CDN, FONT_REMOTE],
|
|
278
|
+
PHYREXIAN_SHA256,
|
|
279
|
+
require_font=True,
|
|
280
|
+
)
|
|
281
|
+
basilica = _fetch_pinned(
|
|
282
|
+
"fetching Basilica (native hexadecimal glyphs)",
|
|
283
|
+
local_basilica(),
|
|
284
|
+
[BASILICA_CDN, BASILICA_REMOTE],
|
|
285
|
+
BASILICA_SHA256,
|
|
286
|
+
require_font=True,
|
|
287
|
+
)
|
|
288
|
+
_fetch_pinned(
|
|
289
|
+
f"fetching {DICT_REMOTE}",
|
|
290
|
+
local_dictionary(),
|
|
291
|
+
[DICT_REMOTE, DICT_CDN],
|
|
292
|
+
DICT_SHA256,
|
|
293
|
+
require_font=False,
|
|
294
|
+
)
|
|
295
|
+
except OSError as err:
|
|
296
|
+
print(f"error: {err}", file=sys.stderr)
|
|
297
|
+
return 1
|
|
265
298
|
for path, family in ((font, FONT_FAMILY), (basilica, "Basilica")):
|
|
266
299
|
installed = install_user_font(path, family)
|
|
267
300
|
if installed:
|
|
268
301
|
print(f"installed {family} for this user: {installed}")
|
|
269
|
-
print(
|
|
302
|
+
print(
|
|
303
|
+
"done. Phyrexian Regular is Wizards of the Coast's font, "
|
|
304
|
+
"used under the Fan Content Policy; Basilica is by GuruJ, CC-BY 4.0."
|
|
305
|
+
)
|
|
270
306
|
return 0
|
|
271
307
|
|
|
272
308
|
|
|
@@ -338,6 +338,23 @@ def _fix_here(consts, seen, name, value, const, line):
|
|
|
338
338
|
return value
|
|
339
339
|
|
|
340
340
|
|
|
341
|
+
# 'u fixes a name in the scope that is running. It does not walk outward,
|
|
342
|
+
# so it may shadow an outer name. A loop item, a plain assignment, or an
|
|
343
|
+
# earlier 'u in that scope is already a value here and cannot be fixed.
|
|
344
|
+
# A read before the 'u still sees an outer binding when this scope has none.
|
|
345
|
+
def _running_already(locs, name, line):
|
|
346
|
+
if locs is not None and name in locs:
|
|
347
|
+
raise RuntimeFault(
|
|
348
|
+
f"'{name}' already has a value here and cannot be fixed in the past ('u)",
|
|
349
|
+
line,
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
def _fix_running(locs, consts, seen, name, value, line):
|
|
354
|
+
_running_already(locs, name, line)
|
|
355
|
+
return _fix_here(consts, seen, name, value, True, line)
|
|
356
|
+
|
|
357
|
+
|
|
341
358
|
def _load_dyn(locs, boxes, gvars, name, line):
|
|
342
359
|
"""Read a name that may be local, outer, or not bound yet."""
|
|
343
360
|
if locs is not None and name in locs:
|
|
@@ -359,7 +376,14 @@ def _store_dyn(locs, boxes, gvars, consts, k, name, value, const, line):
|
|
|
359
376
|
|
|
360
377
|
``locs`` is this ability's own bindings. ``boxes`` are enclosing
|
|
361
378
|
bindings, nearest first. ``gvars`` is the persistent module environment.
|
|
379
|
+
A ``'u`` does not walk outward; it only looks at ``locs``.
|
|
362
380
|
"""
|
|
381
|
+
if const and locs is not None:
|
|
382
|
+
_running_already(locs, name, line)
|
|
383
|
+
if k is not None:
|
|
384
|
+
k.add(name)
|
|
385
|
+
locs[name] = value
|
|
386
|
+
return value
|
|
363
387
|
if locs is not None and name in locs:
|
|
364
388
|
if const or (k is not None and name in k):
|
|
365
389
|
if const:
|
|
@@ -446,6 +470,7 @@ _NS_NAMES = {
|
|
|
446
470
|
"_load_dyn": _load_dyn,
|
|
447
471
|
"_store_dyn": _store_dyn,
|
|
448
472
|
"_fix_here": _fix_here,
|
|
473
|
+
"_fix_running": _fix_running,
|
|
449
474
|
"Ability": Ability,
|
|
450
475
|
"truthy": truthy,
|
|
451
476
|
"to_text": to_text,
|
|
@@ -737,10 +762,15 @@ class Emitter:
|
|
|
737
762
|
scope.needs_rt = True
|
|
738
763
|
return
|
|
739
764
|
if self.persist and found.kind == "func" and name in found.locals_:
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
765
|
+
# A plain binding of that ability lives in its locs dict, and
|
|
766
|
+
# the nested store walks that dict. A 'u constant is kept
|
|
767
|
+
# beside it, in the constant set. Capturing the constant puts
|
|
768
|
+
# the value on that walk, so the constant set can reject it.
|
|
769
|
+
if name not in found.const_names:
|
|
770
|
+
scope.dyn.add(name)
|
|
771
|
+
scope.needs_locs = True
|
|
772
|
+
scope.needs_rt = True
|
|
773
|
+
return
|
|
744
774
|
# The outer assignment may not have run yet. Remember the name so
|
|
745
775
|
# the store can rebind it when it exists, and create a local when
|
|
746
776
|
# it does not.
|
|
@@ -888,6 +918,17 @@ class Emitter:
|
|
|
888
918
|
def _outer_dynamic(self, name: str, scope: Scope, found: Scope | None) -> bool:
|
|
889
919
|
if name in scope.dyn:
|
|
890
920
|
return True
|
|
921
|
+
# A plain local of an enclosing ability lives in that ability's locs
|
|
922
|
+
# dict when a persistent module sentence binds the same name: the
|
|
923
|
+
# store may rebind the module, or create the local if that sentence
|
|
924
|
+
# has not run. find() skips the dict and lands on the module, so a
|
|
925
|
+
# nested read would miss the local the tree-walker walks to.
|
|
926
|
+
if found is not scope:
|
|
927
|
+
s = scope.parent
|
|
928
|
+
while s is not None and s is not found:
|
|
929
|
+
if name in s.dyn:
|
|
930
|
+
return True
|
|
931
|
+
s = s.parent
|
|
891
932
|
if found is None or found is scope:
|
|
892
933
|
return False
|
|
893
934
|
if name in found.params or name in found.funs:
|
|
@@ -1345,7 +1386,11 @@ class Emitter:
|
|
|
1345
1386
|
return tmp
|
|
1346
1387
|
|
|
1347
1388
|
def _load_late(self, name: str, late: Scope, line: int) -> str:
|
|
1348
|
-
"""Read a ``'u`` local, or the binding outside it when ``'u`` has not run.
|
|
1389
|
+
"""Read a ``'u`` local, or the binding outside it when ``'u`` has not run.
|
|
1390
|
+
|
|
1391
|
+
A name already stored in this scope is that binding. The outer name
|
|
1392
|
+
is read only when this scope does not hold it yet.
|
|
1393
|
+
"""
|
|
1349
1394
|
tmp = self.tmp()
|
|
1350
1395
|
slot = late.late_slot[name]
|
|
1351
1396
|
self.emit("try:")
|
|
@@ -1354,16 +1399,29 @@ class Emitter:
|
|
|
1354
1399
|
self.indent -= 1
|
|
1355
1400
|
self.emit("except NameError:")
|
|
1356
1401
|
self.indent += 1
|
|
1402
|
+
if late.locs_name:
|
|
1403
|
+
self.emit(f"if {name!r} in {late.locs_name}:")
|
|
1404
|
+
self.indent += 1
|
|
1405
|
+
self.emit(f"{tmp} = {late.locs_name}[{name!r}]")
|
|
1406
|
+
self.indent -= 1
|
|
1407
|
+
self.emit("else:")
|
|
1408
|
+
self.indent += 1
|
|
1409
|
+
self._load_late_outer(name, late, line, tmp)
|
|
1410
|
+
self.indent -= 1
|
|
1411
|
+
else:
|
|
1412
|
+
self._load_late_outer(name, late, line, tmp)
|
|
1413
|
+
self.indent -= 1
|
|
1414
|
+
return tmp
|
|
1415
|
+
|
|
1416
|
+
def _load_late_outer(self, name: str, late: Scope, line: int, tmp: str) -> None:
|
|
1357
1417
|
outer = late.parent
|
|
1358
1418
|
if outer is None: # pragma: no cover - 'u shadows something outside this scope
|
|
1359
1419
|
hint = hint_for_unknown(name)
|
|
1360
1420
|
self.emit(f"raise RuntimeFault({f'unknown word {name!r}'!r}, {line}, hint={hint!r})")
|
|
1361
1421
|
self.emit(f"{tmp} = None")
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
self.indent -= 1
|
|
1366
|
-
return tmp
|
|
1422
|
+
return
|
|
1423
|
+
loaded = self.load(name, outer, line)
|
|
1424
|
+
self.emit(f"{tmp} = {loaded}")
|
|
1367
1425
|
|
|
1368
1426
|
def _late_plain_scopes(self, scope: Scope, name: str) -> list[Scope]:
|
|
1369
1427
|
"""``'u`` slots a plain assignment must see, nearest first.
|
|
@@ -1385,7 +1443,8 @@ class Emitter:
|
|
|
1385
1443
|
def _store_own_late(self, name: str, val: str, scope: Scope, line: int) -> str:
|
|
1386
1444
|
"""``'u`` in the ability that owns the slot. It does not walk outward."""
|
|
1387
1445
|
slot = scope.late_slot[name]
|
|
1388
|
-
|
|
1446
|
+
locs = scope.locs_name or "None"
|
|
1447
|
+
rhs = f"_fix_running({locs}, {scope.const_set}, {scope.seen_set}, {name!r}, {val}, {line})"
|
|
1389
1448
|
self.emit(f"{slot} = {rhs}")
|
|
1390
1449
|
return slot
|
|
1391
1450
|
|
|
@@ -1579,6 +1638,10 @@ class Emitter:
|
|
|
1579
1638
|
already = f"'{name}' already has a value here and cannot be fixed in the past ('u)"
|
|
1580
1639
|
self.emit(f"raise RuntimeFault({already!r}, {line})")
|
|
1581
1640
|
return "None"
|
|
1641
|
+
# A dynamic name shares one cell with its read. 'u of that name
|
|
1642
|
+
# still fixes a local of this scope when the cell does not hold it.
|
|
1643
|
+
if self._outer_dynamic(name, scope, found) and (not const or scope.locs_name):
|
|
1644
|
+
return self._dyn_store(scope, name, val, const, line)
|
|
1582
1645
|
if (
|
|
1583
1646
|
scope.kind == "func"
|
|
1584
1647
|
and name in scope.const_names
|
|
@@ -1587,8 +1650,6 @@ class Emitter:
|
|
|
1587
1650
|
and name not in scope.funs
|
|
1588
1651
|
):
|
|
1589
1652
|
return self._store_local_const(name, val, scope, const, line)
|
|
1590
|
-
if self._outer_dynamic(name, scope, found):
|
|
1591
|
-
return self._dyn_store(scope, name, val, const, line)
|
|
1592
1653
|
if scope.kind == "module" and self.persist and name not in scope.funs:
|
|
1593
1654
|
if const:
|
|
1594
1655
|
rhs = f"_rt.fix({name!r}, {val}, {line})"
|