From 8baab3c8d7a6f22888bd581cd5c6098fd2e4b5a8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 04:44:24 +0200 Subject: Adding upstream version 2:8.1.0875. Signed-off-by: Daniel Baumann --- runtime/syntax/wast.vim | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 runtime/syntax/wast.vim (limited to 'runtime/syntax/wast.vim') diff --git a/runtime/syntax/wast.vim b/runtime/syntax/wast.vim new file mode 100644 index 0000000..245d5f6 --- /dev/null +++ b/runtime/syntax/wast.vim @@ -0,0 +1,84 @@ +" Vim syntax file +" Language: WebAssembly +" Maintainer: rhysd +" Last Change: Jul 29, 2018 +" 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 wastCluster contains=wastModule,wastInstWithType,wastInstGeneral,wastParamInst,wastControlInst,wastString,wastNamedVar,wastUnnamedVar,wastFloat,wastNumber,wastComment,wastList,wastType + +" Instructions +" https://webassembly.github.io/spec/core/text/instructions.html +" Note: memarg (align=,offset=) can be added to memory instructions +syn match wastInstWithType "\%((\s*\)\@<=\<\%(i32\|i64\|f32\|f64\|memory\)\.[[:alnum:]_]\+\%(/\%(i32\|i64\|f32\|f64\)\)\=\>\%(\s\+\%(align\|offset\)=\)\=" contained display +syn match wastInstGeneral "\%((\s*\)\@<=\<[[:alnum:]_]\+\>" contained display +" https://webassembly.github.io/spec/core/text/instructions.html#control-instructions +syn match wastControlInst "\%((\s*\)\@<=\<\%(block\|end\|loop\|if\|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 wastParamInst "\%((\s*\)\@<=\<\%(drop\|select\)\>" contained display + +" Identifiers +" https://webassembly.github.io/spec/core/text/values.html#text-id +syn match wastNamedVar "$\+[[:alnum:]!#$%&'∗./:=>" display contained +syn match wastNumber "\<-\=0x\x\%(_\=\x\)*\>" display contained + +" Comments +" https://webassembly.github.io/spec/core/text/lexical.html#comments +syn region wastComment start=";;" end="$" display +syn region wastComment start="(;;\@!" end=";)" + +syn region wastList matchgroup=wastListDelimiter start="(;\@!" matchgroup=wastListDelimiter end=";\@