438 lines
11 KiB
JSON
438 lines
11 KiB
JSON
{
|
|
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
"name": "TSL",
|
|
"scopeName": "source.tsl",
|
|
"patterns": [
|
|
{
|
|
"include": "#comments"
|
|
},
|
|
{
|
|
"include": "#strings"
|
|
},
|
|
{
|
|
"include": "#numbers"
|
|
},
|
|
{
|
|
"include": "#keywords"
|
|
},
|
|
{
|
|
"include": "#functions"
|
|
},
|
|
{
|
|
"include": "#function-calls"
|
|
},
|
|
{
|
|
"include": "#property-chains"
|
|
},
|
|
{
|
|
"include": "#operators"
|
|
},
|
|
{
|
|
"include": "#types"
|
|
},
|
|
{
|
|
"include": "#builtins"
|
|
},
|
|
{
|
|
"include": "#identifiers"
|
|
}
|
|
],
|
|
"repository": {
|
|
"comments": {
|
|
"patterns": [
|
|
{
|
|
"name": "comment.line.double-slash.tsl",
|
|
"match": "//.*$",
|
|
"captures": {
|
|
"0": {
|
|
"patterns": [
|
|
{
|
|
"include": "#comment-todo"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "comment.block.pascal.tsl",
|
|
"begin": "\\(\\*",
|
|
"end": "\\*\\)",
|
|
"patterns": [
|
|
{
|
|
"include": "#comment-todo"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "comment.block.curly.tsl",
|
|
"begin": "\\{",
|
|
"end": "\\}",
|
|
"patterns": [
|
|
{
|
|
"include": "#comment-todo"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"comment-todo": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.other.todo.tsl",
|
|
"match": "\\b(FIXME|NOTE|NOTES|TODO|XXX)\\b"
|
|
}
|
|
]
|
|
},
|
|
"strings": {
|
|
"patterns": [
|
|
{
|
|
"name": "string.quoted.double.tsl",
|
|
"begin": "\"",
|
|
"end": "\"",
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.tsl",
|
|
"match": "\\\\."
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "string.quoted.single.tsl",
|
|
"begin": "'",
|
|
"end": "'",
|
|
"patterns": [
|
|
{
|
|
"name": "constant.character.escape.tsl",
|
|
"match": "\\\\."
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"numbers": {
|
|
"patterns": [
|
|
{
|
|
"name": "constant.numeric.hex.tsl",
|
|
"match": "\\b0[xX][0-9a-fA-F]+[Ll]?\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.octal.tsl",
|
|
"match": "\\b0[oO]?[0-7]+[Ll]?\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.binary.tsl",
|
|
"match": "\\b0[bB][01]+[Ll]?\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.float.tsl",
|
|
"match": "\\b\\d+\\.\\d*([eE][+-]?\\d+)?[jJ]?\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.float.tsl",
|
|
"match": "\\b\\d*\\.\\d+([eE][+-]?\\d+)?[jJ]?\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.scientific.tsl",
|
|
"match": "\\b\\d+[eE][+-]?\\d+[jJ]?\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.integer.tsl",
|
|
"match": "\\b([1-9]\\d*|0)[Ll]?\\b"
|
|
},
|
|
{
|
|
"name": "constant.numeric.complex.tsl",
|
|
"match": "\\b\\d+[jJ]\\b"
|
|
}
|
|
]
|
|
},
|
|
"keywords": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.control.conditional.tsl",
|
|
"match": "\\b(if|else|case|of)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.repeat.tsl",
|
|
"match": "\\b(for|while|do|downto|step|until|repeat|to)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.flow.tsl",
|
|
"match": "\\b(break|continue|exit|return|debugreturn|debugrunenv|debugrunenvdo)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.control.exception.tsl",
|
|
"match": "\\b(try|except|finally|raise|exceptobject)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.other.unit.tsl",
|
|
"match": "\\b(unit|uses|implementation|interface|initalization|finalization)\\b"
|
|
},
|
|
{
|
|
"name": "storage.type.class.tsl",
|
|
"match": "\\b(class|type|fakeclass|new)\\b"
|
|
},
|
|
{
|
|
"name": "storage.modifier.access.tsl",
|
|
"match": "\\b(public|protected|private|published)\\b"
|
|
},
|
|
{
|
|
"name": "storage.modifier.tsl",
|
|
"match": "\\b(global|static|external|const|out|var)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.other.tsl",
|
|
"match": "\\b(begin|end|then|this|with|weakref|autoref|namespace|goto|label)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.other.calling-convention.tsl",
|
|
"match": "\\b(cdecl|pascal|stdcall|safecall|fastcall|register)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.other.class-modifier.tsl",
|
|
"match": "\\b(override|overload|virtual|property|self|inherited)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.other.construct.tsl",
|
|
"match": "\\b(create|destroy|operator)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.other.special.tsl",
|
|
"match": "\\b(setuid|sudo)\\b"
|
|
}
|
|
]
|
|
},
|
|
"functions": {
|
|
"patterns": [
|
|
{
|
|
"name": "meta.function.tsl",
|
|
"begin": "\\b(program|function|procedure)\\s+",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "storage.type.function.tsl"
|
|
}
|
|
},
|
|
"end": "(?=;|\\n|\\{|begin)",
|
|
"patterns": [
|
|
{
|
|
"name": "entity.name.function.tsl",
|
|
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*(?:\\.[a-zA-Z_][a-zA-Z0-9_]*)*\\b"
|
|
},
|
|
{
|
|
"include": "#function-parameters"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"function-parameters": {
|
|
"patterns": [
|
|
{
|
|
"name": "meta.function.parameters.tsl",
|
|
"begin": "\\(",
|
|
"end": "\\)",
|
|
"patterns": [
|
|
{
|
|
"name": "variable.parameter.tsl",
|
|
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
|
|
},
|
|
{
|
|
"name": "punctuation.separator.parameter.tsl",
|
|
"match": "[;,]"
|
|
},
|
|
{
|
|
"name": "punctuation.separator.type.tsl",
|
|
"match": ":"
|
|
},
|
|
{
|
|
"include": "#types"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"function-calls": {
|
|
"patterns": [
|
|
{
|
|
"name": "meta.function-call.method.tsl",
|
|
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(\\.)([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "variable.other.object.tsl"
|
|
},
|
|
"2": {
|
|
"name": "punctuation.accessor.tsl"
|
|
},
|
|
"3": {
|
|
"name": "entity.name.function.call.method.tsl"
|
|
}
|
|
},
|
|
"end": "\\)",
|
|
"patterns": [
|
|
{
|
|
"include": "#function-call-parameters"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "meta.function-call.tsl",
|
|
"begin": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
|
|
"beginCaptures": {
|
|
"1": {
|
|
"name": "entity.name.function.call.tsl"
|
|
}
|
|
},
|
|
"end": "\\)",
|
|
"patterns": [
|
|
{
|
|
"include": "#function-call-parameters"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"function-call-parameters": {
|
|
"patterns": [
|
|
{
|
|
"name": "variable.parameter.named.tsl",
|
|
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*(?=\\s*:)"
|
|
},
|
|
{
|
|
"name": "punctuation.separator.parameter.tsl",
|
|
"match": "[;,]"
|
|
},
|
|
{
|
|
"name": "punctuation.separator.type.tsl",
|
|
"match": ":"
|
|
},
|
|
{
|
|
"include": "#strings"
|
|
},
|
|
{
|
|
"include": "#numbers"
|
|
},
|
|
{
|
|
"include": "#identifiers"
|
|
}
|
|
]
|
|
},
|
|
"property-chains": {
|
|
"patterns": [
|
|
{
|
|
"name": "meta.property-access.chained.tsl",
|
|
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)((?:\\.[a-zA-Z_][a-zA-Z0-9_]*)+)(?!\\s*\\()",
|
|
"captures": {
|
|
"1": {
|
|
"name": "variable.other.object.tsl"
|
|
},
|
|
"2": {
|
|
"patterns": [
|
|
{
|
|
"match": "(\\.)([a-zA-Z_][a-zA-Z0-9_]*)",
|
|
"captures": {
|
|
"1": {
|
|
"name": "punctuation.accessor.tsl"
|
|
},
|
|
"2": {
|
|
"name": "variable.other.property.tsl"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"name": "meta.property-access.simple.tsl",
|
|
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(\\.)([a-zA-Z_][a-zA-Z0-9_]*)(?!\\s*\\()",
|
|
"captures": {
|
|
"1": {
|
|
"name": "variable.other.object.tsl"
|
|
},
|
|
"2": {
|
|
"name": "punctuation.accessor.tsl"
|
|
},
|
|
"3": {
|
|
"name": "variable.other.property.tsl"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"operators": {
|
|
"patterns": [
|
|
{
|
|
"name": "keyword.operator.assignment.tsl",
|
|
"match": ":="
|
|
},
|
|
{
|
|
"name": "keyword.operator.arithmetic.tsl",
|
|
"match": "[+\\-*/<>=]|\\b(div|mod)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.operator.logical.tsl",
|
|
"match": "\\b(and|or|not|in|is)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.operator.bitwise.tsl",
|
|
"match": "\\b(ror|rol|shr|shl)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.operator.io.tsl",
|
|
"match": "\\b(write|read)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.operator.set.tsl",
|
|
"match": "\\b(union|minus|union2)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.operator.other.tsl",
|
|
"match": "[!&|^~%]"
|
|
},
|
|
{
|
|
"name": "punctuation.separator.tsl",
|
|
"match": "[()\\[\\]{},;:.@?]"
|
|
}
|
|
]
|
|
},
|
|
"types": {
|
|
"patterns": [
|
|
{
|
|
"name": "storage.type.primitive.tsl",
|
|
"match": "\\b(string|integer|boolean|int64|real)\\b"
|
|
}
|
|
]
|
|
},
|
|
"builtins": {
|
|
"patterns": [
|
|
{
|
|
"name": "constant.language.boolean.tsl",
|
|
"match": "\\b(true|false)\\b"
|
|
},
|
|
{
|
|
"name": "constant.language.null.tsl",
|
|
"match": "\\bnil\\b"
|
|
},
|
|
{
|
|
"name": "support.variable.builtin.tsl",
|
|
"match": "\\b(paramcount|realparamcount|params|system|thisfunction|tslassigning|likeeps|likeepsrate)\\b"
|
|
},
|
|
{
|
|
"name": "support.function.builtin.tsl",
|
|
"match": "\\b(echo|mtic|mtoc|this|inf|nan)\\b"
|
|
},
|
|
{
|
|
"name": "keyword.other.sql.tsl",
|
|
"match": "\\b(select|vselect|sselect|update|delete|mselect|set|sqlin|from|where|group|by|like|order)\\b"
|
|
}
|
|
]
|
|
},
|
|
"identifiers": {
|
|
"patterns": [
|
|
{
|
|
"name": "variable.other.tsl",
|
|
"match": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
} |