@@ -15,7 +15,7 @@ variables:
15
15
FLOATO : ' f32\.(?:reinterpret[/_]i32|demote[/_]f64)|f64\.(?:promote[/_]f32|reinterpret[/_]i64)'
16
16
FLOATP : ' [+-]?(?:inf|nan(?::0x{{HEXNUM}})?|{{HEXFLT}}|{{DECFLT}}){{IDTERM}}'
17
17
FLOW_1 : ' (?:nop|return|unreachable){{IDTERM}}'
18
- FLOW_2 : ' br(?:_if)?{{IDTERM}}'
18
+ FLOW_2 : ' (?: br(?:_if)?|throw|rethrow) {{IDTERM}}'
19
19
FLOW_3 : ' br_table{{IDTERM}}'
20
20
HEXFLT : ' 0x{{HEXNUM}}(?=[Pp.])(\.{{HEXFRC}})?(?:[Pp][+-]?{{DECNUM}})?'
21
21
HEXFRC : (?:{{HEXNUM}})?
@@ -272,6 +272,9 @@ contexts:
272
272
- match : ' if{{IDTERM}}'
273
273
scope : keyword.control.conditional.wast
274
274
push : [ label, if_else_end, else, instructions, resulttype, label ]
275
+ - match : ' try{{IDTERM}}'
276
+ scope : keyword.control.flow.wast
277
+ push : [ label, try_catch_delegate, instructions, resulttype, label ]
275
278
- include : instructions_plain
276
279
- include : instructions_folded
277
280
instructions_folded :
@@ -341,6 +344,58 @@ contexts:
341
344
- instructions_folded
342
345
- resulttype
343
346
- label
347
+ - match : ' (\(){{WHITES}}*(try){{IDTERM}}'
348
+ captures :
349
+ 1 : punctuation.definition.block.begin.wast
350
+ 2 : keyword.control.flow.wast
351
+ push :
352
+ - - meta_scope : meta.s-expression.instruction.wast
353
+ - match : ' \)'
354
+ scope : punctuation.definition.block.end.wast
355
+ pop : true
356
+ - match : ' (\(){{WHITES}}*(do){{IDTERM}}'
357
+ captures :
358
+ 1 : punctuation.definition.block.begin.wast
359
+ 2 : keyword.control.flow.wast
360
+ push :
361
+ - - meta_scope : meta.s-expression.instruction.wast
362
+ - match : ' \)'
363
+ scope : punctuation.definition.block.end.wast
364
+ pop : true
365
+ - instructions
366
+ - match : ' (\(){{WHITES}}*(delegate){{IDTERM}}'
367
+ captures :
368
+ 1 : punctuation.definition.block.begin.wast
369
+ 2 : keyword.control.flow.wast
370
+ push :
371
+ - - meta_scope : meta.s-expression.instruction.wast
372
+ - match : ' \)'
373
+ scope : punctuation.definition.block.end.wast
374
+ pop : true
375
+ - reference
376
+ - match : ' (\(){{WHITES}}*(catch){{IDTERM}}'
377
+ captures :
378
+ 1 : punctuation.definition.block.begin.wast
379
+ 2 : keyword.control.flow.wast
380
+ push :
381
+ - - meta_scope : meta.s-expression.instruction.wast
382
+ - match : ' \)'
383
+ scope : punctuation.definition.block.end.wast
384
+ pop : true
385
+ - instructions
386
+ - reference
387
+ - match : ' (\(){{WHITES}}*(catch_all){{IDTERM}}'
388
+ captures :
389
+ 1 : punctuation.definition.block.begin.wast
390
+ 2 : keyword.control.flow.wast
391
+ push :
392
+ - - meta_scope : meta.s-expression.instruction.wast
393
+ - match : ' \)'
394
+ scope : punctuation.definition.block.end.wast
395
+ pop : true
396
+ - instructions
397
+ - resulttype
398
+ - label
344
399
# The lookahead here is a hack for if-then to avoid more copypasta contexts
345
400
- match : ' \((?!{{WHITES}}*then{{IDTERM}})'
346
401
scope : punctuation.definition.instruction.begin.wast
@@ -545,7 +600,7 @@ contexts:
545
600
pop : true
546
601
- match : ' .'
547
602
scope : invalid.illegal.wast
548
- - - match : ' (\(){{WHITES}}*(func|global|memory|table){{IDTERM}}'
603
+ - - match : ' (\(){{WHITES}}*(func|global|memory|table|tag ){{IDTERM}}'
549
604
captures :
550
605
1 : punctuation.definition.exportdesc.begin.wast
551
606
2 : storage.modifier.wast
@@ -632,12 +687,19 @@ contexts:
632
687
captures :
633
688
1 : entity.name.type.wast
634
689
pop : true
690
+ modulefield_tag :
691
+ - match : ' (\(){{WHITES}}*(tag){{IDTERM}}'
692
+ captures :
693
+ 1 : punctuation.definition.tag.begin.wast
694
+ 2 : storage.type.constant.wast storage.type.tag.wast
695
+ push : [ tag_end, tag_type, tag_import, abbreviated_export, tag_name ]
635
696
modulefields_IMPORT_START :
636
697
- include : modulefield_data
637
698
- include : modulefield_element
638
699
- include : modulefield_export
639
700
- include : modulefield_import
640
701
- include : modulefield_type
702
+ - include : modulefield_tag
641
703
- match : ' {{STARTS}}'
642
704
captures :
643
705
1 : punctuation.definition.start.begin.wast
@@ -651,6 +713,7 @@ contexts:
651
713
- include : modulefield_export
652
714
- include : modulefield_import
653
715
- include : modulefield_type
716
+ - include : modulefield_tag
654
717
- match : ' (?=.)'
655
718
set : modulefields_REST
656
719
modulefields_REST :
@@ -662,6 +725,7 @@ contexts:
662
725
- include : modulefield_memory
663
726
- include : modulefield_table
664
727
- include : modulefield_type
728
+ - include : modulefield_tag
665
729
- match : ' (?=.)'
666
730
pop : true
667
731
modulefields_START :
@@ -831,6 +895,51 @@ contexts:
831
895
captures :
832
896
1 : entity.name.table.wast
833
897
pop : true
898
+ tag_end :
899
+ - meta_scope : meta.s-expression.tag.wast
900
+ - match : ' \)'
901
+ scope : punctuation.definition.tag.end.wast
902
+ pop : true
903
+ - match : ' .'
904
+ scope : invalid.illegal.wast
905
+ pop : true
906
+ tag_import :
907
+ - match : ' (\(){{WHITES}}*(import){{IDTERM}}'
908
+ captures :
909
+ 1 : punctuation.definition.import.begin.wast
910
+ 2 : keyword.other.import.wast
911
+ set : [ import_end, import_names ]
912
+ - match : ' (?=.)'
913
+ pop : true
914
+ tag_name :
915
+ - match : ' ({{IDNAME}})|'
916
+ captures :
917
+ 1 : entity.name.tag.wast
918
+ pop : true
919
+ tag_type :
920
+ - include : param
921
+ - match : ' (?=.)'
922
+ pop : true
923
+ try_catch_delegate :
924
+ - meta_scope : meta.block.wast
925
+ - match : ' delegate{{IDTERM}}'
926
+ scope : keyword.control.flow.wast
927
+ set : [ reference ]
928
+ - match : ' (?=.)'
929
+ set : [ try_catch ]
930
+ try_catch :
931
+ - meta_scope : meta.block.wast
932
+ - match : ' catch{{IDTERM}}'
933
+ scope : keyword.control.flow.wast
934
+ push : [ instructions, reference ]
935
+ - match : ' catch_all{{IDTERM}}'
936
+ scope : keyword.control.flow.wast
937
+ push : [ instructions ]
938
+ - match : ' end{{IDTERM}}'
939
+ scope : keyword.control.flow.wast
940
+ pop : true
941
+ - match : ' .'
942
+ scope : invalid.illegal.wast
834
943
typeuse :
835
944
- match : (?=.)
836
945
set :
0 commit comments