PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.4.0
Code Block Pro – Beautiful Syntax Highlighting v1.4.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / wasm.tmLanguage.json

wasm.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.4.0, at build/shiki/languages/wasm.tmLanguage.json

736 lines 23.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "name": "wasm",
3 "scopeName": "source.wat",
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 "comment": "Line comment",
32 "name": "comment.line.wat",
33 "match": "(;;).*$",
34 "captures": {
35 "1": {
36 "name": "punctuation.definition.comment.wat"
37 }
38 }
39 },
40 {
41 "comment": "Block comment",
42 "name": "comment.block.wat",
43 "begin": "\\(;",
44 "beginCaptures": {
45 "0": {
46 "name": "punctuation.definition.comment.wat"
47 }
48 },
49 "end": ";\\)",
50 "endCaptures": {
51 "0": {
52 "name": "punctuation.definition.comment.wat"
53 }
54 }
55 }
56 ]
57 },
58 "strings": {
59 "comment": "String literal",
60 "name": "string.quoted.double.wat",
61 "begin": "\"",
62 "end": "\"",
63 "beginCaptures": {
64 "0": {
65 "name": "punctuation.definition.string.begin"
66 }
67 },
68 "endCaptures": {
69 "0": {
70 "name": "punctuation.definition.string.end"
71 }
72 },
73 "patterns": [
74 {
75 "name": "constant.character.escape.wat",
76 "match": "\\\\(n|t|\\\\|'|\"|[0-9a-fA-F]{2})"
77 }
78 ]
79 },
80 "instructions": {
81 "patterns": [
82 {
83 "comment": "Non-trapping float-to-int conversions",
84 "patterns": [
85 {
86 "comment": "Conversion instruction [nontrapping-float-to-int-conversions]",
87 "name": "keyword.operator.word.wat",
88 "match": "\\b(i32|i64)\\.trunc_sat_f(?:32|64)_[su]\\b",
89 "captures": {
90 "1": {
91 "name": "support.class.wat"
92 }
93 }
94 }
95 ]
96 },
97 {
98 "comment": "Sign-extension operators",
99 "patterns": [
100 {
101 "comment": "Numeric instruction (i32) [sign-extension-ops]",
102 "name": "keyword.operator.word.wat",
103 "match": "\\b(i32)\\.(?:extend(?:8|16)_s)\\b",
104 "captures": {
105 "1": {
106 "name": "support.class.wat"
107 }
108 }
109 },
110 {
111 "comment": "Numeric instruction (i64) [sign-extension-ops]",
112 "name": "keyword.operator.word.wat",
113 "match": "\\b(i64)\\.(?:extend(?:8|16|32)_s)\\b",
114 "captures": {
115 "1": {
116 "name": "support.class.wat"
117 }
118 }
119 }
120 ]
121 },
122 {
123 "comment": "Bulk memory operations",
124 "patterns": [
125 {
126 "comment": "Memory instruction [bulk-memory-operations]",
127 "name": "keyword.operator.word.wat",
128 "match": "\\b(memory)\\.(?:copy|fill|init|drop)\\b",
129 "captures": {
130 "1": {
131 "name": "support.class.wat"
132 }
133 }
134 }
135 ]
136 },
137 {
138 "comment": "Fixed-width SIMD",
139 "patterns": [
140 {
141 "comment": "Vector instruction (v128) [simd]",
142 "name": "keyword.operator.word.wat",
143 "match": "\\b(v128)\\.(?:const|and|or|xor|not|andnot|bitselect|load|store)\\b",
144 "captures": {
145 "1": {
146 "name": "support.class.wat"
147 }
148 }
149 },
150 {
151 "comment": "Vector instruction (i8x16) [simd]",
152 "name": "keyword.operator.word.wat",
153 "match": "\\b(i8x16)\\.(?: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",
154 "captures": {
155 "1": {
156 "name": "support.class.wat"
157 }
158 }
159 },
160 {
161 "comment": "Vector instruction (i16x8) [simd]",
162 "name": "keyword.operator.word.wat",
163 "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",
164 "captures": {
165 "1": {
166 "name": "support.class.wat"
167 }
168 }
169 },
170 {
171 "comment": "Vector instruction (i32x4) [simd]",
172 "name": "keyword.operator.word.wat",
173 "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",
174 "captures": {
175 "1": {
176 "name": "support.class.wat"
177 }
178 }
179 },
180 {
181 "comment": "Vector instruction (i64x2) [simd]",
182 "name": "keyword.operator.word.wat",
183 "match": "\\b(i64x2)\\.(?:splat|replace_lane|add|sub|mul|neg|shl|shr_[su]|extract_lane|load32x2_[su])\\b",
184 "captures": {
185 "1": {
186 "name": "support.class.wat"
187 }
188 }
189 },
190 {
191 "comment": "Vector instruction (f32x4) [simd]",
192 "name": "keyword.operator.word.wat",
193 "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",
194 "captures": {
195 "1": {
196 "name": "support.class.wat"
197 }
198 }
199 },
200 {
201 "comment": "Vector instruction (f64x2) [simd]",
202 "name": "keyword.operator.word.wat",
203 "match": "\\b(f64x2)\\.(?:splat|replace_lane|add|sub|mul|neg|extract_lane|eq|ne|lt|le|gt|ge|abs|min|max|div|sqrt)\\b",
204 "captures": {
205 "1": {
206 "name": "support.class.wat"
207 }
208 }
209 },
210 {
211 "comment": "Vector instruction (v8x16) [simd]",
212 "name": "keyword.operator.word.wat",
213 "match": "\\b(v8x16)\\.(?:load_splat|shuffle|swizzle)\\b",
214 "captures": {
215 "1": {
216 "name": "support.class.wat"
217 }
218 }
219 },
220 {
221 "comment": "Vector instruction (v16x8) [simd]",
222 "name": "keyword.operator.word.wat",
223 "match": "\\b(v16x8)\\.load_splat\\b",
224 "captures": {
225 "1": {
226 "name": "support.class.wat"
227 }
228 }
229 },
230 {
231 "comment": "Vector instruction (v32x4) [simd]",
232 "name": "keyword.operator.word.wat",
233 "match": "\\b(v32x4)\\.load_splat\\b",
234 "captures": {
235 "1": {
236 "name": "support.class.wat"
237 }
238 }
239 },
240 {
241 "comment": "Vector instruction (v64x2) [simd]",
242 "name": "keyword.operator.word.wat",
243 "match": "\\b(v64x2)\\.load_splat\\b",
244 "captures": {
245 "1": {
246 "name": "support.class.wat"
247 }
248 }
249 }
250 ]
251 },
252 {
253 "comment": "Threads",
254 "patterns": [
255 {
256 "comment": "Atomic instruction (i32) [threads]",
257 "name": "keyword.operator.word.wat",
258 "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",
259 "captures": {
260 "1": {
261 "name": "support.class.wat"
262 },
263 "2": {
264 "name": "support.class.wat"
265 },
266 "3": {
267 "name": "support.class.wat"
268 },
269 "4": {
270 "name": "support.class.wat"
271 }
272 }
273 },
274 {
275 "comment": "Atomic instruction (i64) [threads]",
276 "name": "keyword.operator.word.wat",
277 "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",
278 "captures": {
279 "1": {
280 "name": "support.class.wat"
281 },
282 "2": {
283 "name": "support.class.wat"
284 },
285 "3": {
286 "name": "support.class.wat"
287 },
288 "4": {
289 "name": "support.class.wat"
290 }
291 }
292 },
293 {
294 "comment": "Atomic instruction [threads]",
295 "name": "keyword.operator.word.wat",
296 "match": "\\b(atomic)\\.(?:notify|fence)\\b",
297 "captures": {
298 "1": {
299 "name": "support.class.wat"
300 }
301 }
302 },
303 {
304 "comment": "Shared modifier [threads]",
305 "name": "storage.modifier.wat",
306 "match": "\\bshared\\b"
307 }
308 ]
309 },
310 {
311 "comment": "Reference types",
312 "patterns": [
313 {
314 "comment": "Reference instruction [reference-types]",
315 "name": "keyword.operator.word.wat",
316 "match": "\\b(ref)\\.(?:null|is_null|func|extern)\\b",
317 "captures": {
318 "1": {
319 "name": "support.class.wat"
320 }
321 }
322 },
323 {
324 "comment": "Table instruction [reference-types]",
325 "name": "keyword.operator.word.wat",
326 "match": "\\b(table)\\.(?:get|size|grow|fill|init|copy)\\b",
327 "captures": {
328 "1": {
329 "name": "support.class.wat"
330 }
331 }
332 },
333 {
334 "comment": "Type name [reference-types]",
335 "name": "entity.name.type.wat",
336 "match": "\\b(?:externref|funcref|nullref)\\b"
337 }
338 ]
339 },
340 {
341 "comment": "Tail Call",
342 "patterns": [
343 {
344 "comment": "Control instruction [tail-call]",
345 "name": "keyword.control.wat",
346 "match": "\\breturn_call(?:_indirect)?\\b"
347 }
348 ]
349 },
350 {
351 "comment": "Exception handling",
352 "patterns": [
353 {
354 "comment": "Control instruction [exception-handling]",
355 "name": "keyword.control.wat",
356 "match": "\\b(?:try|catch|throw|rethrow|br_on_exn)\\b"
357 },
358 {
359 "comment": "Module element [exception-handling]",
360 "name": "storage.type.wat",
361 "match": "(?<=\\()event\\b"
362 }
363 ]
364 },
365 {
366 "comment": "Binaryen extensions",
367 "patterns": [
368 {
369 "comment": "Pseudo stack instruction [binaryen]",
370 "name": "keyword.operator.word.wat",
371 "match": "\\b(i32|i64|f32|f64|externref|funcref|nullref|exnref)\\.(?:push|pop)\\b",
372 "captures": {
373 "1": {
374 "name": "support.class.wat"
375 }
376 }
377 }
378 ]
379 },
380 {
381 "comment": "MVP",
382 "patterns": [
383 {
384 "comment": "Memory instruction (i32) [mvp]",
385 "name": "keyword.operator.word.wat",
386 "match": "\\b(i32)\\.(?:load|load(?:8|16)(?:_[su])?|store(?:8|16)?)\\b",
387 "captures": {
388 "1": {
389 "name": "support.class.type.wat"
390 }
391 }
392 },
393 {
394 "comment": "Memory instruction (i64) [mvp]",
395 "name": "keyword.operator.word.wat",
396 "match": "\\b(i64)\\.(?:load|load(?:8|16|32)(?:_[su])?|store(?:8|16|32)?)\\b",
397 "captures": {
398 "1": {
399 "name": "support.class.type.wat"
400 }
401 }
402 },
403 {
404 "comment": "Memory instruction (f32/f64) [mvp]",
405 "name": "keyword.operator.word.wat",
406 "match": "\\b(f32|f64)\\.(?:load|store)\\b",
407 "captures": {
408 "1": {
409 "name": "support.class.type.wat"
410 }
411 }
412 },
413 {
414 "comment": "Memory instruction [mvp]",
415 "name": "keyword.operator.word.wat",
416 "match": "\\b(memory)\\.(?:size|grow)\\b",
417 "captures": {
418 "1": {
419 "name": "support.class.memory.wat"
420 }
421 }
422 },
423 {
424 "comment": "Memory instruction attribute [mvp]",
425 "match": "\\b(offset|align)=\\b",
426 "captures": {
427 "1": {
428 "name": "entity.other.attribute-name.wat"
429 }
430 }
431 },
432 {
433 "comment": "Variable instruction (local) [mvp]",
434 "name": "keyword.operator.word.wat",
435 "match": "\\b(local)\\.(?:get|set|tee)\\b",
436 "captures": {
437 "1": {
438 "name": "support.class.local.wat"
439 }
440 }
441 },
442 {
443 "comment": "Variable instruction (global) [mvp]",
444 "name": "keyword.operator.word.wat",
445 "match": "\\b(global)\\.(?:get|set)\\b",
446 "captures": {
447 "1": {
448 "name": "support.class.global.wat"
449 }
450 }
451 },
452 {
453 "comment": "Numeric instruction (i32/i64) [mvp]",
454 "name": "keyword.operator.word.wat",
455 "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",
456 "captures": {
457 "1": {
458 "name": "support.class.type.wat"
459 }
460 }
461 },
462 {
463 "comment": "Numeric instruction (f32/f64) [mvp]",
464 "name": "keyword.operator.word.wat",
465 "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",
466 "captures": {
467 "1": {
468 "name": "support.class.type.wat"
469 }
470 }
471 },
472 {
473 "comment": "Conversion instruction (i32) [mvp]",
474 "name": "keyword.operator.word.wat",
475 "match": "\\b(i32)\\.(wrap_i64|trunc_(f32|f64)_[su]|reinterpret_f32)\\b",
476 "captures": {
477 "1": {
478 "name": "support.class.type.wat"
479 }
480 }
481 },
482 {
483 "comment": "Conversion instruction (i64) [mvp]",
484 "name": "keyword.operator.word.wat",
485 "match": "\\b(i64)\\.(extend_i32_[su]|trunc_f(32|64)_[su]|reinterpret_f64)\\b",
486 "captures": {
487 "1": {
488 "name": "support.class.type.wat"
489 }
490 }
491 },
492 {
493 "comment": "Conversion instruction (f32) [mvp]",
494 "name": "keyword.operator.word.wat",
495 "match": "\\b(f32)\\.(convert_i(32|64)_[su]|demote_f64|reinterpret_i32)\\b",
496 "captures": {
497 "1": {
498 "name": "support.class.type.wat"
499 }
500 }
501 },
502 {
503 "comment": "Conversion instruction (f64) [mvp]",
504 "name": "keyword.operator.word.wat",
505 "match": "\\b(f64)\\.(convert_i(32|64)_[su]|promote_f32|reinterpret_i64)\\b",
506 "captures": {
507 "1": {
508 "name": "support.class.type.wat"
509 }
510 }
511 },
512 {
513 "comment": "Control instruction [mvp]",
514 "name": "keyword.control.wat",
515 "match": "\\b(?:unreachable|nop|block|loop|if|then|else|end|br|br_if|br_table|return|call|call_indirect)\\b"
516 },
517 {
518 "comment": "Parametric instruction [mvp]",
519 "name": "keyword.operator.word.wat",
520 "match": "\\b(?:drop|select)\\b"
521 }
522 ]
523 }
524 ]
525 },
526 "types": {
527 "patterns": [
528 {
529 "comment": "Fixed-width SIMD",
530 "patterns": [
531 {
532 "comment": "Type name [simd]",
533 "name": "entity.name.type.wat",
534 "match": "\\bv128\\b(?!\\.)"
535 }
536 ]
537 },
538 {
539 "comment": "Reference types",
540 "patterns": [
541 {
542 "comment": "Type name [reference-types]",
543 "name": "entity.name.type.wat",
544 "match": "\\b(?:externref|funcref|nullref)\\b(?!\\.)"
545 }
546 ]
547 },
548 {
549 "comment": "Exception handling",
550 "patterns": [
551 {
552 "comment": "Type name [exception-handling]",
553 "name": "entity.name.type.wat",
554 "match": "\\bexnref\\b(?!\\.)"
555 }
556 ]
557 },
558 {
559 "comment": "MVP",
560 "patterns": [
561 {
562 "comment": "Type name [mvp]",
563 "name": "entity.name.type.wat",
564 "match": "\\b(?:i32|i64|f32|f64)\\b(?!\\.)"
565 }
566 ]
567 }
568 ]
569 },
570 "modules": {
571 "patterns": [
572 {
573 "comment": "Bulk memory operations",
574 "patterns": [
575 {
576 "comment": "Passive modifier [bulk-memory-operations]",
577 "match": "(?<=\\(data)\\s+(passive)\\b",
578 "captures": {
579 "1": {
580 "name": "storage.modifier.wat"
581 }
582 }
583 }
584 ]
585 },
586 {
587 "comment": "MVP",
588 "patterns": [
589 {
590 "comment": "Module element [mvp]",
591 "name": "storage.type.wat",
592 "match": "(?<=\\()(?:module|import|export|memory|data|table|elem|start|func|type|param|result|global|local)\\b"
593 },
594 {
595 "comment": "Mutable global modifier [mvp]",
596 "name": "storage.modifier.wat",
597 "match": "(?<=\\()\\s*(mut)\\b",
598 "captures": {
599 "1": {
600 "name": "storage.modifier.wat"
601 }
602 }
603 },
604 {
605 "comment": "Function name [mvp]",
606 "match": "(?<=\\(func|\\(start|call|return_call|ref\\.func)\\s+(\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*)",
607 "captures": {
608 "1": {
609 "name": "entity.name.function.wat"
610 }
611 }
612 },
613 {
614 "comment": "Function name(s) (elem) [mvp]",
615 "begin": "\\)\\s+(\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*)",
616 "beginCaptures": {
617 "1": {
618 "name": "entity.name.function.wat"
619 }
620 },
621 "end": "\\)",
622 "patterns": [
623 {
624 "name": "entity.name.function.wat",
625 "match": "(?<=\\s)\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*"
626 }
627 ]
628 },
629 {
630 "comment": "Function type [mvp]",
631 "match": "(?<=\\(type)\\s+(\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*)",
632 "captures": {
633 "1": {
634 "name": "support.type.function.wat"
635 }
636 }
637 },
638 {
639 "comment": "Variable name or branch label [mvp]",
640 "name": "variable.other.wat",
641 "match": "\\$[0-9A-Za-z!#$%&'*+\\-./:<=>?@\\\\^_`|~]*\\b"
642 }
643 ]
644 }
645 ]
646 },
647 "constants": {
648 "patterns": [
649 {
650 "comment": "Fixed-width SIMD",
651 "patterns": [
652 {
653 "comment": "Vector literal (i8x16) [simd]",
654 "name": "constant.numeric.vector.wat",
655 "match": "\\b(i8x16)(?:\\s+0x[0-9a-fA-F]{1,2}){16}\\b",
656 "captures": {
657 "1": {
658 "name": "support.type.wat"
659 }
660 }
661 },
662 {
663 "comment": "Vector literal (i16x8) [simd]",
664 "name": "constant.numeric.vector.wat",
665 "match": "\\b(i16x8)(?:\\s+0x[0-9a-fA-F]{1,4}){8}\\b",
666 "captures": {
667 "1": {
668 "name": "support.type.wat"
669 }
670 }
671 },
672 {
673 "comment": "Vector literal (i32x4) [simd]",
674 "name": "constant.numeric.vector.wat",
675 "match": "\\b(i32x4)(?:\\s+0x[0-9a-fA-F]{1,8}){4}\\b",
676 "captures": {
677 "1": {
678 "name": "support.type.wat"
679 }
680 }
681 },
682 {
683 "comment": "Vector literal (i64x2) [simd]",
684 "name": "constant.numeric.vector.wat",
685 "match": "\\b(i64x2)(?:\\s+0x[0-9a-fA-F]{1,16}){2}\\b",
686 "captures": {
687 "1": {
688 "name": "support.type.wat"
689 }
690 }
691 }
692 ]
693 },
694 {
695 "comment": "MVP",
696 "patterns": [
697 {
698 "comment": "Floating point literal",
699 "name": "constant.numeric.float.wat",
700 "match": "[+-]?\\b[0-9][0-9]*(?:\\.[0-9][0-9]*)?(?:[eE][+-]?[0-9]+)?\\b"
701 },
702 {
703 "comment": "Floating point hexadecimal literal",
704 "name": "constant.numeric.float.wat",
705 "match": "[+-]?\\b0x([0-9a-fA-F]*\\.[0-9a-fA-F]+|[0-9a-fA-F]+\\.?)[Pp][+-]?[0-9]+\\b"
706 },
707 {
708 "comment": "Floating point infinity",
709 "name": "constant.numeric.float.wat",
710 "match": "[+-]?\\binf\\b"
711 },
712 {
713 "comment": "Floating point literal (NaN)",
714 "name": "constant.numeric.float.wat",
715 "match": "[+-]?\\bnan:0x[0-9a-fA-F][0-9a-fA-F]*\\b"
716 },
717 {
718 "comment": "Integer literal",
719 "name": "constant.numeric.integer.wat",
720 "match": "[+-]?\\b(?:0x[0-9a-fA-F][0-9a-fA-F]*|\\d[\\d]*)\\b"
721 }
722 ]
723 }
724 ]
725 },
726 "invalid": {
727 "patterns": [
728 {
729 "name": "invalid.wat",
730 "match": "[^\\s()]+"
731 }
732 ]
733 }
734 }
735 }
736