annotate runtime/syntax/wast.vim @ 15483:09803c73b55c

Added tag v8.1.0749 for changeset 18dd04f7c4a160f7bf064e7aaaacb9d321589e61
author Bram Moolenaar <Bram@vim.org>
date Mon, 14 Jan 2019 23:00:07 +0100
parents 172f18a3a6cd
children 2023f0835f75
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>
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 " Last Change: Jul 29, 2018
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
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 syn cluster wastCluster contains=wastModule,wastInstWithType,wastInstGeneral,wastParamInst,wastControlInst,wastString,wastNamedVar,wastUnnamedVar,wastFloat,wastNumber,wastComment,wastList,wastType
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
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 " https://webassembly.github.io/spec/core/text/instructions.html#control-instructions
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 syn match wastControlInst "\%((\s*\)\@<=\<\%(block\|end\|loop\|if\|else\|unreachable\|nop\|br\|br_if\|br_table\|return\|call\|call_indirect\)\>" contained display
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " https://webassembly.github.io/spec/core/text/instructions.html#parametric-instructions
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 syn match wastParamInst "\%((\s*\)\@<=\<\%(drop\|select\)\>" contained display
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " Identifiers
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " https://webassembly.github.io/spec/core/text/values.html#text-id
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 syn match wastNamedVar "$\+[[:alnum:]!#$%&'∗./:=><?@\\^_`~+-]*" contained display
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 syn match wastUnnamedVar "$\+\d\+[[:alnum:]!#$%&'∗./:=><?@\\^_`~+-]\@!" contained display
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " String literals
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 " https://webassembly.github.io/spec/core/text/values.html#strings
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 syn region wastString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=wastStringSpecial
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 syn match wastStringSpecial "\\\x\x\|\\[tnr'\\\"]\|\\u\x\+" contained containedin=wastString
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 " Float literals
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 " https://webassembly.github.io/spec/core/text/values.html#floating-point
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 syn match wastFloat "\<-\=\d\%(_\=\d\)*\%(\.\d\%(_\=\d\)*\)\=\%([eE][-+]\=\d\%(_\=\d\)*\)\=" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 syn match wastFloat "\<-\=0x\x\%(_\=\d\)*\%(\.\x\%(_\=\x\)*\)\=\%([pP][-+]\=\d\%(_\=\d\)*\)\=" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 syn keyword wastFloat inf nan contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 " Integer literals
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 " https://webassembly.github.io/spec/core/text/values.html#integers
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 syn match wastNumber "\<-\=\d\%(_\=\d\)*\>" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 syn match wastNumber "\<-\=0x\x\%(_\=\x\)*\>" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 " Comments
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 " https://webassembly.github.io/spec/core/text/lexical.html#comments
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 syn region wastComment start=";;" end="$" display
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 syn region wastComment start="(;;\@!" end=";)"
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 syn region wastList matchgroup=wastListDelimiter start="(;\@!" matchgroup=wastListDelimiter end=";\@<!)" contains=@wastCluster
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 " Types
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 " https://webassembly.github.io/spec/core/text/types.html
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 syn keyword wastType i64 i32 f64 f32 param result anyfunc mut contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 syn match wastType "\%((\_s*\)\@<=func\%(\_s*[()]\)\@=" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 " Modules
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 " https://webassembly.github.io/spec/core/text/modules.html
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 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
62 syn match wastModule "\%((\_s*\)\@<=func\%(\_s\+\$\)\@=" display contained
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 syn sync lines=100
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 hi def link wastModule PreProc
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 hi def link wastListDelimiter Delimiter
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 hi def link wastInstWithType Operator
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 hi def link wastInstGeneral Operator
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 hi def link wastControlInst Statement
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 hi def link wastParamInst Conditional
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 hi def link wastString String
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 hi def link wastStringSpecial Special
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 hi def link wastNamedVar Identifier
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 hi def link wastUnnamedVar PreProc
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 hi def link wastFloat Float
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 hi def link wastNumber Number
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 hi def link wastComment Comment
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 hi def link wastType Type
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 let b:current_syntax = "wast"
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 let &cpo = s:cpo_save
172f18a3a6cd Update runtime files.
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 unlet s:cpo_save