From 9e2248ab586c5e5854da68b5310755ea3557e6c9 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 14 Nov 2023 17:38:46 +0100 Subject: [PATCH] vim-patch:9.0.2104: wast filetype should be replaced by wat filetype Problem: wast filetype should be replaced by wat filetype Solution: start using the official wat filetype name runtime: rename `wast` filetype to `wat` (Wasm text format) The problem is the name of the current filetype wast. When the plugin was initially created, the file extension for Wasm text format was not fixed and .wast was more popular. However, recently .wat became the official file extension for WebAssembly text (WAT) format and .wast is now a file extension for the unofficial WAST format, which is a superset of .wat for the convenience to describe the Wasm specification conformance tests. https://webassembly.js.org/docs/contrib-wat-vs-wast.html However for now, let's keep using the `wat` filetype even for the .wast extension, so that we at least do not lose the filetype settings and syntax highlighting. This can be adjusted later, if it turns out to have a separate need for. closes: vim/vim#13533 https://github.com/vim/vim/commit/bc8f79d36a456054ed29f46585830af6d71f57c8 Co-authored-by: rhysd --- runtime/ftplugin/{wast.vim => wat.vim} | 2 +- runtime/indent/{wast.vim => wat.vim} | 2 +- runtime/lua/vim/filetype.lua | 2 +- runtime/makemenu.vim | 2 +- runtime/synmenu.vim | 2 +- runtime/syntax/wast.vim | 97 -------------------------- runtime/syntax/wat.vim | 97 ++++++++++++++++++++++++++ test/old/testdir/test_filetype.vim | 3 +- 8 files changed, 103 insertions(+), 104 deletions(-) rename runtime/ftplugin/{wast.vim => wat.vim} (93%) rename runtime/indent/{wast.vim => wat.vim} (93%) delete mode 100644 runtime/syntax/wast.vim create mode 100644 runtime/syntax/wat.vim diff --git a/runtime/ftplugin/wast.vim b/runtime/ftplugin/wat.vim similarity index 93% rename from runtime/ftplugin/wast.vim rename to runtime/ftplugin/wat.vim index 0d9e98d37a..35d2d6a322 100644 --- a/runtime/ftplugin/wast.vim +++ b/runtime/ftplugin/wat.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: WebAssembly " Maintainer: rhysd -" Last Change: Jul 29, 2018 +" Last Change: Nov 14, 2023 " For bugs, patches and license go to https://github.com/rhysd/vim-wasm if exists("b:did_ftplugin") diff --git a/runtime/indent/wast.vim b/runtime/indent/wat.vim similarity index 93% rename from runtime/indent/wast.vim rename to runtime/indent/wat.vim index 1be234b6e9..08997f1a98 100644 --- a/runtime/indent/wast.vim +++ b/runtime/indent/wat.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: WebAssembly " Maintainer: rhysd -" Last Change: Jul 29, 2018 +" Last Change: Nov 14, 2023 " For bugs, patches and license go to https://github.com/rhysd/vim-wasm if exists("b:did_indent") diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index aae63af132..217f673b5e 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1074,7 +1074,7 @@ local extension = { wrl = 'vrml', vroom = 'vroom', vue = 'vue', - wast = 'wast', + wast = 'wat', wat = 'wat', wdl = 'wdl', wm = 'webmacro', diff --git a/runtime/makemenu.vim b/runtime/makemenu.vim index 8eea49d711..5d288e2f40 100644 --- a/runtime/makemenu.vim +++ b/runtime/makemenu.vim @@ -649,7 +649,7 @@ SynMenu UV.VSE\ JCL:vsejcl SynMenu WXYZ.WEB.CWEB:cweb SynMenu WXYZ.WEB.WEB:web SynMenu WXYZ.WEB.WEB\ Changes:change -SynMenu WXYZ.WebAssembly:wast +SynMenu WXYZ.WebAssembly:wat SynMenu WXYZ.Webmacro:webmacro SynMenu WXYZ.Website\ MetaLanguage:wml SynMenu WXYZ.wDiff:wdiff diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index fec5cc4b06..43aae6f88b 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -623,7 +623,7 @@ an 50.160.330 &Syntax.UV.VSE\ JCL :cal SetSyn("vsejcl") an 50.170.100 &Syntax.WXYZ.WEB.CWEB :cal SetSyn("cweb") an 50.170.110 &Syntax.WXYZ.WEB.WEB :cal SetSyn("web") an 50.170.120 &Syntax.WXYZ.WEB.WEB\ Changes :cal SetSyn("change") -an 50.170.130 &Syntax.WXYZ.WebAssembly :cal SetSyn("wast") +an 50.170.130 &Syntax.WXYZ.WebAssembly :cal SetSyn("wat") an 50.170.140 &Syntax.WXYZ.Webmacro :cal SetSyn("webmacro") an 50.170.150 &Syntax.WXYZ.Website\ MetaLanguage :cal SetSyn("wml") an 50.170.170 &Syntax.WXYZ.wDiff :cal SetSyn("wdiff") diff --git a/runtime/syntax/wast.vim b/runtime/syntax/wast.vim deleted file mode 100644 index 113d65c5a1..0000000000 --- a/runtime/syntax/wast.vim +++ /dev/null @@ -1,97 +0,0 @@ -" Vim syntax file -" Language: WebAssembly -" Maintainer: rhysd -" Last Change: Aug 7, 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 wastNotTop contains=wastModule,wastInstWithType,wastInstGetSet,wastInstGeneral,wastParamInst,wastControlInst,wastSimdInst,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 -syn match wastInstGetSet "\%((\s*\)\@<=\<\%(local\|global\)\.\%(get\|set\)\>" contained display -" https://webassembly.github.io/spec/core/text/instructions.html#control-instructions -syn match wastControlInst "\%((\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 wastParamInst "\%((\s*\)\@<=\<\%(drop\|select\)\>" contained display -" SIMD instructions -" https://webassembly.github.io/simd/core/text/instructions.html#simd-instructions -syn match wastSimdInst "\<\%(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 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="$" -syn region wastComment start="(;;\@!" end=";)" - -syn region wastList matchgroup=wastListDelimiter start="(;\@!" matchgroup=wastListDelimiter end=";\@ +" 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=";\@