tm-grammars 0.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 (181) hide show
  1. package/LICENSE +22 -0
  2. package/NOTICE +6565 -0
  3. package/README.md +211 -0
  4. package/grammars/abap.json +380 -0
  5. package/grammars/actionscript-3.json +951 -0
  6. package/grammars/ada.json +3874 -0
  7. package/grammars/apache.json +562 -0
  8. package/grammars/apex.json +3203 -0
  9. package/grammars/apl.json +1479 -0
  10. package/grammars/applescript.json +1406 -0
  11. package/grammars/ara.json +428 -0
  12. package/grammars/asm.json +1741 -0
  13. package/grammars/astro.json +776 -0
  14. package/grammars/awk.json +388 -0
  15. package/grammars/ballerina.json +3768 -0
  16. package/grammars/bat.json +783 -0
  17. package/grammars/beancount.json +831 -0
  18. package/grammars/berry.json +172 -0
  19. package/grammars/bibtex.json +315 -0
  20. package/grammars/bicep.json +239 -0
  21. package/grammars/blade.json +3870 -0
  22. package/grammars/c.json +3552 -0
  23. package/grammars/cadence.json +738 -0
  24. package/grammars/clarity.json +877 -0
  25. package/grammars/clojure.json +426 -0
  26. package/grammars/cmake.json +143 -0
  27. package/grammars/cobol.json +1124 -0
  28. package/grammars/codeql.json +1540 -0
  29. package/grammars/coffee.json +1311 -0
  30. package/grammars/cpp-macro.json +9498 -0
  31. package/grammars/cpp.json +16635 -0
  32. package/grammars/crystal.json +1866 -0
  33. package/grammars/csharp.json +5722 -0
  34. package/grammars/css.json +1860 -0
  35. package/grammars/csv.json +46 -0
  36. package/grammars/cue.json +1128 -0
  37. package/grammars/cypher.json +353 -0
  38. package/grammars/d.json +3185 -0
  39. package/grammars/dart.json +522 -0
  40. package/grammars/dax.json +185 -0
  41. package/grammars/diff.json +155 -0
  42. package/grammars/docker.json +97 -0
  43. package/grammars/dream-maker.json +640 -0
  44. package/grammars/elixir.json +1014 -0
  45. package/grammars/elm.json +751 -0
  46. package/grammars/erb.json +156 -0
  47. package/grammars/erlang.json +1757 -0
  48. package/grammars/fish.json +189 -0
  49. package/grammars/fsharp.json +1831 -0
  50. package/grammars/gdresource.json +290 -0
  51. package/grammars/gdscript.json +969 -0
  52. package/grammars/gdshader.json +405 -0
  53. package/grammars/gherkin.json +133 -0
  54. package/grammars/git-commit.json +85 -0
  55. package/grammars/git-rebase.json +56 -0
  56. package/grammars/glimmer-js.json +98 -0
  57. package/grammars/glimmer-ts.json +98 -0
  58. package/grammars/glsl.json +57 -0
  59. package/grammars/gnuplot.json +892 -0
  60. package/grammars/go.json +1012 -0
  61. package/grammars/graphql.json +1295 -0
  62. package/grammars/groovy.json +1378 -0
  63. package/grammars/hack.json +2650 -0
  64. package/grammars/haml.json +598 -0
  65. package/grammars/handlebars.json +848 -0
  66. package/grammars/haskell.json +2431 -0
  67. package/grammars/hcl.json +787 -0
  68. package/grammars/hjson.json +821 -0
  69. package/grammars/hlsl.json +212 -0
  70. package/grammars/html.json +93 -0
  71. package/grammars/imba.json +2696 -0
  72. package/grammars/ini.json +108 -0
  73. package/grammars/java.json +1885 -0
  74. package/grammars/javascript.json +5984 -0
  75. package/grammars/jinja-html.json +16 -0
  76. package/grammars/jinja.json +345 -0
  77. package/grammars/jison.json +715 -0
  78. package/grammars/jsdoc.json +21 -0
  79. package/grammars/json.json +208 -0
  80. package/grammars/json5.json +244 -0
  81. package/grammars/jsonc.json +208 -0
  82. package/grammars/jsonl.json +208 -0
  83. package/grammars/jsonnet.json +211 -0
  84. package/grammars/jssm.json +159 -0
  85. package/grammars/jsx.json +5984 -0
  86. package/grammars/julia.json +1061 -0
  87. package/grammars/kotlin.json +580 -0
  88. package/grammars/kusto.json +687 -0
  89. package/grammars/latex.json +2395 -0
  90. package/grammars/less.json +5012 -0
  91. package/grammars/liquid.json +990 -0
  92. package/grammars/lisp.json +121 -0
  93. package/grammars/logo.json +55 -0
  94. package/grammars/lua.json +956 -0
  95. package/grammars/make.json +629 -0
  96. package/grammars/markdown.json +3066 -0
  97. package/grammars/marko.json +1344 -0
  98. package/grammars/matlab.json +1131 -0
  99. package/grammars/mdc.json +571 -0
  100. package/grammars/mdx.json +5629 -0
  101. package/grammars/mermaid.json +1382 -0
  102. package/grammars/mojo.json +4153 -0
  103. package/grammars/narrat.json +227 -0
  104. package/grammars/nextflow.json +298 -0
  105. package/grammars/nginx.json +2121 -0
  106. package/grammars/nim.json +1522 -0
  107. package/grammars/nix.json +1200 -0
  108. package/grammars/nushell.json +1047 -0
  109. package/grammars/objective-c.json +3750 -0
  110. package/grammars/objective-cpp.json +7242 -0
  111. package/grammars/ocaml.json +2967 -0
  112. package/grammars/pascal.json +154 -0
  113. package/grammars/perl.json +2971 -0
  114. package/grammars/php.json +4024 -0
  115. package/grammars/plsql.json +241 -0
  116. package/grammars/postcss.json +377 -0
  117. package/grammars/powerquery.json +349 -0
  118. package/grammars/powershell.json +1024 -0
  119. package/grammars/prisma.json +443 -0
  120. package/grammars/prolog.json +298 -0
  121. package/grammars/proto.json +507 -0
  122. package/grammars/pug.json +1033 -0
  123. package/grammars/puppet.json +777 -0
  124. package/grammars/purescript.json +871 -0
  125. package/grammars/python.json +4208 -0
  126. package/grammars/r.json +637 -0
  127. package/grammars/raku.json +310 -0
  128. package/grammars/razor.json +1813 -0
  129. package/grammars/reg.json +136 -0
  130. package/grammars/rel.json +200 -0
  131. package/grammars/riscv.json +298 -0
  132. package/grammars/rst.json +734 -0
  133. package/grammars/ruby.json +2769 -0
  134. package/grammars/rust.json +1171 -0
  135. package/grammars/sas.json +302 -0
  136. package/grammars/sass.json +618 -0
  137. package/grammars/scala.json +1313 -0
  138. package/grammars/scheme.json +384 -0
  139. package/grammars/scss.json +1874 -0
  140. package/grammars/shaderlab.json +199 -0
  141. package/grammars/shellscript.json +2025 -0
  142. package/grammars/shellsession.json +33 -0
  143. package/grammars/smalltalk.json +235 -0
  144. package/grammars/solidity.json +1210 -0
  145. package/grammars/sparql.json +45 -0
  146. package/grammars/splunk.json +91 -0
  147. package/grammars/sql.json +631 -0
  148. package/grammars/ssh-config.json +88 -0
  149. package/grammars/stata.json +3050 -0
  150. package/grammars/stylus.json +1208 -0
  151. package/grammars/svelte.json +1171 -0
  152. package/grammars/swift.json +4203 -0
  153. package/grammars/system-verilog.json +1063 -0
  154. package/grammars/tasl.json +292 -0
  155. package/grammars/tcl.json +291 -0
  156. package/grammars/tex.json +281 -0
  157. package/grammars/toml.json +431 -0
  158. package/grammars/tsx.json +5984 -0
  159. package/grammars/turtle.json +261 -0
  160. package/grammars/twig.json +1394 -0
  161. package/grammars/typescript.json +5735 -0
  162. package/grammars/v.json +1001 -0
  163. package/grammars/vb.json +232 -0
  164. package/grammars/verilog.json +305 -0
  165. package/grammars/vhdl.json +1484 -0
  166. package/grammars/viml.json +445 -0
  167. package/grammars/vue-html.json +559 -0
  168. package/grammars/vue.json +1237 -0
  169. package/grammars/vyper.json +5415 -0
  170. package/grammars/wasm.json +831 -0
  171. package/grammars/wenyan.json +129 -0
  172. package/grammars/wgsl.json +391 -0
  173. package/grammars/wolfram.json +2370 -0
  174. package/grammars/xml.json +382 -0
  175. package/grammars/xsl.json +89 -0
  176. package/grammars/yaml.json +616 -0
  177. package/grammars/zenscript.json +257 -0
  178. package/grammars/zig.json +312 -0
  179. package/index.d.ts +18 -0
  180. package/index.js +2165 -0
  181. package/package.json +46 -0
@@ -0,0 +1,831 @@
1
+ {
2
+ "displayName": "WebAssembly",
3
+ "name": "wasm",
4
+ "patterns": [
5
+ {
6
+ "include": "#comments"
7
+ },
8
+ {
9
+ "include": "#strings"
10
+ },
11
+ {
12
+ "include": "#instructions"
13
+ },
14
+ {
15
+ "include": "#types"
16
+ },
17
+ {
18
+ "include": "#modules"
19
+ },
20
+ {
21
+ "include": "#constants"
22
+ },
23
+ {
24
+ "include": "#invalid"
25
+ }
26
+ ],
27
+ "repository": {
28
+ "comments": {
29
+ "patterns": [
30
+ {
31
+ "captures": {
32
+ "1": {
33
+ "name": "punctuation.definition.comment.wat"
34
+ }
35
+ },
36
+ "comment": "Line comment",
37
+ "match": "(;;).*$",
38
+ "name": "comment.line.wat"
39
+ },
40
+ {
41
+ "begin": "\\(;",
42
+ "beginCaptures": {
43
+ "0": {
44
+ "name": "punctuation.definition.comment.wat"
45
+ }
46
+ },
47
+ "comment": "Block comment",
48
+ "end": ";\\)",
49
+ "endCaptures": {
50
+ "0": {
51
+ "name": "punctuation.definition.comment.wat"
52
+ }
53
+ },
54
+ "name": "comment.block.wat"
55
+ }
56
+ ]
57
+ },
58
+ "constants": {
59
+ "patterns": [
60
+ {
61
+ "comment": "Fixed-width SIMD",
62
+ "patterns": [
63
+ {
64
+ "captures": {
65
+ "1": {
66
+ "name": "support.type.wat"
67
+ }
68
+ },
69
+ "comment": "Vector literal (i8x16) [simd]",
70
+ "match": "\\b(i8x16)(?:\\s+0x[0-9a-fA-F]{1,2}){16}\\b",
71
+ "name": "constant.numeric.vector.wat"
72
+ },
73
+ {
74
+ "captures": {
75
+ "1": {
76
+ "name": "support.type.wat"
77
+ }
78
+ },
79
+ "comment": "Vector literal (i16x8) [simd]",
80
+ "match": "\\b(i16x8)(?:\\s+0x[0-9a-fA-F]{1,4}){8}\\b",
81
+ "name": "constant.numeric.vector.wat"
82
+ },
83
+ {
84
+ "captures": {
85
+ "1": {
86
+ "name": "support.type.wat"
87
+ }
88
+ },
89
+ "comment": "Vector literal (i32x4) [simd]",
90
+ "match": "\\b(i32x4)(?:\\s+0x[0-9a-fA-F]{1,8}){4}\\b",
91
+ "name": "constant.numeric.vector.wat"
92
+ },
93
+ {
94
+ "captures": {
95
+ "1": {
96
+ "name": "support.type.wat"
97
+ }
98
+ },
99
+ "comment": "Vector literal (i64x2) [simd]",
100
+ "match": "\\b(i64x2)(?:\\s+0x[0-9a-fA-F]{1,16}){2}\\b",
101
+ "name": "constant.numeric.vector.wat"
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ "comment": "MVP",
107
+ "patterns": [
108
+ {
109
+ "comment": "Floating point literal",
110
+ "match": "[+-]?\\b[0-9][0-9]*(?:\\.[0-9][0-9]*)?(?:[eE][+-]?[0-9]+)?\\b",
111
+ "name": "constant.numeric.float.wat"
112
+ },
113
+ {
114
+ "comment": "Floating point hexadecimal literal",
115
+ "match": "[+-]?\\b0x([0-9a-fA-F]*\\.[0-9a-fA-F]+|[0-9a-fA-F]+\\.?)[Pp][+-]?[0-9]+\\b",
116
+ "name": "constant.numeric.float.wat"
117
+ },
118
+ {
119
+ "comment": "Floating point infinity",
120
+ "match": "[+-]?\\binf\\b",
121
+ "name": "constant.numeric.float.wat"
122
+ },
123
+ {
124
+ "comment": "Floating point literal (NaN)",
125
+ "match": "[+-]?\\bnan:0x[0-9a-fA-F][0-9a-fA-F]*\\b",
126
+ "name": "constant.numeric.float.wat"
127
+ },
128
+ {
129
+ "comment": "Integer literal",
130
+ "match": "[+-]?\\b(?:0x[0-9a-fA-F][0-9a-fA-F]*|\\d[\\d]*)\\b",
131
+ "name": "constant.numeric.integer.wat"
132
+ }
133
+ ]
134
+ }
135
+ ]
136
+ },
137
+ "instructions": {
138
+ "patterns": [
139
+ {
140
+ "comment": "Non-trapping float-to-int conversions",
141
+ "patterns": [
142
+ {
143
+ "captures": {
144
+ "1": {
145
+ "name": "support.class.wat"
146
+ }
147
+ },
148
+ "comment": "Conversion instruction [nontrapping-float-to-int-conversions]",
149
+ "match": "\\b(i32|i64)\\.trunc_sat_f(?:32|64)_[su]\\b",
150
+ "name": "keyword.operator.word.wat"
151
+ }
152
+ ]
153
+ },
154
+ {
155
+ "comment": "Sign-extension operators",
156
+ "patterns": [
157
+ {
158
+ "captures": {
159
+ "1": {
160
+ "name": "support.class.wat"
161
+ }
162
+ },
163
+ "comment": "Numeric instruction (i32) [sign-extension-ops]",
164
+ "match": "\\b(i32)\\.(?:extend(?:8|16)_s)\\b",
165
+ "name": "keyword.operator.word.wat"
166
+ },
167
+ {
168
+ "captures": {
169
+ "1": {
170
+ "name": "support.class.wat"
171
+ }
172
+ },
173
+ "comment": "Numeric instruction (i64) [sign-extension-ops]",
174
+ "match": "\\b(i64)\\.(?:extend(?:8|16|32)_s)\\b",
175
+ "name": "keyword.operator.word.wat"
176
+ }
177
+ ]
178
+ },
179
+ {
180
+ "comment": "Bulk memory operations",
181
+ "patterns": [
182
+ {
183
+ "captures": {
184
+ "1": {
185
+ "name": "support.class.wat"
186
+ }
187
+ },
188
+ "comment": "Memory instruction [bulk-memory-operations]",
189
+ "match": "\\b(memory)\\.(?:copy|fill|init|drop)\\b",
190
+ "name": "keyword.operator.word.wat"
191
+ }
192
+ ]
193
+ },
194
+ {
195
+ "comment": "Fixed-width SIMD",
196
+ "patterns": [
197
+ {
198
+ "captures": {
199
+ "1": {
200
+ "name": "support.class.wat"
201
+ }
202
+ },
203
+ "comment": "Vector instruction (v128) [simd]",
204
+ "match": "\\b(v128)\\.(?:const|and|or|xor|not|andnot|bitselect|load|store)\\b",
205
+ "name": "keyword.operator.word.wat"
206
+ },
207
+ {
208
+ "captures": {
209
+ "1": {
210
+ "name": "support.class.wat"
211
+ }
212
+ },
213
+ "comment": "Vector instruction (i8x16) [simd]",
214
+ "match": "\\b(i8x16)\\.(?:shuffle|swizzle|splat|replace_lane|add|sub|mul|neg|shl|shr_[su]|eq|ne|lt_[su]|le_[su]|gt_[su]|ge_[su]|min_[su]|max_[su]|any_true|all_true|extract_lane_[su]|add_saturate_[su]|sub_saturate_[su]|avgr_u|narrow_i16x8_[su])\\b",
215
+ "name": "keyword.operator.word.wat"
216
+ },
217
+ {
218
+ "captures": {
219
+ "1": {
220
+ "name": "support.class.wat"
221
+ }
222
+ },
223
+ "comment": "Vector instruction (i16x8) [simd]",
224
+ "match": "\\b(i16x8)\\.(?:splat|replace_lane|add|sub|mul|neg|shl|shr_[su]|eq|ne|lt_[su]|le_[su]|gt_[su]|ge_[su]|min_[su]|max_[su]|any_true|all_true|extract_lane_[su]|add_saturate_[su]|sub_saturate_[su]|avgr_u|load8x8_[su]|narrow_i32x4_[su]|widen_(low|high)_i8x16_[su])\\b",
225
+ "name": "keyword.operator.word.wat"
226
+ },
227
+ {
228
+ "captures": {
229
+ "1": {
230
+ "name": "support.class.wat"
231
+ }
232
+ },
233
+ "comment": "Vector instruction (i32x4) [simd]",
234
+ "match": "\\b(i32x4)\\.(?:splat|replace_lane|add|sub|mul|neg|shl|shr_[su]|eq|ne|lt_[su]|le_[su]|gt_[su]|ge_[su]|min_[su]|max_[su]|any_true|all_true|extract_lane|load16x4_[su]|trunc_sat_f32x4_[su]|widen_(low|high)_i16x8_[su])\\b",
235
+ "name": "keyword.operator.word.wat"
236
+ },
237
+ {
238
+ "captures": {
239
+ "1": {
240
+ "name": "support.class.wat"
241
+ }
242
+ },
243
+ "comment": "Vector instruction (i64x2) [simd]",
244
+ "match": "\\b(i64x2)\\.(?:splat|replace_lane|add|sub|mul|neg|shl|shr_[su]|extract_lane|load32x2_[su])\\b",
245
+ "name": "keyword.operator.word.wat"
246
+ },
247
+ {
248
+ "captures": {
249
+ "1": {
250
+ "name": "support.class.wat"
251
+ }
252
+ },
253
+ "comment": "Vector instruction (f32x4) [simd]",
254
+ "match": "\\b(f32x4)\\.(?:splat|replace_lane|add|sub|mul|neg|extract_lane|eq|ne|lt|le|gt|ge|abs|min|max|div|sqrt|convert_i32x4_[su])\\b",
255
+ "name": "keyword.operator.word.wat"
256
+ },
257
+ {
258
+ "captures": {
259
+ "1": {
260
+ "name": "support.class.wat"
261
+ }
262
+ },
263
+ "comment": "Vector instruction (f64x2) [simd]",
264
+ "match": "\\b(f64x2)\\.(?:splat|replace_lane|add|sub|mul|neg|extract_lane|eq|ne|lt|le|gt|ge|abs|min|max|div|sqrt)\\b",
265
+ "name": "keyword.operator.word.wat"
266
+ },
267
+ {
268
+ "captures": {
269
+ "1": {
270
+ "name": "support.class.wat"
271
+ }
272
+ },
273
+ "comment": "Vector instruction (v8x16) [simd]",
274
+ "match": "\\b(v8x16)\\.(?:load_splat|shuffle|swizzle)\\b",
275
+ "name": "keyword.operator.word.wat"
276
+ },
277
+ {
278
+ "captures": {
279
+ "1": {
280
+ "name": "support.class.wat"
281
+ }
282
+ },
283
+ "comment": "Vector instruction (v16x8) [simd]",
284
+ "match": "\\b(v16x8)\\.load_splat\\b",
285
+ "name": "keyword.operator.word.wat"
286
+ },
287
+ {
288
+ "captures": {
289
+ "1": {
290
+ "name": "support.class.wat"
291
+ }
292
+ },
293
+ "comment": "Vector instruction (v32x4) [simd]",
294
+ "match": "\\b(v32x4)\\.load_splat\\b",
295
+ "name": "keyword.operator.word.wat"
296
+ },
297
+ {
298
+ "captures": {
299
+ "1": {
300
+ "name": "support.class.wat"
301
+ }
302
+ },
303
+ "comment": "Vector instruction (v64x2) [simd]",
304
+ "match": "\\b(v64x2)\\.load_splat\\b",
305
+ "name": "keyword.operator.word.wat"
306
+ }
307
+ ]
308
+ },
309
+ {
310
+ "comment": "Threads",
311
+ "patterns": [
312
+ {
313
+ "captures": {
314
+ "1": {
315
+ "name": "support.class.wat"
316
+ },
317
+ "2": {
318
+ "name": "support.class.wat"
319
+ },
320
+ "3": {
321
+ "name": "support.class.wat"
322
+ },
323
+ "4": {
324
+ "name": "support.class.wat"
325
+ }
326
+ },
327
+ "comment": "Atomic instruction (i32) [threads]",
328
+ "match": "\\b(i32)\\.(atomic)\\.(?:load(?:8_u|16_u)?|store(?:8|16)?|wait|(rmw)\\.(?:add|sub|and|or|xor|xchg|cmpxchg)|(rmw8|rmw16)\\.(?:add_u|sub_u|and_u|or_u|xor_u|xchg_u|cmpxchg_u))\\b",
329
+ "name": "keyword.operator.word.wat"
330
+ },
331
+ {
332
+ "captures": {
333
+ "1": {
334
+ "name": "support.class.wat"
335
+ },
336
+ "2": {
337
+ "name": "support.class.wat"
338
+ },
339
+ "3": {
340
+ "name": "support.class.wat"
341
+ },
342
+ "4": {
343
+ "name": "support.class.wat"
344
+ }
345
+ },
346
+ "comment": "Atomic instruction (i64) [threads]",
347
+ "match": "\\b(i64)\\.(atomic)\\.(?:load(?:8_u|16_u|32_u)?|store(?:8|16|32)?|wait|(rmw)\\.(?:add|sub|and|or|xor|xchg|cmpxchg)|(rmw8|rmw16|rmw32)\\.(?:add_u|sub_u|and_u|or_u|xor_u|xchg_u|cmpxchg_u))\\b",
348
+ "name": "keyword.operator.word.wat"
349
+ },
350
+ {
351
+ "captures": {
352
+ "1": {
353
+ "name": "support.class.wat"
354
+ }
355
+ },
356
+ "comment": "Atomic instruction [threads]",
357
+ "match": "\\b(atomic)\\.(?:notify|fence)\\b",
358
+ "name": "keyword.operator.word.wat"
359
+ },
360
+ {
361
+ "comment": "Shared modifier [threads]",
362
+ "match": "\\bshared\\b",
363
+ "name": "storage.modifier.wat"
364
+ }
365
+ ]
366
+ },
367
+ {
368
+ "comment": "Reference types",
369
+ "patterns": [
370
+ {
371
+ "captures": {
372
+ "1": {
373
+ "name": "support.class.wat"
374
+ }
375
+ },
376
+ "comment": "Reference instruction [reference-types]",
377
+ "match": "\\b(ref)\\.(?:null|is_null|func|extern)\\b",
378
+ "name": "keyword.operator.word.wat"
379
+ },
380
+ {
381
+ "captures": {
382
+ "1": {
383
+ "name": "support.class.wat"
384
+ }
385
+ },
386
+ "comment": "Table instruction [reference-types]",
387
+ "match": "\\b(table)\\.(?:get|size|grow|fill|init|copy)\\b",
388
+ "name": "keyword.operator.word.wat"
389
+ },
390
+ {
391
+ "comment": "Type name [reference-types]",
392
+ "match": "\\b(?:externref|funcref|nullref)\\b",
393
+ "name": "entity.name.type.wat"
394
+ }
395
+ ]
396
+ },
397
+ {
398
+ "comment": "Tail Call",
399
+ "patterns": [
400
+ {
401
+ "comment": "Control instruction [tail-call]",
402
+ "match": "\\breturn_call(?:_indirect)?\\b",
403
+ "name": "keyword.control.wat"
404
+ }
405
+ ]
406
+ },
407
+ {
408
+ "comment": "Exception handling",
409
+ "patterns": [
410
+ {
411
+ "comment": "Control instruction [exception-handling]",
412
+ "match": "\\b(?:try|catch|throw|rethrow|br_on_exn)\\b",
413
+ "name": "keyword.control.wat"
414
+ },
415
+ {
416
+ "comment": "Module element [exception-handling]",
417
+ "match": "(?<=\\()event\\b",
418
+ "name": "storage.type.wat"
419
+ }
420
+ ]
421
+ },
422
+ {
423
+ "comment": "Binaryen extensions",
424
+ "patterns": [
425
+ {
426
+ "captures": {
427
+ "1": {
428
+ "name": "support.class.wat"
429
+ }
430
+ },
431
+ "comment": "Pseudo stack instruction [binaryen]",
432
+ "match": "\\b(i32|i64|f32|f64|externref|funcref|nullref|exnref)\\.(?:push|pop)\\b",
433
+ "name": "keyword.operator.word.wat"
434
+ }
435
+ ]
436
+ },
437
+ {
438
+ "comment": "MVP",
439
+ "patterns": [
440
+ {
441
+ "captures": {
442
+ "1": {
443
+ "name": "support.class.type.wat"
444
+ }
445
+ },
446
+ "comment": "Memory instruction (i32) [mvp]",
447
+ "match": "\\b(i32)\\.(?:load|load(?:8|16)(?:_[su])?|store(?:8|16)?)\\b",
448
+ "name": "keyword.operator.word.wat"
449
+ },
450
+ {
451
+ "captures": {
452
+ "1": {
453
+ "name": "support.class.type.wat"
454
+ }
455
+ },
456
+ "comment": "Memory instruction (i64) [mvp]",
457
+ "match": "\\b(i64)\\.(?:load|load(?:8|16|32)(?:_[su])?|store(?:8|16|32)?)\\b",
458
+ "name": "keyword.operator.word.wat"
459
+ },
460
+ {
461
+ "captures": {
462
+ "1": {
463
+ "name": "support.class.type.wat"
464
+ }
465
+ },
466
+ "comment": "Memory instruction (f32/f64) [mvp]",
467
+ "match": "\\b(f32|f64)\\.(?:load|store)\\b",
468
+ "name": "keyword.operator.word.wat"
469
+ },
470
+ {
471
+ "captures": {
472
+ "1": {
473
+ "name": "support.class.memory.wat"
474
+ }
475
+ },
476
+ "comment": "Memory instruction [mvp]",
477
+ "match": "\\b(memory)\\.(?:size|grow)\\b",
478
+ "name": "keyword.operator.word.wat"
479
+ },
480
+ {
481
+ "captures": {
482
+ "1": {
483
+ "name": "entity.other.attribute-name.wat"
484
+ }
485
+ },
486
+ "comment": "Memory instruction attribute [mvp]",
487
+ "match": "\\b(offset|align)=\\b"
488
+ },
489
+ {
490
+ "captures": {
491
+ "1": {
492
+ "name": "support.class.local.wat"
493
+ }
494
+ },
495
+ "comment": "Variable instruction (local) [mvp]",
496
+ "match": "\\b(local)\\.(?:get|set|tee)\\b",
497
+ "name": "keyword.operator.word.wat"
498
+ },
499
+ {
500
+ "captures": {
501
+ "1": {
502
+ "name": "support.class.global.wat"
503
+ }
504
+ },
505
+ "comment": "Variable instruction (global) [mvp]",
506
+ "match": "\\b(global)\\.(?:get|set)\\b",
507
+ "name": "keyword.operator.word.wat"
508
+ },
509
+ {
510
+ "captures": {
511
+ "1": {
512
+ "name": "support.class.type.wat"
513
+ }
514
+ },
515
+ "comment": "Numeric instruction (i32/i64) [mvp]",
516
+ "match": "\\b(i32|i64)\\.(const|eqz|eq|ne|lt_[su]|gt_[su]|le_[su]|ge_[su]|clz|ctz|popcnt|add|sub|mul|div_[su]|rem_[su]|and|or|xor|shl|shr_[su]|rotl|rotr)\\b",
517
+ "name": "keyword.operator.word.wat"
518
+ },
519
+ {
520
+ "captures": {
521
+ "1": {
522
+ "name": "support.class.type.wat"
523
+ }
524
+ },
525
+ "comment": "Numeric instruction (f32/f64) [mvp]",
526
+ "match": "\\b(f32|f64)\\.(const|eq|ne|lt|gt|le|ge|abs|neg|ceil|floor|trunc|nearest|sqrt|add|sub|mul|div|min|max|copysign)\\b",
527
+ "name": "keyword.operator.word.wat"
528
+ },
529
+ {
530
+ "captures": {
531
+ "1": {
532
+ "name": "support.class.type.wat"
533
+ }
534
+ },
535
+ "comment": "Conversion instruction (i32) [mvp]",
536
+ "match": "\\b(i32)\\.(wrap_i64|trunc_(f32|f64)_[su]|reinterpret_f32)\\b",
537
+ "name": "keyword.operator.word.wat"
538
+ },
539
+ {
540
+ "captures": {
541
+ "1": {
542
+ "name": "support.class.type.wat"
543
+ }
544
+ },
545
+ "comment": "Conversion instruction (i64) [mvp]",
546
+ "match": "\\b(i64)\\.(extend_i32_[su]|trunc_f(32|64)_[su]|reinterpret_f64)\\b",
547
+ "name": "keyword.operator.word.wat"
548
+ },
549
+ {
550
+ "captures": {
551
+ "1": {
552
+ "name": "support.class.type.wat"
553
+ }
554
+ },
555
+ "comment": "Conversion instruction (f32) [mvp]",
556
+ "match": "\\b(f32)\\.(convert_i(32|64)_[su]|demote_f64|reinterpret_i32)\\b",
557
+ "name": "keyword.operator.word.wat"
558
+ },
559
+ {
560
+ "captures": {
561
+ "1": {
562
+ "name": "support.class.type.wat"
563
+ }
564
+ },
565
+ "comment": "Conversion instruction (f64) [mvp]",
566
+ "match": "\\b(f64)\\.(convert_i(32|64)_[su]|promote_f32|reinterpret_i64)\\b",
567
+ "name": "keyword.operator.word.wat"
568
+ },
569
+ {
570
+ "comment": "Control instruction [mvp]",
571
+ "match": "\\b(?:unreachable|nop|block|loop|if|then|else|end|br|br_if|br_table|return|call|call_indirect)\\b",
572
+ "name": "keyword.control.wat"
573
+ },
574
+ {
575
+ "comment": "Parametric instruction [mvp]",
576
+ "match": "\\b(?:drop|select)\\b",
577
+ "name": "keyword.operator.word.wat"
578
+ }
579
+ ]
580
+ },
581
+ {
582
+ "comment": "GC Instructions",
583
+ "patterns": [
584
+ {
585
+ "captures": {
586
+ "1": {
587
+ "name": "support.class.wat"
588
+ }
589
+ },
590
+ "comment": "Reference Instructions [GC]",
591
+ "match": "\\b(ref)\\.(?:eq|test|cast)\\b",
592
+ "name": "keyword.operator.word.wat"
593
+ },
594
+ {
595
+ "captures": {
596
+ "1": {
597
+ "name": "support.class.wat"
598
+ }
599
+ },
600
+ "comment": "Struct Instructions [GC]",
601
+ "match": "\\b(struct)\\.(?:new_canon|new_canon_default|get|get_s|get_u|set)\\b",
602
+ "name": "keyword.operator.word.wat"
603
+ },
604
+ {
605
+ "captures": {
606
+ "1": {
607
+ "name": "support.class.wat"
608
+ }
609
+ },
610
+ "comment": "Array Instructions [GC]",
611
+ "match": "\\b(array)\\.(?:new_canon|new_canon_default|get|get_s|get_u|set|len|new_canon_fixed|new_canon_data|new_canon_elem)\\b",
612
+ "name": "keyword.operator.word.wat"
613
+ },
614
+ {
615
+ "captures": {
616
+ "1": {
617
+ "name": "support.class.wat"
618
+ }
619
+ },
620
+ "comment": "i31 Instructions [GC]",
621
+ "match": "\\b(i31)\\.(?:new|get_s|get_u)\\b",
622
+ "name": "keyword.operator.word.wat"
623
+ },
624
+ {
625
+ "captures": {
626
+ "1": {
627
+ "name": "support.class.wat"
628
+ }
629
+ },
630
+ "comment": "Branch Instructions [GC]",
631
+ "match": "\\b(?:br_on_non_null|br_on_cast|br_on_cast_fail)\\b",
632
+ "name": "keyword.operator.word.wat"
633
+ },
634
+ {
635
+ "captures": {
636
+ "1": {
637
+ "name": "support.class.wat"
638
+ }
639
+ },
640
+ "comment": "Reference Instructions [GC]",
641
+ "match": "\\b(extern)\\.(?:internalize|externalize)\\b",
642
+ "name": "keyword.operator.word.wat"
643
+ }
644
+ ]
645
+ }
646
+ ]
647
+ },
648
+ "invalid": {
649
+ "patterns": [
650
+ {
651
+ "match": "[^\\s()]+",
652
+ "name": "invalid.wat"
653
+ }
654
+ ]
655
+ },
656
+ "modules": {
657
+ "patterns": [
658
+ {
659
+ "comment": "Bulk memory operations",
660
+ "patterns": [
661
+ {
662
+ "captures": {
663
+ "1": {
664
+ "name": "storage.modifier.wat"
665
+ }
666
+ },
667
+ "comment": "Passive modifier [bulk-memory-operations]",
668
+ "match": "(?<=\\(data)\\s+(passive)\\b"
669
+ }
670
+ ]
671
+ },
672
+ {
673
+ "comment": "MVP",
674
+ "patterns": [
675
+ {
676
+ "comment": "Module element [mvp]",
677
+ "match": "(?<=\\()(?:module|import|export|memory|data|table|elem|start|func|type|param|result|global|local)\\b",
678
+ "name": "storage.type.wat"
679
+ },
680
+ {
681
+ "captures": {
682
+ "1": {
683
+ "name": "storage.modifier.wat"
684
+ }
685
+ },
686
+ "comment": "Mutable global modifier [mvp]",
687
+ "match": "(?<=\\()\\s*(mut)\\b",
688
+ "name": "storage.modifier.wat"
689
+ },
690
+ {
691
+ "captures": {
692
+ "1": {
693
+ "name": "entity.name.function.wat"
694
+ }
695
+ },
696
+ "comment": "Function name [mvp]",
697
+ "match": "(?<=\\(func|\\(start|call|return_call|ref\\.func)\\s+(\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*)"
698
+ },
699
+ {
700
+ "begin": "\\)\\s+(\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*)",
701
+ "beginCaptures": {
702
+ "1": {
703
+ "name": "entity.name.function.wat"
704
+ }
705
+ },
706
+ "comment": "Function name(s) (elem) [mvp]",
707
+ "end": "\\)",
708
+ "patterns": [
709
+ {
710
+ "match": "(?<=\\s)\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*",
711
+ "name": "entity.name.function.wat"
712
+ }
713
+ ]
714
+ },
715
+ {
716
+ "captures": {
717
+ "1": {
718
+ "name": "support.type.function.wat"
719
+ }
720
+ },
721
+ "comment": "Function type [mvp]",
722
+ "match": "(?<=\\(type)\\s+(\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*)"
723
+ },
724
+ {
725
+ "comment": "Variable name or branch label [mvp]",
726
+ "match": "\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*\\b",
727
+ "name": "variable.other.wat"
728
+ }
729
+ ]
730
+ }
731
+ ]
732
+ },
733
+ "strings": {
734
+ "begin": "\"",
735
+ "beginCaptures": {
736
+ "0": {
737
+ "name": "punctuation.definition.string.begin"
738
+ }
739
+ },
740
+ "comment": "String literal",
741
+ "end": "\"",
742
+ "endCaptures": {
743
+ "0": {
744
+ "name": "punctuation.definition.string.end"
745
+ }
746
+ },
747
+ "name": "string.quoted.double.wat",
748
+ "patterns": [
749
+ {
750
+ "match": "\\\\(n|t|\\\\|'|\"|[0-9a-fA-F]{2})",
751
+ "name": "constant.character.escape.wat"
752
+ }
753
+ ]
754
+ },
755
+ "types": {
756
+ "patterns": [
757
+ {
758
+ "comment": "Fixed-width SIMD",
759
+ "patterns": [
760
+ {
761
+ "comment": "Type name [simd]",
762
+ "match": "\\bv128\\b(?!\\.)",
763
+ "name": "entity.name.type.wat"
764
+ }
765
+ ]
766
+ },
767
+ {
768
+ "comment": "Reference types",
769
+ "patterns": [
770
+ {
771
+ "comment": "Type name [reference-types]",
772
+ "match": "\\b(?:externref|funcref|nullref)\\b(?!\\.)",
773
+ "name": "entity.name.type.wat"
774
+ }
775
+ ]
776
+ },
777
+ {
778
+ "comment": "Exception handling",
779
+ "patterns": [
780
+ {
781
+ "comment": "Type name [exception-handling]",
782
+ "match": "\\bexnref\\b(?!\\.)",
783
+ "name": "entity.name.type.wat"
784
+ }
785
+ ]
786
+ },
787
+ {
788
+ "comment": "MVP",
789
+ "patterns": [
790
+ {
791
+ "comment": "Type name [mvp]",
792
+ "match": "\\b(?:i32|i64|f32|f64)\\b(?!\\.)",
793
+ "name": "entity.name.type.wat"
794
+ }
795
+ ]
796
+ },
797
+ {
798
+ "comment": "GC Types",
799
+ "patterns": [
800
+ {
801
+ "comment": "Type name [GC]",
802
+ "match": "\\b(?:i8|i16|ref|funcref|externref|anyref|eqref|i31ref|nullfuncref|nullexternref|structref|arrayref|nullref)\\b(?!\\.)",
803
+ "name": "entity.name.type.wat"
804
+ }
805
+ ]
806
+ },
807
+ {
808
+ "comment": "GC Heap Types",
809
+ "patterns": [
810
+ {
811
+ "comment": "Type name [GC]",
812
+ "match": "\\b(?:type|func|extern|any|eq|nofunc|noextern|struct|array|none)\\b(?!\\.)",
813
+ "name": "entity.name.type.wat"
814
+ }
815
+ ]
816
+ },
817
+ {
818
+ "comment": "GC Structured and sub Types",
819
+ "patterns": [
820
+ {
821
+ "comment": "Type name [GC]",
822
+ "match": "\\b(?:struct|array|sub|final|rec|field|mut)\\b(?!\\.)",
823
+ "name": "entity.name.type.wat"
824
+ }
825
+ ]
826
+ }
827
+ ]
828
+ }
829
+ },
830
+ "scopeName": "source.wat"
831
+ }