ts-wasms 1.0.6 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/README.md +26 -9
  2. package/index.d.ts +102 -0
  3. package/index.js +27 -0
  4. package/out/angular/folds.scm +1 -0
  5. package/out/angular/highlights.scm +178 -0
  6. package/out/angular/indents.scm +16 -0
  7. package/out/angular/injections.scm +1 -0
  8. package/out/angular/locals.scm +1 -0
  9. package/out/angular/tree-sitter-angular.wasm +0 -0
  10. package/out/asm/highlights.scm +66 -0
  11. package/out/asm/injections.scm +5 -0
  12. package/out/asm/tree-sitter-asm.wasm +0 -0
  13. package/out/astro/folds.scm +1 -0
  14. package/out/astro/highlights.scm +12 -0
  15. package/out/astro/indents.scm +1 -0
  16. package/out/astro/injections.scm +27 -0
  17. package/out/astro/locals.scm +1 -0
  18. package/out/astro/tree-sitter-astro.wasm +0 -0
  19. package/out/bash/folds.scm +9 -0
  20. package/out/bash/indents.scm +32 -0
  21. package/out/bash/injections.scm +90 -0
  22. package/out/bash/locals.scm +14 -0
  23. package/out/c/folds.scm +23 -0
  24. package/out/c/indents.scm +99 -0
  25. package/out/c/injections.scm +128 -0
  26. package/out/c/locals.scm +67 -0
  27. package/out/clojure/folds.scm +2 -0
  28. package/out/clojure/injections.scm +2 -0
  29. package/out/clojure/locals.scm +1 -0
  30. package/out/cmake/folds.scm +8 -0
  31. package/out/cmake/highlights.scm +221 -0
  32. package/out/cmake/indents.scm +26 -0
  33. package/out/cmake/injections.scm +5 -0
  34. package/out/cmake/tree-sitter-cmake.wasm +0 -0
  35. package/out/comment/highlights.scm +49 -0
  36. package/out/comment/tree-sitter-comment.wasm +0 -0
  37. package/out/commonlisp/folds.scm +2 -0
  38. package/out/commonlisp/highlights.scm +314 -0
  39. package/out/commonlisp/injections.scm +5 -0
  40. package/out/commonlisp/locals.scm +109 -0
  41. package/out/cpp/folds.scm +14 -0
  42. package/out/cpp/indents.scm +8 -0
  43. package/out/cpp/locals.scm +78 -0
  44. package/out/css/folds.scm +10 -0
  45. package/out/css/indents.scm +11 -0
  46. package/out/css/injections.scm +2 -0
  47. package/out/csv/highlights.scm +5 -0
  48. package/out/csv/tree-sitter-csv.wasm +0 -0
  49. package/out/csv-psv/highlights.scm +5 -0
  50. package/out/csv-psv/tree-sitter-csv-psv.wasm +0 -0
  51. package/out/csv-tsv/highlights.scm +4 -0
  52. package/out/csv-tsv/tree-sitter-csv-tsv.wasm +0 -0
  53. package/out/dart/indents.scm +49 -0
  54. package/out/dart/injections.scm +2 -0
  55. package/out/dart/locals.scm +32 -0
  56. package/out/diff/folds.scm +5 -0
  57. package/out/diff/highlights.scm +49 -0
  58. package/out/diff/injections.scm +2 -0
  59. package/out/diff/tree-sitter-diff.wasm +0 -0
  60. package/out/dockerfile/highlights.scm +58 -0
  61. package/out/dockerfile/injections.scm +12 -0
  62. package/out/dockerfile/tree-sitter-dockerfile.wasm +0 -0
  63. package/out/dtd/folds.scm +4 -0
  64. package/out/dtd/highlights.scm +148 -0
  65. package/out/dtd/injections.scm +2 -0
  66. package/out/dtd/locals.scm +11 -0
  67. package/out/editorconfig/folds.scm +1 -0
  68. package/out/editorconfig/highlights.scm +35 -0
  69. package/out/editorconfig/injections.scm +2 -0
  70. package/out/editorconfig/tree-sitter-editorconfig.wasm +0 -0
  71. package/out/elixir/folds.scm +10 -0
  72. package/out/elixir/indents.scm +25 -0
  73. package/out/elixir/locals.scm +200 -0
  74. package/out/elm/folds.scm +14 -0
  75. package/out/erlang/folds.scm +9 -0
  76. package/out/erlang/injections.scm +2 -0
  77. package/out/fish/folds.scm +8 -0
  78. package/out/fish/highlights.scm +61 -0
  79. package/out/fish/indents.scm +18 -0
  80. package/out/fish/injections.scm +2 -0
  81. package/out/fish/locals.scm +19 -0
  82. package/out/fish/tree-sitter-fish.wasm +0 -0
  83. package/out/gdscript/folds.scm +26 -0
  84. package/out/gdscript/highlights.scm +635 -0
  85. package/out/gdscript/indents.scm +78 -0
  86. package/out/gdscript/injections.scm +2 -0
  87. package/out/gdscript/locals.scm +121 -0
  88. package/out/gdscript/tree-sitter-gdscript.wasm +0 -0
  89. package/out/gdshader/highlights.scm +256 -0
  90. package/out/gdshader/injections.scm +2 -0
  91. package/out/gdshader/locals.scm +24 -0
  92. package/out/gdshader/tags.scm +13 -0
  93. package/out/gdshader/tree-sitter-gdshader.wasm +0 -0
  94. package/out/git-config/highlights.scm +28 -0
  95. package/out/git-config/tree-sitter-git-config.wasm +0 -0
  96. package/out/git-rebase/highlights.scm +36 -0
  97. package/out/git-rebase/tree-sitter-git-rebase.wasm +0 -0
  98. package/out/gitattributes/highlights.scm +52 -0
  99. package/out/gitattributes/injections.scm +2 -0
  100. package/out/gitattributes/locals.scm +8 -0
  101. package/out/gitattributes/tree-sitter-gitattributes.wasm +0 -0
  102. package/out/gitignore/highlights.scm +36 -0
  103. package/out/gitignore/injections.scm +2 -0
  104. package/out/gitignore/tree-sitter-gitignore.wasm +0 -0
  105. package/out/go/folds.scm +19 -0
  106. package/out/go/indents.scm +48 -0
  107. package/out/go/injections.scm +42 -0
  108. package/out/go/locals.scm +88 -0
  109. package/out/godot-resource/tree-sitter-godot-resource.wasm +0 -0
  110. package/out/graphql/highlights.scm +163 -0
  111. package/out/graphql/indents.scm +11 -0
  112. package/out/graphql/injections.scm +2 -0
  113. package/out/groovy/folds.scm +6 -0
  114. package/out/groovy/highlights.scm +148 -0
  115. package/out/groovy/indents.scm +23 -0
  116. package/out/groovy/injections.scm +5 -0
  117. package/out/groovy/locals.scm +6 -0
  118. package/out/groovy/tree-sitter-groovy.wasm +0 -0
  119. package/out/haskell/folds.scm +6 -0
  120. package/out/hcl/folds.scm +6 -0
  121. package/out/hcl/highlights.scm +118 -0
  122. package/out/hcl/indents.scm +16 -0
  123. package/out/hcl/injections.scm +6 -0
  124. package/out/html/folds.scm +5 -0
  125. package/out/html/indents.scm +1 -0
  126. package/out/html/locals.scm +1 -0
  127. package/out/ini/folds.scm +1 -0
  128. package/out/ini/highlights.scm +16 -0
  129. package/out/ini/injections.scm +3 -0
  130. package/out/ini/tree-sitter-ini.wasm +0 -0
  131. package/out/java/folds.scm +8 -0
  132. package/out/java/indents.scm +40 -0
  133. package/out/java/injections.scm +31 -0
  134. package/out/java/locals.scm +100 -0
  135. package/out/javascript/folds.scm +1 -0
  136. package/out/javascript/indents.scm +1 -0
  137. package/out/json/folds.scm +5 -0
  138. package/out/json/indents.scm +11 -0
  139. package/out/json/injections.scm +2 -0
  140. package/out/json/locals.scm +4 -0
  141. package/out/julia/folds.scm +14 -0
  142. package/out/julia/indents.scm +52 -0
  143. package/out/kotlin/folds.scm +13 -0
  144. package/out/kotlin/injections.scm +52 -0
  145. package/out/kotlin/locals.scm +78 -0
  146. package/out/lua/folds.scm +12 -0
  147. package/out/lua/indents.scm +47 -0
  148. package/out/markdown/folds.scm +12 -0
  149. package/out/markdown/indents.scm +1 -0
  150. package/out/matlab/folds.scm +13 -0
  151. package/out/matlab/highlights.scm +218 -0
  152. package/out/matlab/indents.scm +40 -0
  153. package/out/matlab/injections.scm +2 -0
  154. package/out/matlab/locals.scm +33 -0
  155. package/out/matlab/tree-sitter-matlab.wasm +0 -0
  156. package/out/nim/folds.scm +41 -0
  157. package/out/nim/highlights.scm +186 -0
  158. package/out/nim/injections.scm +79 -0
  159. package/out/nim/locals.scm +328 -0
  160. package/out/nim/tree-sitter-nim.wasm +0 -0
  161. package/out/nix/folds.scm +11 -0
  162. package/out/nix/indents.scm +75 -0
  163. package/out/ocaml/folds.scm +30 -0
  164. package/out/ocaml/indents.scm +77 -0
  165. package/out/ocaml/injections.scm +2 -0
  166. package/out/php/folds.scm +1 -0
  167. package/out/php/indents.scm +1 -0
  168. package/out/php/locals.scm +1 -0
  169. package/out/prisma/folds.scm +7 -0
  170. package/out/prisma/injections.scm +5 -0
  171. package/out/python/folds.scm +28 -0
  172. package/out/python/indents.scm +213 -0
  173. package/out/python/injections.scm +30 -0
  174. package/out/python/locals.scm +124 -0
  175. package/out/qmljs/folds.scm +8 -0
  176. package/out/qmljs/highlights.scm +61 -0
  177. package/out/qmljs/injections.scm +1 -0
  178. package/out/qmljs/locals.scm +6 -0
  179. package/out/qmljs/tree-sitter-qmljs.wasm +0 -0
  180. package/out/query/folds.scm +6 -0
  181. package/out/query/highlights.scm +102 -0
  182. package/out/query/indents.scm +25 -0
  183. package/out/query/injections.scm +28 -0
  184. package/out/query/locals.scm +21 -0
  185. package/out/r/indents.scm +33 -0
  186. package/out/r/injections.scm +2 -0
  187. package/out/racket/folds.scm +2 -0
  188. package/out/racket/injections.scm +5 -0
  189. package/out/ruby/folds.scm +12 -0
  190. package/out/ruby/indents.scm +43 -0
  191. package/out/ruby/injections.scm +34 -0
  192. package/out/rust/folds.scm +25 -0
  193. package/out/rust/indents.scm +133 -0
  194. package/out/rust/locals.scm +98 -0
  195. package/out/scala/folds.scm +16 -0
  196. package/out/scala/injections.scm +5 -0
  197. package/out/scheme/folds.scm +2 -0
  198. package/out/scheme/injections.scm +2 -0
  199. package/out/scss/folds.scm +1 -0
  200. package/out/scss/indents.scm +7 -0
  201. package/out/scss/injections.scm +2 -0
  202. package/out/sql/folds.scm +1 -0
  203. package/out/sql/highlights.scm +445 -0
  204. package/out/sql/indents.scm +27 -0
  205. package/out/sql/injections.scm +5 -0
  206. package/out/sql/tree-sitter-sql.wasm +0 -0
  207. package/out/terraform/folds.scm +1 -0
  208. package/out/terraform/highlights.scm +41 -0
  209. package/out/terraform/indents.scm +1 -0
  210. package/out/terraform/injections.scm +1 -0
  211. package/out/toml/folds.scm +5 -0
  212. package/out/toml/indents.scm +11 -0
  213. package/out/toml/injections.scm +2 -0
  214. package/out/toml/locals.scm +4 -0
  215. package/out/tsx/folds.scm +1 -0
  216. package/out/tsx/indents.scm +1 -0
  217. package/out/tsx/injections.scm +1 -0
  218. package/out/typescript/folds.scm +8 -0
  219. package/out/typescript/indents.scm +7 -0
  220. package/out/typescript/injections.scm +28 -0
  221. package/out/vim/folds.scm +4 -0
  222. package/out/vim/highlights.scm +362 -0
  223. package/out/vim/injections.scm +44 -0
  224. package/out/vim/locals.scm +19 -0
  225. package/out/vim/tree-sitter-vim.wasm +0 -0
  226. package/out/vimdoc/highlights.scm +74 -0
  227. package/out/vimdoc/injections.scm +4 -0
  228. package/out/vue/folds.scm +6 -0
  229. package/out/vue/highlights.scm +54 -0
  230. package/out/vue/indents.scm +7 -0
  231. package/out/vue/injections.scm +78 -0
  232. package/out/vue/tree-sitter-vue.wasm +0 -0
  233. package/out/xml/folds.scm +5 -0
  234. package/out/xml/highlights.scm +198 -0
  235. package/out/xml/indents.scm +16 -0
  236. package/out/xml/injections.scm +32 -0
  237. package/out/xml/locals.scm +35 -0
  238. package/out/yaml/folds.scm +4 -0
  239. package/out/yaml/highlights.scm +79 -0
  240. package/out/yaml/indents.scm +7 -0
  241. package/out/yaml/injections.scm +81 -0
  242. package/out/yaml/locals.scm +9 -0
  243. package/out/yaml/tree-sitter-yaml.wasm +0 -0
  244. package/out/zig/locals.scm +96 -0
  245. package/package.json +61 -19
  246. package/out/clojurescript/highlights.scm +0 -29
  247. package/out/clojurescript/tree-sitter-clojurescript.wasm +0 -0
@@ -0,0 +1,218 @@
1
+ ; Includes
2
+ ((command_name) @keyword.import
3
+ (#eq? @keyword.import "import"))
4
+
5
+ ; Keywords
6
+ [
7
+ "arguments"
8
+ "end"
9
+ "events"
10
+ "global"
11
+ "methods"
12
+ "persistent"
13
+ "properties"
14
+ ] @keyword
15
+
16
+ "enumeration" @keyword.type
17
+
18
+ (class_definition
19
+ [
20
+ "classdef"
21
+ "end"
22
+ ] @keyword.type)
23
+
24
+ ; Conditionals
25
+ (if_statement
26
+ [
27
+ "if"
28
+ "end"
29
+ ] @keyword.conditional)
30
+
31
+ (elseif_clause
32
+ "elseif" @keyword.conditional)
33
+
34
+ (else_clause
35
+ "else" @keyword.conditional)
36
+
37
+ (switch_statement
38
+ [
39
+ "switch"
40
+ "end"
41
+ ] @keyword.conditional)
42
+
43
+ (case_clause
44
+ "case" @keyword.conditional)
45
+
46
+ (otherwise_clause
47
+ "otherwise" @keyword.conditional)
48
+
49
+ (break_statement) @keyword.conditional
50
+
51
+ ; Repeats
52
+ (for_statement
53
+ [
54
+ "for"
55
+ "parfor"
56
+ "end"
57
+ ] @keyword.repeat)
58
+
59
+ (while_statement
60
+ [
61
+ "while"
62
+ "end"
63
+ ] @keyword.repeat)
64
+
65
+ (continue_statement) @keyword.repeat
66
+
67
+ ; Exceptions
68
+ (try_statement
69
+ [
70
+ "try"
71
+ "end"
72
+ ] @keyword.exception)
73
+
74
+ (catch_clause
75
+ "catch" @keyword.exception)
76
+
77
+ ; Variables
78
+ (identifier) @variable
79
+
80
+ ; Constants
81
+ (events
82
+ (identifier) @constant)
83
+
84
+ (attribute
85
+ (identifier) @constant)
86
+
87
+ "~" @constant.builtin
88
+
89
+ ; Fields/Properties
90
+ (field_expression
91
+ field: (identifier) @variable.member)
92
+
93
+ (superclass
94
+ "."
95
+ (identifier) @variable.member)
96
+
97
+ (property_name
98
+ "."
99
+ (identifier) @variable.member)
100
+
101
+ (property
102
+ name: (identifier) @variable.member)
103
+
104
+ ; Types
105
+ (class_definition
106
+ name: (identifier) @type)
107
+
108
+ (attributes
109
+ (identifier) @constant)
110
+
111
+ (enum
112
+ .
113
+ (identifier) @type)
114
+
115
+ ((identifier) @type
116
+ (#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]+$"))
117
+
118
+ ; Functions
119
+ (function_definition
120
+ "function" @keyword.function
121
+ name: (identifier) @function
122
+ [
123
+ "end"
124
+ "endfunction"
125
+ ]? @keyword.function)
126
+
127
+ (function_signature
128
+ name: (identifier) @function)
129
+
130
+ (function_call
131
+ name: (identifier) @function.call)
132
+
133
+ (handle_operator
134
+ (identifier) @function)
135
+
136
+ (validation_functions
137
+ (identifier) @function)
138
+
139
+ (command
140
+ (command_name) @function.call)
141
+
142
+ (command_argument) @variable.parameter
143
+
144
+ (return_statement) @keyword.return
145
+
146
+ ; Parameters
147
+ (function_arguments
148
+ (identifier) @variable.parameter)
149
+
150
+ ; Punctuation
151
+ [
152
+ ";"
153
+ ","
154
+ "."
155
+ ] @punctuation.delimiter
156
+
157
+ [
158
+ "("
159
+ ")"
160
+ "["
161
+ "]"
162
+ "{"
163
+ "}"
164
+ ] @punctuation.bracket
165
+
166
+ ; Operators
167
+ [
168
+ "+"
169
+ ".+"
170
+ "-"
171
+ ".*"
172
+ "*"
173
+ "/"
174
+ "./"
175
+ "\\"
176
+ ".\\"
177
+ "^"
178
+ ".^"
179
+ "'"
180
+ ".'"
181
+ "|"
182
+ "&"
183
+ "?"
184
+ "@"
185
+ "<"
186
+ "<="
187
+ ">"
188
+ ">="
189
+ "=="
190
+ "~="
191
+ "="
192
+ "&&"
193
+ "||"
194
+ ":"
195
+ ] @operator
196
+
197
+ ; Literals
198
+ (string) @string
199
+
200
+ (escape_sequence) @string.escape
201
+
202
+ (formatting_sequence) @string.special
203
+
204
+ (number) @number
205
+
206
+ ((identifier) @boolean
207
+ (#eq? @boolean "true"))
208
+
209
+ ((identifier) @boolean
210
+ (#eq? @boolean "false"))
211
+
212
+ ; Comments
213
+ (comment) @comment @spell
214
+
215
+ (line_continuation) @punctuation.special
216
+
217
+ ((comment) @keyword.directive
218
+ (#lua-match? @keyword.directive "^%%%% "))
@@ -0,0 +1,40 @@
1
+ "end" @indent.end @indent.branch
2
+
3
+ [
4
+ (arguments_statement)
5
+ (if_statement)
6
+ (for_statement)
7
+ (while_statement)
8
+ (switch_statement)
9
+ (try_statement)
10
+ (function_definition)
11
+ (class_definition)
12
+ (enumeration)
13
+ (events)
14
+ (methods)
15
+ (properties)
16
+ ] @indent.begin
17
+
18
+ [
19
+ "elseif"
20
+ "else"
21
+ "case"
22
+ "otherwise"
23
+ "catch"
24
+ ] @indent.branch
25
+
26
+ ((matrix
27
+ (row) @indent.align)
28
+ (#set! indent.open_delimiter "[")
29
+ (#set! indent.close_delimiter "]"))
30
+
31
+ ((cell
32
+ (row) @indent.align)
33
+ (#set! indent.open_delimiter "{")
34
+ (#set! indent.close_delimiter "}"))
35
+
36
+ ((parenthesis) @indent.align
37
+ (#set! indent.open_delimiter "(")
38
+ (#set! indent.close_delimiter ")"))
39
+
40
+ (comment) @indent.auto
@@ -0,0 +1,2 @@
1
+ ((comment) @injection.content
2
+ (#set! injection.language "comment"))
@@ -0,0 +1,33 @@
1
+ ; References
2
+ (identifier) @local.reference
3
+
4
+ ; Definitions
5
+ (function_definition
6
+ name: (identifier) @local.definition.function
7
+ (function_arguments
8
+ (identifier)* @local.definition.parameter
9
+ (","
10
+ (identifier) @local.definition.parameter)*)?) @local.scope
11
+
12
+ (assignment
13
+ left: (identifier) @local.definition.var)
14
+
15
+ (multioutput_variable
16
+ (identifier) @local.definition.var)
17
+
18
+ (iterator
19
+ .
20
+ (identifier) @local.definition.var)
21
+
22
+ (lambda
23
+ (arguments
24
+ (identifier) @local.definition.parameter))
25
+
26
+ (global_operator
27
+ (identifier) @local.definition.var)
28
+
29
+ (persistent_operator
30
+ (identifier) @local.definition.var)
31
+
32
+ (catch_clause
33
+ (identifier) @local.definition)
@@ -0,0 +1,41 @@
1
+ [
2
+ (const_section)
3
+ (var_section)
4
+ (let_section)
5
+ (type_section)
6
+ (using_section)
7
+ (object_declaration)
8
+ (tuple_type)
9
+ (enum_declaration)
10
+ (case)
11
+ (if)
12
+ (when)
13
+ (conditional_declaration)
14
+ (variant_declaration)
15
+ (of_branch)
16
+ (elif_branch)
17
+ (else_branch)
18
+ (for)
19
+ (while)
20
+ (block)
21
+ (static_statement)
22
+ (pragma_statement)
23
+ (try)
24
+ (except_branch)
25
+ (finally_branch)
26
+ (do_block)
27
+ (call
28
+ (argument_list
29
+ (statement_list)))
30
+ (proc_declaration)
31
+ (func_declaration)
32
+ (method_declaration)
33
+ (iterator_declaration)
34
+ (converter_declaration)
35
+ (template_declaration)
36
+ (macro_declaration)
37
+ (proc_expression)
38
+ (func_expression)
39
+ (iterator_expression)
40
+ (concept_declaration)
41
+ ] @fold
@@ -0,0 +1,186 @@
1
+ ; SPDX-FileCopyrightText: 2023 Leorize <leorize+oss@disroot.org>
2
+ ; SPDX-License-Identifier: MPL-2.0
3
+
4
+ ; Punctuations
5
+ [ "." ";" "," ":" ] @punctuation.delimiter
6
+ [ "(" ")" "[" "]" "{" "}" "{." ".}" ] @punctuation.bracket
7
+
8
+ ; Operator by default, but could be overriden
9
+ [ "=" ] @operator
10
+
11
+ ; Special
12
+ (blank_identifier) @variable.builtin
13
+
14
+ ; Calls
15
+ (call
16
+ function: [
17
+ (identifier) @function.call
18
+ (dot_expression
19
+ right: (identifier) @function.call)
20
+ ])
21
+ (generalized_string
22
+ function: [
23
+ (identifier) @function.call
24
+ (dot_expression
25
+ right: (identifier) @function.call)
26
+ ])
27
+
28
+ ; Declarations
29
+ (exported_symbol "*" @type.qualifier)
30
+ (_ "=" @punctuation.delimiter [body: (_) value: (_)])
31
+ (proc_declaration name: (_) @function)
32
+ (func_declaration name: (_) @function)
33
+ (converter_declaration name: (_) @function)
34
+ (method_declaration name: (_) @method)
35
+ (template_declaration name: (_) @function.macro)
36
+ (macro_declaration name: (_) @function.macro)
37
+ (symbol_declaration name: (_) @variable)
38
+ (parameter_declaration
39
+ (symbol_declaration_list
40
+ (symbol_declaration name: (_) @parameter)))
41
+ (_
42
+ [
43
+ type: [
44
+ (type_expression (identifier))
45
+ (type_expression (accent_quoted (identifier)))
46
+ ] @type
47
+ return_type: [
48
+ (type_expression (identifier))
49
+ (type_expression (accent_quoted (identifier)))
50
+ ] @type
51
+ ])
52
+
53
+ ; Exceptions
54
+ [
55
+ "try"
56
+ "except"
57
+ "finally"
58
+ "raise"
59
+ ] @exception
60
+
61
+ (except_branch values: (expression_list
62
+ [
63
+ (identifier) @type
64
+ (infix_expression
65
+ left: (identifier) @type
66
+ operator: "as"
67
+ right: (identifier) @variable)
68
+ ]))
69
+
70
+ ; Expressions
71
+ (dot_expression
72
+ right: (identifier) @field)
73
+
74
+ ; Literal/comments
75
+ [
76
+ (comment)
77
+ (block_comment)
78
+ ] @comment
79
+
80
+ [
81
+ (documentation_comment)
82
+ (block_documentation_comment)
83
+ ] @comment.documentation
84
+
85
+ (interpreted_string_literal) @string
86
+ (long_string_literal) @string
87
+ (raw_string_literal) @string
88
+ (generalized_string) @string
89
+ (char_literal) @character
90
+ (escape_sequence) @string.escape
91
+ (integer_literal) @number
92
+ (float_literal) @float
93
+ (custom_numeric_literal) @number
94
+ (nil_literal) @constant.builtin
95
+
96
+ ; Keyword
97
+ [
98
+ "if"
99
+ "when"
100
+ "case"
101
+ "elif"
102
+ "else"
103
+ ] @conditional
104
+
105
+ (of_branch "of" @conditional)
106
+
107
+ [
108
+ "import"
109
+ "include"
110
+ "export"
111
+ ] @include
112
+
113
+ (import_from_statement "from" @include)
114
+ (except_clause "except" @include)
115
+
116
+ [
117
+ "for"
118
+ "while"
119
+ "continue"
120
+ "break"
121
+ ] @repeat
122
+
123
+ (for "in" @repeat)
124
+
125
+ [
126
+ "macro"
127
+ "template"
128
+ "const"
129
+ "let"
130
+ "var"
131
+ "asm"
132
+ "bind"
133
+ "block"
134
+ "concept"
135
+ "defer"
136
+ "discard"
137
+ "distinct"
138
+ "do"
139
+ "enum"
140
+ "mixin"
141
+ "nil"
142
+ "object"
143
+ "out"
144
+ "ptr"
145
+ "ref"
146
+ "static"
147
+ "tuple"
148
+ "type"
149
+ ] @keyword
150
+
151
+ [
152
+ "proc"
153
+ "func"
154
+ "method"
155
+ "converter"
156
+ "iterator"
157
+ ] @keyword.function
158
+
159
+ [
160
+ "and"
161
+ "or"
162
+ "xor"
163
+ "not"
164
+ "div"
165
+ "mod"
166
+ "shl"
167
+ "shr"
168
+ "from"
169
+ "as"
170
+ "of"
171
+ "in"
172
+ "notin"
173
+ "is"
174
+ "isnot"
175
+ "cast"
176
+ ] @keyword.operator
177
+
178
+ [
179
+ "return"
180
+ "yield"
181
+ ] @keyword.return
182
+
183
+ ; Operators
184
+ (infix_expression operator: _ @operator)
185
+ (prefix_expression operator: _ @operator)
186
+
@@ -0,0 +1,79 @@
1
+ ; =============================================================================
2
+ ; generalized_strings
3
+ ; regex in generalized_strings
4
+ (generalized_string
5
+ function: (identifier) @_string_prefix
6
+ .
7
+ (string_content) @injection.content
8
+ (#set! injection.language "regex")
9
+ (#any-of? @_string_prefix "re" "rex"))
10
+
11
+ ; format string in generalized_strings
12
+ (generalized_string
13
+ function: (identifier) @_string_prefix
14
+ .
15
+ (string_content) @injection.content
16
+ (#set! injection.language "nim_format_string")
17
+ (#eq? @_string_prefix "fmt"))
18
+
19
+ ; format string in normal strings with & prefix
20
+ (prefix_expression
21
+ operator: (operator) @_string_prefix
22
+ .
23
+ (_
24
+ (string_content) @injection.content)
25
+ (#set! injection.language "nim_format_string")
26
+ (#eq? @_string_prefix "&"))
27
+
28
+ ; sql in generalized_strings
29
+ ; and anything you like as long as the function name is the same as the injected language's parser
30
+ (generalized_string
31
+ function: (identifier) @injection.language
32
+ (string_content) @injection.content
33
+ (#not-any-of? @injection.language "re" "rex" "fmt"))
34
+
35
+ ; =============================================================================
36
+ ; emit pragma
37
+ ; C / CPP / OBJC / JAVASCRIPT
38
+ ; a `#<no whitespace><language name>`
39
+ ; has to directly precede the {.emit: "<language code>".} pragma
40
+ ; eg.:
41
+ ; #objc
42
+ ; {.emit: "<objc code>".}
43
+ ; OR
44
+ ; #javascript
45
+ ; {.emit: "<javascript code>".}
46
+ ; normal strings
47
+ ((comment
48
+ (comment_content) @injection.language)
49
+ .
50
+ (pragma_statement
51
+ (pragma_list
52
+ (colon_expression
53
+ left: (identifier) @_emit_keyword
54
+ (#eq? @_emit_keyword "emit")
55
+ right: (_
56
+ (string_content) @injection.content)))))
57
+
58
+ ; =============================================================================
59
+ ; asm statement
60
+ ; works same as emit pragma, needs preceding comment with language name
61
+ ((comment
62
+ (comment_content) @injection.language)
63
+ .
64
+ (assembly_statement
65
+ (_
66
+ (string_content) @injection.content)))
67
+
68
+ ; =============================================================================
69
+ ; comments
70
+ ; NOTE: ts "comment" parser heavily impacts performance
71
+ ; markdown parser in documentation_comment
72
+ (documentation_comment
73
+ (comment_content) @injection.content
74
+ (#set! injection.language "markdown_inline"))
75
+
76
+ ; markdown parser in block_documentation_comment
77
+ (block_documentation_comment
78
+ (comment_content) @injection.content
79
+ (#set! injection.language "markdown"))