Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--languages.toml12
-rw-r--r--runtime/queries/tolk/highlights.scm129
2 files changed, 141 insertions, 0 deletions
diff --git a/languages.toml b/languages.toml
index f8d43ced..a0d06a54 100644
--- a/languages.toml
+++ b/languages.toml
@@ -4193,6 +4193,18 @@ name = "koka"
source = { git = "https://github.com/koka-community/tree-sitter-koka", rev = "fd3b482274d6988349ba810ea5740e29153b1baf" }
[[language]]
+name = "tolk"
+scope = "source.tolk"
+injection-regex = "tolk"
+file-types = ["tolk"]
+comment-token = "//"
+indent = { tab-width = 4, unit = " " }
+
+[[grammar]]
+name = "tolk"
+source = { git = "https://github.com/ton-blockchain/ton-language-server", rev = "e90dbb89f8ec8fbf8a16b61a31d6cc19a840de4f", subpath = "server/src/languages/tolk/tree-sitter-tolk" }
+
+[[language]]
name = "tact"
scope = "source.tact"
injection-regex = "tact"
diff --git a/runtime/queries/tolk/highlights.scm b/runtime/queries/tolk/highlights.scm
new file mode 100644
index 00000000..cd2a5472
--- /dev/null
+++ b/runtime/queries/tolk/highlights.scm
@@ -0,0 +1,129 @@
+
+(type_identifier) @type
+((type_identifier) @type.builtin (#any-of? @type.builtin "int" "bool" "cell" "slice" "builder" "continuation" "tuple" "coins" "address" "void" "self"))
+
+(identifier) @variable
+((identifier) @constant
+ (#match? @constant "^[A-Z][A-Z\\d_]*$"))
+((identifier) @variable.builtin
+ (#eq? @variable.builtin "self"))
+
+(comment) @comment
+
+[
+ "(" ")"
+ "{" "}"
+] @punctuation.bracket
+
+[
+ ; "::"
+ "."
+ ";"
+ ","
+ ":"
+] @punctuation.delimiter
+
+[
+ "do"
+ "if"
+ "as"
+ "fun"
+ "asm"
+ "get"
+ "try"
+ "var"
+ "val"
+ "else"
+ "true"
+ "tolk"
+ "const"
+ "false"
+ "throw"
+ "redef"
+ "while"
+ "catch"
+ "return"
+ "assert"
+ "import"
+ "global"
+ "repeat"
+ "mutate"
+ "struct"
+ "type"
+ "match"
+ "lazy"
+ (null_literal)
+ (builtin_specifier)
+] @keyword
+
+[
+ "="
+ "+="
+ "-="
+ "*="
+ "/="
+ "%="
+ "<<="
+ ">>="
+ "&="
+ "|="
+ "^="
+
+ "=="
+ "<"
+ ">"
+ "<="
+ ">="
+ "!="
+ "<=>"
+ "<<"
+ ">>"
+ "~>>"
+ "^>>"
+ "-"
+ "+"
+ "|"
+ "^"
+ "*"
+ "/"
+ "%"
+ "~/"
+ "^/"
+ "&"
+ "~"
+ "."
+ "!"
+ "&&"
+ "||"
+
+ "->"
+ "=>"
+] @operator
+
+(string_literal) @string
+(number_literal) @constant.numeric
+(boolean_literal) @constant.builtin.boolean
+
+(annotation) @attribute
+
+(function_declaration
+ name: (identifier) @function)
+(method_declaration
+ name: (identifier) @function)
+(get_method_declaration
+ name: (identifier) @function)
+(function_call
+ callee: (identifier) @function)
+(function_call
+ callee: (dot_access (identifier) @type "." (identifier) @function))
+(dot_access
+ field: (identifier) @variable)
+
+
+(struct_declaration
+ "struct"
+ name: (identifier) @type)
+(struct_field_declaration
+ name: (identifier) @variable.other.member)
+(instance_argument
+ name: (identifier) @variable.other.member)