feat(cdl): allow INVALID in CATEGORY pattern

Accept "INVALID" as a valid token in the CATEGORY grammar rule (both the initial
and repeated entries). Also compacted several JSON objects (pattern includes
and "captures" entries) in syntaxes/cdl.tmLanguage.json; these formatting
changes are non-functional.
This commit is contained in:
Christoph Brandau
2026-09-21 20:52:53 +02:00
parent 547da644ce
commit 84821d2852
+14 -52
View File
@@ -2,27 +2,13 @@
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "CDL Support", "name": "CDL Support",
"patterns": [ "patterns": [
{ { "include": "#comment" },
"include": "#comment" { "include": "#function" },
}, { "include": "#variables" },
{ { "include": "#types" },
"include": "#function" { "include": "#keywords" },
}, { "include": "#numbers" },
{ { "include": "#strings" }
"include": "#variables"
},
{
"include": "#types"
},
{
"include": "#keywords"
},
{
"include": "#numbers"
},
{
"include": "#strings"
}
], ],
"repository": { "repository": {
"keywords": { "keywords": {
@@ -70,11 +56,7 @@
{ {
"name": "keyword.control.cdl", "name": "keyword.control.cdl",
"match": "TYPE\\s+(o|g|i|d|b|s)\\b", "match": "TYPE\\s+(o|g|i|d|b|s)\\b",
"captures": { "captures": { "1": { "name": "storage.type.cs" } }
"1": {
"name": "storage.type.cs"
}
}
} }
] ]
}, },
@@ -83,38 +65,22 @@
{ {
"name": "keyword.control.cdl", "name": "keyword.control.cdl",
"match": "\\b(PARAM|EVENT)\\s+([a-zA-Z_]\\w*)\\b", "match": "\\b(PARAM|EVENT)\\s+([a-zA-Z_]\\w*)\\b",
"captures": { "captures": { "2": { "name": "variable.other.cdl" } }
"2": {
"name": "variable.other.cdl"
}
}
}, },
{ {
"name": "keyword.control.cdl", "name": "keyword.control.cdl",
"match": "\\bMACHINE\\s+([a-zA-Z_]\\w*)\\b", "match": "\\bMACHINE\\s+([a-zA-Z_]\\w*)\\b",
"captures": { "captures": { "1": { "name": "variable.other.cdl" } }
"1": {
"name": "variable.other.cdl"
}
}
}, },
{ {
"name": "keyword.control.cdl", "name": "keyword.control.cdl",
"match": "\\bCATEGORY\\s+((MILL|LATHE|DRILL)(\\s+(MILL|LATHE|DRILL))*)\\b", "match": "\\bCATEGORY\\s+((MILL|LATHE|DRILL|INVALID)(\\s+(MILL|LATHE|DRILL|INVALID))*)\\b",
"captures": { "captures": { "1": { "name": "variable.language.cdl" } }
"1": {
"name": "variable.language.cdl"
}
}
}, },
{ {
"name": "keyword.control.cdl", "name": "keyword.control.cdl",
"match": "\\bTOGGLE\\s+(OFF|ON|off|on)\\b", "match": "\\bTOGGLE\\s+(OFF|ON|off|on)\\b",
"captures": { "captures": { "1": { "name": "variable.other.constant" } }
"1": {
"name": "variable.other.constant"
}
}
} }
] ]
}, },
@@ -123,11 +89,7 @@
{ {
"name": "storage.type.function.cdl", "name": "storage.type.function.cdl",
"match": "\\bEVENT\\s+([a-zA-Z_]\\w*)\\b", "match": "\\bEVENT\\s+([a-zA-Z_]\\w*)\\b",
"captures": { "captures": { "1": { "name": "entity.name.function" } }
"1": {
"name": "entity.name.function"
}
}
} }
] ]
}, },