first commit

This commit is contained in:
csh
2025-06-14 15:36:19 +08:00
commit 40634c2fda
11 changed files with 829 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
# TSL Syntax
`VSCode``ts[lf]`语法插件
## 编译&安装
```bash
npm install
vsce package
code --install-extension tsl-syntax-1.0.0.vsix
```
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@@ -0,0 +1,36 @@
{
"comments": {
"lineComment": "//",
"blockComment": ["(*", "*)"]
},
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"folding": {
"markers": {
"start": "^\\s*\\{\\s*$",
"end": "^\\s*\\}\\s*$"
}
},
"wordPattern": "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b",
"indentationRules": {
"increaseIndentPattern": "^.*(\\{[^}\"']*|\\([^)\"']*|\\[[^\\]\"']*)$",
"decreaseIndentPattern": "^(.*\\*\\/)?\\s*[\\}\\]\\)].*$"
}
}
+40
View File
@@ -0,0 +1,40 @@
{
"name": "tsl-syntax",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "tsl-syntax",
"version": "1.0.0",
"devDependencies": {
"@types/vscode": "^1.101.0",
"typescript": "^5.8.3"
},
"engines": {
"vscode": "^1.101.0"
}
},
"node_modules/@types/vscode": {
"version": "1.101.0",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.101.0.tgz",
"integrity": "sha512-ZWf0IWa+NGegdW3iU42AcDTFHWW7fApLdkdnBqwYEtHVIBGbTu0ZNQKP/kX3Ds/uMJXIMQNAojHR4vexCEEz5Q==",
"dev": true,
"license": "MIT"
},
"node_modules/typescript": {
"version": "5.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
}
}
}
+51
View File
@@ -0,0 +1,51 @@
{
"name": "tsl-syntax",
"displayName": "TSL Syntax",
"description": "Syntax highlighting for tsl/tsf files",
"version": "1.0.0",
"publisher": "csh",
"homepage": "https://git.mytsl.cn/csh/tsl-syntax",
"repository": {
"type": "git",
"url": "https://git.mytsl.cn/csh/tsl-syntax"
},
"bugs": {
"url": "https://git.mytsl.cn/csh/tsl-syntax/issues"
},
"icon": "images/ts.png",
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [
{
"id": "tsl",
"aliases": [
"TSL",
"tsl"
],
"extensions": [
".tsl",
".tsf"
],
"configuration": "./language-configuration.json"
}
],
"grammars": [
{
"language": "tsl",
"scopeName": "source.tsl",
"path": "./syntaxes/tsl.tmLanguage.json"
}
]
},
"scripts": {},
"devDependencies": {
"@types/vscode": "^1.101.0",
"@vscode/vsce": "^3.5.0",
"typescript": "^5.8.3"
},
"engines": {
"vscode": "^1.101.0"
}
}
@@ -0,0 +1,438 @@
{
"$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"
}
]
}
}
}
Binary file not shown.