Files
nx_post_support/syntaxes/def.tmLanguage.json
2025-01-08 21:37:24 +01:00

154 lines
2.8 KiB
JSON

{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "DEF Support",
"patterns": [
{
"include": "#comment"
},
{
"include": "#strings"
},
{
"include": "#function"
},
{
"include": "#variables"
},
{
"include": "#types"
},
{
"include": "#keywords"
},
{
"include": "#numbers"
},
{
"include": "#unquoted-strings"
}
],
"repository": {
"keywords": {
"patterns": [
{
"name": "storage.type.def",
"match": "\\b(FORMAT|ADDRESS|FORMATTING|FORCE|LEADER|ZERO_FORMAT|TRAILER|OMIT|MAX|MIN)\\b"
}
]
},
"strings": {
"name": "string.quoted.double.def",
"begin": "(?<!\\\\)\"",
"end": "(?<!\\\\)\"",
"patterns": [
{
"name": "constant.character.escape.def",
"match": "\\\\."
},
{
"name": "variable.other.property",
"match": "\\$[_a-zA-Z][_a-zA-Z0-9]*(\\([_a-zA-Z][_a-zA-Z0-9]*\\))?"
}
]
},
"unquoted-strings": {
"name": "string.unquoted.def",
"match": "\\b[_a-zA-Z][_a-zA-Z0-9]*\\b"
},
"numbers": {
"name": "constant.numeric",
"patterns": [
{
"name": "constant.numeric",
"match": "\"\\d+\""
},
{
"name": "constant.numeric",
"match": "\"\\d+.\\d+\""
},
{
"name": "constant.numeric",
"match": "\\d+"
},
{
"name": "constant.numeric",
"match": "\\d+.\\d+"
}
]
},
"types": {
"patterns": [
{
"name": "storage.type.def",
"match": "(FORMAT|ZERO_FORMAT)\\s+([a-zA-Z_]+)\\b",
"captures": {
"2": {
"name": "storage.type.cs"
}
}
}
]
},
"variables": {
"patterns": [
{
"name": "keyword.control.cdl",
"match": "\\b(PARAM|EVENT)\\s+([a-zA-Z_]\\w*)\\b",
"captures": {
"2": {
"name": "variable.other.cdl"
}
}
},
{
"name": "keyword.control.cdl",
"match": "\\bMACHINE\\s+([a-zA-Z_]\\w*)\\b",
"captures": {
"1": {
"name": "variable.other.cdl"
}
}
},
{
"name": "variable.other.property",
"match": "\\$[_a-zA-Z][_a-zA-Z0-9]*(\\(\\$?[_a-zA-Z][_a-zA-Z0-9]*(,\\$?[_a-zA-Z][_a-zA-Z0-9]*)*\\))?"
},
{
"name": "storage.type.def",
"match": "\\bFORCE\\s+(on|always|off)\\b",
"captures": {
"1": {
"name": "variable.other.constant"
}
}
}
]
},
"function": {
"patterns": [
{
"name": "storage.type.function.def",
"match": "\\b(ADDRESS|BLOCK_TEMPLATE)\\s+([a-zA-Z_]\\w*)\\b",
"captures": {
"2": {
"name": "entity.name.function"
}
}
},
{
"name": "entity.name.function",
"match": "[a-zA-Z_0-9]*\\["
}
]
},
"comment": {
"patterns": [
{
"name": "comment.line.def",
"match": "#.*"
}
]
}
},
"scopeName": "source.def"
}