annotate runtime/syntax/wast.vim @ 33080:51b4577d57bf

Added tag v9.0.1826 for changeset 5f201b734cb7b114a411a339a895d25ebecf7262
author Christian Brabandt <cb@256bit.org>
date Wed, 30 Aug 2023 19:45:05 +0200
parents 2023f0835f75
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Vim syntax file
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " Language: WebAssembly
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Maintainer: rhysd <lin90162@yahoo.co.jp>
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
4 " Last Change: Aug 7, 2023
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " For bugs, patches and license go to https://github.com/rhysd/vim-wasm
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 if exists("b:current_syntax")
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 finish
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 endif
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let s:cpo_save = &cpo
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 set cpo&vim
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
14 syn cluster wastNotTop contains=wastModule,wastInstWithType,wastInstGetSet,wastInstGeneral,wastParamInst,wastControlInst,wastSimdInst,wastString,wastNamedVar,wastUnnamedVar,wastFloat,wastNumber,wastComment,wastList,wastType
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 " Instructions
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " https://webassembly.github.io/spec/core/text/instructions.html
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " Note: memarg (align=,offset=) can be added to memory instructions
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 syn match wastInstWithType "\%((\s*\)\@<=\<\%(i32\|i64\|f32\|f64\|memory\)\.[[:alnum:]_]\+\%(/\%(i32\|i64\|f32\|f64\)\)\=\>\%(\s\+\%(align\|offset\)=\)\=" contained display
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 syn match wastInstGeneral "\%((\s*\)\@<=\<[[:alnum:]_]\+\>" contained display
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
21 syn match wastInstGetSet "\%((\s*\)\@<=\<\%(local\|global\)\.\%(get\|set\)\>" contained display
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " https://webassembly.github.io/spec/core/text/instructions.html#control-instructions
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
23 syn match wastControlInst "\%((\s*\)\@<=\<\%(block\|end\|loop\|if\|then\|else\|unreachable\|nop\|br\|br_if\|br_table\|return\|call\|call_indirect\)\>" contained display
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " https://webassembly.github.io/spec/core/text/instructions.html#parametric-instructions
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 syn match wastParamInst "\%((\s*\)\@<=\<\%(drop\|select\)\>" contained display
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
26 " SIMD instructions
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
27 " https://webassembly.github.io/simd/core/text/instructions.html#simd-instructions
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
28 syn match wastSimdInst "\<\%(v128\|i8x16\|i16x8\|i32x4\|i64x2\|f32x4\|f64x2)\)\.[[:alnum:]_]\+\%(\s\+\%(i8x16\|i16x8\|i32x4\|i64x2\|f32x4\|f64x2\)\)\=\>" contained display
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " Identifiers
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " https://webassembly.github.io/spec/core/text/values.html#text-id
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
32 syn match wastNamedVar "$\+[[:alnum:]!#$%&'∗./:=><?@\\^_`~+-]*" contained contains=wastEscapeUtf8
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 syn match wastUnnamedVar "$\+\d\+[[:alnum:]!#$%&'∗./:=><?@\\^_`~+-]\@!" contained display
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
34 " Presuming the source text is itself encoded correctly, strings that do not
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
35 " contain any uses of hexadecimal byte escapes are always valid names.
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
36 " https://webassembly.github.io/spec/core/text/values.html#names
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
37 syn match wastEscapedUtf8 "\\\x\{1,6}" contained containedin=wastNamedVar display
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " String literals
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " https://webassembly.github.io/spec/core/text/values.html#strings
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 syn region wastString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=wastStringSpecial
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
42 syn match wastStringSpecial "\\\x\x\|\\[tnr'\\\"]\|\\u\x\+" contained containedin=wastString display
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 " Float literals
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 " https://webassembly.github.io/spec/core/text/values.html#floating-point
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 syn match wastFloat "\<-\=\d\%(_\=\d\)*\%(\.\d\%(_\=\d\)*\)\=\%([eE][-+]\=\d\%(_\=\d\)*\)\=" display contained
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
47 syn match wastFloat "\<-\=0x\x\%(_\=\x\)*\%(\.\x\%(_\=\x\)*\)\=\%([pP][-+]\=\d\%(_\=\d\)*\)\=" display contained
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 syn keyword wastFloat inf nan contained
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
49 syn match wastFloat "nan:0x\x\%(_\=\x\)*" display contained
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 " Integer literals
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 " https://webassembly.github.io/spec/core/text/values.html#integers
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 syn match wastNumber "\<-\=\d\%(_\=\d\)*\>" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 syn match wastNumber "\<-\=0x\x\%(_\=\x\)*\>" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 " Comments
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 " https://webassembly.github.io/spec/core/text/lexical.html#comments
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
58 syn region wastComment start=";;" end="$"
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 syn region wastComment start="(;;\@!" end=";)"
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
61 syn region wastList matchgroup=wastListDelimiter start="(;\@!" matchgroup=wastListDelimiter end=";\@<!)" contains=@wastNotTop
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 " Types
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 " https://webassembly.github.io/spec/core/text/types.html
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
65 " Note: `mut` was changed to `const`/`var` at Wasm 2.0
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
66 syn keyword wastType i64 i32 f64 f32 param result funcref func externref extern mut v128 const var contained
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 syn match wastType "\%((\_s*\)\@<=func\%(\_s*[()]\)\@=" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 " Modules
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 " https://webassembly.github.io/spec/core/text/modules.html
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 syn keyword wastModule module type export import table memory global data elem contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 syn match wastModule "\%((\_s*\)\@<=func\%(\_s\+\$\)\@=" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
74 syn sync maxlines=100
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 hi def link wastModule PreProc
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 hi def link wastListDelimiter Delimiter
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 hi def link wastInstWithType Operator
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
79 hi def link wastInstGetSet Operator
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 hi def link wastInstGeneral Operator
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 hi def link wastControlInst Statement
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
82 hi def link wastSimdInst Operator
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 hi def link wastParamInst Conditional
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 hi def link wastString String
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 hi def link wastStringSpecial Special
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 hi def link wastNamedVar Identifier
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 hi def link wastUnnamedVar PreProc
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 hi def link wastFloat Float
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 hi def link wastNumber Number
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 hi def link wastComment Comment
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 hi def link wastType Type
32699
2023f0835f75 update .wast files syntax highlighting (#12741)
Christian Brabandt <cb@256bit.org>
parents: 14432
diff changeset
92 hi def link wastEscapedUtf8 Special
14432
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 let b:current_syntax = "wast"
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 let &cpo = s:cpo_save
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 unlet s:cpo_save