" Vim syntax file " Language: WebAssembly " Maintainer: rhysd " Last Change: Nov 14, 2023 " For bugs, patches and license go to https://github.com/rhysd/vim-wasm if exists("b:current_syntax") finish endif let s:cpo_save = &cpo set cpo&vim syn cluster watNotTop contains=watModule,watInstWithType,watInstGetSet,watInstGeneral,watParamInst,watControlInst,watSimdInst,watString,watNamedVar,watUnnamedVar,watFloat,watNumber,watComment,watList,watType " Instructions " https://webassembly.github.io/spec/core/text/instructions.html " Note: memarg (align=,offset=) can be added to memory instructions syn match watInstWithType "\%((\s*\)\@<=\<\%(i32\|i64\|f32\|f64\|memory\)\.[[:alnum:]_]\+\%(/\%(i32\|i64\|f32\|f64\)\)\=\>\%(\s\+\%(align\|offset\)=\)\=" contained display syn match watInstGeneral "\%((\s*\)\@<=\<[[:alnum:]_]\+\>" contained display syn match watInstGetSet "\%((\s*\)\@<=\<\%(local\|global\)\.\%(get\|set\)\>" contained display " https://webassembly.github.io/spec/core/text/instructions.html#control-instructions syn match watControlInst "\%((\s*\)\@<=\<\%(block\|end\|loop\|if\|then\|else\|unreachable\|nop\|br\|br_if\|br_table\|return\|call\|call_indirect\)\>" contained display " https://webassembly.github.io/spec/core/text/instructions.html#parametric-instructions syn match watParamInst "\%((\s*\)\@<=\<\%(drop\|select\)\>" contained display " SIMD instructions " https://webassembly.github.io/simd/core/text/instructions.html#simd-instructions syn match watSimdInst "\<\%(v128\|i8x16\|i16x8\|i32x4\|i64x2\|f32x4\|f64x2)\)\.[[:alnum:]_]\+\%(\s\+\%(i8x16\|i16x8\|i32x4\|i64x2\|f32x4\|f64x2\)\)\=\>" contained display " Identifiers " https://webassembly.github.io/spec/core/text/values.html#text-id syn match watNamedVar "$\+[[:alnum:]!#$%&'∗./:=>" display contained syn match watNumber "\<-\=0x\x\%(_\=\x\)*\>" display contained " Comments " https://webassembly.github.io/spec/core/text/lexical.html#comments syn region watComment start=";;" end="$" syn region watComment start="(;;\@!" end=";)" syn region watList matchgroup=watListDelimiter start="(;\@!" matchgroup=watListDelimiter end=";\@