annotate runtime/syntax/wat.vim @ 34633:45d13860879a v9.1.0203

patch 9.1.0203: build-error on GNU/Hurd Commit: https://github.com/vim/vim/commit/4a95377593d06599a88670fcb6b49041a4b47abe Author: James McCoy <jamessan@jamessan.com> Date: Mon Mar 25 16:22:23 2024 +0100 patch 9.1.0203: build-error on GNU/Hurd Problem: build-error on GNU HURD Solution: Define _XOPEN_SOURCE like for Android and Cygwin (James McCoy) strptime() requires _XOPEN_SOURCE to be defined for its declaration to be visible. This is already done for non-Android Linux and Cygwin, but also needs to be exposed for GNU/Hurd. closes: #14285 Signed-off-by: James McCoy <jamessan@jamessan.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 25 Mar 2024 16:30:12 +0100
parents 4913b4f5a133
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33767
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Vim syntax file
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " Language: WebAssembly
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Maintainer: rhysd <lin90162@yahoo.co.jp>
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 " Last Change: Nov 14, 2023
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " For bugs, patches and license go to https://github.com/rhysd/vim-wasm
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 if exists("b:current_syntax")
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 finish
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 endif
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 let s:cpo_save = &cpo
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 set cpo&vim
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 syn cluster watNotTop contains=watModule,watInstWithType,watInstGetSet,watInstGeneral,watParamInst,watControlInst,watSimdInst,watString,watNamedVar,watUnnamedVar,watFloat,watNumber,watComment,watList,watType
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 " Instructions
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " https://webassembly.github.io/spec/core/text/instructions.html
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " Note: memarg (align=,offset=) can be added to memory instructions
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 syn match watInstWithType "\%((\s*\)\@<=\<\%(i32\|i64\|f32\|f64\|memory\)\.[[:alnum:]_]\+\%(/\%(i32\|i64\|f32\|f64\)\)\=\>\%(\s\+\%(align\|offset\)=\)\=" contained display
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 syn match watInstGeneral "\%((\s*\)\@<=\<[[:alnum:]_]\+\>" contained display
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 syn match watInstGetSet "\%((\s*\)\@<=\<\%(local\|global\)\.\%(get\|set\)\>" contained display
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " https://webassembly.github.io/spec/core/text/instructions.html#control-instructions
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 syn match watControlInst "\%((\s*\)\@<=\<\%(block\|end\|loop\|if\|then\|else\|unreachable\|nop\|br\|br_if\|br_table\|return\|call\|call_indirect\)\>" contained display
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " https://webassembly.github.io/spec/core/text/instructions.html#parametric-instructions
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 syn match watParamInst "\%((\s*\)\@<=\<\%(drop\|select\)\>" contained display
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " SIMD instructions
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " https://webassembly.github.io/simd/core/text/instructions.html#simd-instructions
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 syn match watSimdInst "\<\%(v128\|i8x16\|i16x8\|i32x4\|i64x2\|f32x4\|f64x2)\)\.[[:alnum:]_]\+\%(\s\+\%(i8x16\|i16x8\|i32x4\|i64x2\|f32x4\|f64x2\)\)\=\>" contained display
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " Identifiers
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " https://webassembly.github.io/spec/core/text/values.html#text-id
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 syn match watNamedVar "$\+[[:alnum:]!#$%&'∗./:=><?@\\^_`~+-]*" contained contains=watEscapeUtf8
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 syn match watUnnamedVar "$\+\d\+[[:alnum:]!#$%&'∗./:=><?@\\^_`~+-]\@!" contained display
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 " Presuming the source text is itself encoded correctly, strings that do not
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " contain any uses of hexadecimal byte escapes are always valid names.
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 " https://webassembly.github.io/spec/core/text/values.html#names
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 syn match watEscapedUtf8 "\\\x\{1,6}" contained containedin=watNamedVar display
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " String literals
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " https://webassembly.github.io/spec/core/text/values.html#strings
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 syn region watString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=watStringSpecial
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 syn match watStringSpecial "\\\x\x\|\\[tnr'\\\"]\|\\u\x\+" contained containedin=watString display
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 " Float literals
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 " https://webassembly.github.io/spec/core/text/values.html#floating-point
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 syn match watFloat "\<-\=\d\%(_\=\d\)*\%(\.\d\%(_\=\d\)*\)\=\%([eE][-+]\=\d\%(_\=\d\)*\)\=" display contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 syn match watFloat "\<-\=0x\x\%(_\=\x\)*\%(\.\x\%(_\=\x\)*\)\=\%([pP][-+]\=\d\%(_\=\d\)*\)\=" display contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 syn keyword watFloat inf nan contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 syn match watFloat "nan:0x\x\%(_\=\x\)*" display contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 " Integer literals
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 " https://webassembly.github.io/spec/core/text/values.html#integers
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 syn match watNumber "\<-\=\d\%(_\=\d\)*\>" display contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 syn match watNumber "\<-\=0x\x\%(_\=\x\)*\>" display contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 " Comments
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 " https://webassembly.github.io/spec/core/text/lexical.html#comments
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 syn region watComment start=";;" end="$"
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 syn region watComment start="(;;\@!" end=";)"
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 syn region watList matchgroup=watListDelimiter start="(;\@!" matchgroup=watListDelimiter end=";\@<!)" contains=@watNotTop
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 " Types
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 " https://webassembly.github.io/spec/core/text/types.html
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 " Note: `mut` was changed to `const`/`var` at Wasm 2.0
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 syn keyword watType i64 i32 f64 f32 param result funcref func externref extern mut v128 const var contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 syn match watType "\%((\_s*\)\@<=func\%(\_s*[()]\)\@=" display contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 " Modules
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 " https://webassembly.github.io/spec/core/text/modules.html
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 syn keyword watModule module type export import table memory global data elem contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 syn match watModule "\%((\_s*\)\@<=func\%(\_s\+\$\)\@=" display contained
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 syn sync maxlines=100
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 hi def link watModule PreProc
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 hi def link watListDelimiter Delimiter
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 hi def link watInstWithType Operator
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 hi def link watInstGetSet Operator
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 hi def link watInstGeneral Operator
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 hi def link watControlInst Statement
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 hi def link watSimdInst Operator
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 hi def link watParamInst Conditional
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 hi def link watString String
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 hi def link watStringSpecial Special
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 hi def link watNamedVar Identifier
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 hi def link watUnnamedVar PreProc
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 hi def link watFloat Float
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 hi def link watNumber Number
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 hi def link watComment Comment
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 hi def link watType Type
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 hi def link watEscapedUtf8 Special
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 let b:current_syntax = "wat"
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 let &cpo = s:cpo_save
4913b4f5a133 patch 9.0.2104: wast filetype should be replaced by wat filetype
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 unlet s:cpo_save