Editor support generalized: shared core, language server, Vim and VS Code (from dev eb5baf9cbe59)
doc/edit/ now holds a shared Python implementation of the language's structural layer (klammertext_edit.py) and a dependency-free language server (klammertext_ls.py), with integrations for Emacs, Sublime Text, Vim, and Visual Studio Code. The editor test suite in tst/ covers the core's API and CLI, the language server protocol, the VS Code extension, headless Vim, and Emacs byte-equality. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
132
doc/edit/vscode/syntaxes/klammertext.tmLanguage.json
Normal file
132
doc/edit/vscode/syntaxes/klammertext.tmLanguage.json
Normal file
@@ -0,0 +1,132 @@
|
||||
{
|
||||
"//": [
|
||||
"TextMate grammar for Klammertext — the VS Code port of",
|
||||
"doc/edit/sublime/Klammertext.sublime-syntax (same token classes,",
|
||||
"same scope names; see that file's header for the full rationale).",
|
||||
"",
|
||||
"What it highlights: text removal (#, ##, nestable #[ ... ]#,",
|
||||
"whitespace operators left unscoped), the three @-tiers — application",
|
||||
"(@), definition (@@), system (@@@) — each as an opening (@name, one",
|
||||
"unit) or a close (name@, bare @), ^-escapes (consumed, unscoped),",
|
||||
"and verbatim @code ... code@ interiors.",
|
||||
"",
|
||||
"How open vs. close is decided (the same rule as every integration):",
|
||||
"a delimiter whose NAME follows the @-run is an OPENING; a bare",
|
||||
"@-run, or one whose NAME precedes it, is a CLOSING. The",
|
||||
"(?![A-Za-z0-9_@]) look-ahead on every closing keeps foo@bar correct.",
|
||||
"",
|
||||
"SYNC: the literal-klammer set's source of truth is LITERAL_KLAMMERS",
|
||||
"in doc/edit/shared/klammertext_edit.py. A static grammar cannot",
|
||||
"read it: to add a literal klammer 'foo', copy the @code begin/end",
|
||||
"rule below with code -> foo (and mirror it in the Emacs, Sublime,",
|
||||
"and Vim artifacts; all are seeded with just 'code').",
|
||||
"",
|
||||
"Delimiter matching, indentation, alignment, and diagnostics are not",
|
||||
"tokenizer concerns — they come from the Klammertext language server",
|
||||
"via extension.js.",
|
||||
"",
|
||||
"The ## rule's end pattern never matches, so the region runs to the",
|
||||
"end of the file (## removes the rest of the file by definition)."
|
||||
],
|
||||
"name": "Klammertext",
|
||||
"scopeName": "text.klammertext",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\^."
|
||||
},
|
||||
{
|
||||
"begin": "#\\[",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "punctuation.definition.comment.klammertext" }
|
||||
},
|
||||
"end": "\\]#",
|
||||
"endCaptures": {
|
||||
"0": { "name": "punctuation.definition.comment.klammertext" }
|
||||
},
|
||||
"name": "comment.block.klammertext",
|
||||
"patterns": [
|
||||
{ "include": "#removal-block" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"match": "#[-+/]\\d*"
|
||||
},
|
||||
{
|
||||
"begin": "##",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "punctuation.definition.comment.klammertext" }
|
||||
},
|
||||
"end": "$never^",
|
||||
"name": "comment.block.klammertext"
|
||||
},
|
||||
{
|
||||
"begin": "#",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "punctuation.definition.comment.klammertext" }
|
||||
},
|
||||
"end": "$",
|
||||
"name": "comment.line.klammertext"
|
||||
},
|
||||
{
|
||||
"begin": "@code(?![A-Za-z0-9_])",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "entity.name.function.begin.klammertext" }
|
||||
},
|
||||
"end": "code@",
|
||||
"endCaptures": {
|
||||
"0": { "name": "entity.name.function.end.klammertext" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "@@@[A-Za-z0-9_]+",
|
||||
"name": "keyword.control.begin.klammertext"
|
||||
},
|
||||
{
|
||||
"match": "@@@(?![A-Za-z0-9_@])",
|
||||
"name": "keyword.control.end.klammertext"
|
||||
},
|
||||
{
|
||||
"match": "[A-Za-z0-9_]+@@@(?![A-Za-z0-9_@])",
|
||||
"name": "keyword.control.end.klammertext"
|
||||
},
|
||||
{
|
||||
"match": "@@[A-Za-z0-9_]+",
|
||||
"name": "storage.type.begin.klammertext"
|
||||
},
|
||||
{
|
||||
"match": "@@(?![A-Za-z0-9_@])",
|
||||
"name": "storage.type.end.klammertext"
|
||||
},
|
||||
{
|
||||
"match": "[A-Za-z0-9_]+@@(?![A-Za-z0-9_@])",
|
||||
"name": "storage.type.end.klammertext"
|
||||
},
|
||||
{
|
||||
"match": "@[A-Za-z0-9_]+",
|
||||
"name": "entity.name.function.begin.klammertext"
|
||||
},
|
||||
{
|
||||
"match": "@(?![A-Za-z0-9_@])",
|
||||
"name": "entity.name.function.end.klammertext"
|
||||
},
|
||||
{
|
||||
"match": "[A-Za-z0-9_]+@(?![A-Za-z0-9_@])",
|
||||
"name": "entity.name.function.end.klammertext"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"removal-block": {
|
||||
"begin": "#\\[",
|
||||
"beginCaptures": {
|
||||
"0": { "name": "punctuation.definition.comment.klammertext" }
|
||||
},
|
||||
"end": "\\]#",
|
||||
"endCaptures": {
|
||||
"0": { "name": "punctuation.definition.comment.klammertext" }
|
||||
},
|
||||
"patterns": [
|
||||
{ "include": "#removal-block" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user