Klammerset: the @@@klammerset construct, its search path, and const correctness

The @@@klammerset system command formally declares a klammerset — a
named, logically related group of klammer definitions — with an
operative, idempotent declaration (:requires and :files load in order
at the declaration point, relative to the declaring file). A bare
symbol given to ktext -k, kdesc --input, or :requires resolves to
x/x.k on the search path: the document's directory, then
KLAMMERTEXT_KLAMMERSETS, then KLAMMERTEXT_HOME; kdesc --klammerset
lists the available sets. sks/sks.k is the first declared klammerset,
so `-k sks` loads the SKS by name. The engine's lookup classes were
renamed *_set → *_registry to keep the two concepts apart, and the
whole C++ tree now follows standard const-correctness conventions.
tst/ gains klammerset_test.sh (18 cases).

(from dev 64b1abf23e56)
This commit is contained in:
2026-07-30 23:50:07 +02:00
parent c42981f7e2
commit ef77f03584
83 changed files with 1429 additions and 594 deletions

View File

@@ -151,6 +151,35 @@ in the package folder (its name is shown at **Preferences → Settings** under
`color_scheme`), choosing a light or dark source file to match the ground. The
exact values are in each file's header comment.
## Sublime Merge
Sublime Merge reads the same `Packages` directory as Sublime Text, so the
package installed above needs no separate installation: `.kt` and `.k` files
are syntax-highlighted in Merge's diffs, and an edit to the syntax file is
picked up live, exactly as in the editor.
Only the syntax file crosses over. Merge has no Python plugin host — it
ships no `plugin_host` binary — so none of this package's code runs there:
| File | In Sublime Merge |
|------|------------------|
| `Klammertext.sublime-syntax` | Works. Delimiters and removed text are colored in diffs. |
| `Klammertext.py`, `Klammertext_indent.py`, `Klammertext_align.py` | Do not run: no plugin host. |
| `Default.sublime-keymap` | Inactive — it binds plugin commands. |
| `Comments.tmPreferences` | Inactive — Merge does not edit text. |
| `Breakers` / `Celeste` / `Mariana` / `Monokai` / `Sixteen` `.sublime-color-scheme` | Not used. They override Sublime Text's built-in schemes by name; Merge has its own. |
So delimiter matching — **Ctrl+M** and the live highlight of the matching
delimiter — is a Sublime Text feature only. Merge colors the delimiters but
cannot match them: matching is context-sensitive code, not a syntax rule
(which is why it is a plugin in the first place). Merge's built-in bracket
matching does not stand in for it either; that matches literal `(`, `[`, `{`
characters, not `@name ... name@` runs.
Merge colors the Klammertext scopes with its own scheme, so the hues differ
from the editor's — the token classes are distinguished, but the package's
five color schemes do not apply.
## Keeping literal klammers in sync
Klammers whose content is verbatim (`@code ... code@`) are listed in the