Files
klammertext/doc/edit/vscode/syntaxes/klammertext.tmLanguage.json

133 lines
4.6 KiB
JSON
Raw Permalink Normal View History

{
"//": [
"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" }
]
}
}
}