]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.2104: wast filetype should be replaced by wat filetype v9.0.2104
authorrhysd <lin90162@yahoo.co.jp>
Tue, 14 Nov 2023 15:46:07 +0000 (16:46 +0100)
committerChristian Brabandt <cb@256bit.org>
Tue, 14 Nov 2023 15:46:07 +0000 (16:46 +0100)
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: #13533

Signed-off-by: rhysd <lin90162@yahoo.co.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/filetype.vim
runtime/ftplugin/wat.vim [moved from runtime/ftplugin/wast.vim with 93% similarity]
runtime/indent/wat.vim [moved from runtime/indent/wast.vim with 93% similarity]
runtime/makemenu.vim
runtime/synmenu.vim
runtime/syntax/wast.vim [deleted file]
runtime/syntax/wat.vim [new file with mode: 0644]
src/testdir/test_filetype.vim

index df7624d41a2eabc84a6abded4333c68409c8b231..b067c70e6a340aec4a62e48945706bcd5c6c3db7 100644 (file)
@@ -2454,8 +2454,7 @@ au BufNewFile,BufRead *.vroom                     setf vroom
 au BufNewFile,BufRead *.vue                    setf vue
 
 " WebAssembly
-au BufNewFile,BufRead *.wat                    setf wat
-au BufNewFile,BufRead *.wast           setf wast
+au BufNewFile,BufRead *.wat,*.wast             setf wat
 
 " WebAssembly Interface Type (WIT)
 au BufNewFile,BufRead *.wit                    setf wit
similarity index 93%
rename from runtime/ftplugin/wast.vim
rename to runtime/ftplugin/wat.vim
index 0d9e98d37adf68fab33281f8cb1175d3c246ad0b..35d2d6a32219ab3ffd3fb2d543dc54f7aa2224ba 100644 (file)
@@ -1,7 +1,7 @@
 " Vim filetype plugin file
 " Language:     WebAssembly
 " Maintainer:   rhysd <lin90162@yahoo.co.jp>
-" 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")
similarity index 93%
rename from runtime/indent/wast.vim
rename to runtime/indent/wat.vim
index 1be234b6e9b5fa297b97d8aff62ad269f3ff5fc7..08997f1a98f1ef2987292017d93a6bb85be7af39 100644 (file)
@@ -1,7 +1,7 @@
 " Vim indent file
 " Language:     WebAssembly
 " Maintainer:   rhysd <lin90162@yahoo.co.jp>
-" 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")
index 0479f7ba7f70ddb3808fdd991ab903ae534044b1..16af2035e341c672a57f886a98f0ddce1627d12c 100644 (file)
@@ -651,7 +651,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
index 12cdcbdddf80b9cbfe273ac423d211df1ff5b8b7..b6ecf864495276c3de5583ce10a40afd525a04ea 100644 (file)
@@ -618,7 +618,7 @@ an 50.160.330 &Syntax.UV.VSE\ JCL :cal SetSyn("vsejcl")<CR>
 an 50.170.100 &Syntax.WXYZ.WEB.CWEB :cal SetSyn("cweb")<CR>
 an 50.170.110 &Syntax.WXYZ.WEB.WEB :cal SetSyn("web")<CR>
 an 50.170.120 &Syntax.WXYZ.WEB.WEB\ Changes :cal SetSyn("change")<CR>
-an 50.170.130 &Syntax.WXYZ.WebAssembly :cal SetSyn("wast")<CR>
+an 50.170.130 &Syntax.WXYZ.WebAssembly :cal SetSyn("wat")<CR>
 an 50.170.140 &Syntax.WXYZ.Webmacro :cal SetSyn("webmacro")<CR>
 an 50.170.150 &Syntax.WXYZ.Website\ MetaLanguage :cal SetSyn("wml")<CR>
 an 50.170.170 &Syntax.WXYZ.wDiff :cal SetSyn("wdiff")<CR>
diff --git a/runtime/syntax/wast.vim b/runtime/syntax/wast.vim
deleted file mode 100644 (file)
index 113d65c..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-" Vim syntax file
-" Language:     WebAssembly
-" Maintainer:   rhysd <lin90162@yahoo.co.jp>
-" 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:]!#$%&'∗./:=><?@\\^_`~+-]*" contained contains=wastEscapeUtf8
-syn match   wastUnnamedVar    "$\+\d\+[[:alnum:]!#$%&'∗./:=><?@\\^_`~+-]\@!" contained display
-" Presuming the source text is itself encoded correctly, strings that do not
-" contain any uses of hexadecimal byte escapes are always valid names.
-" https://webassembly.github.io/spec/core/text/values.html#names
-syn match   wastEscapedUtf8   "\\\x\{1,6}" contained containedin=wastNamedVar display
-
-" String literals
-" https://webassembly.github.io/spec/core/text/values.html#strings
-syn region  wastString        start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=wastStringSpecial
-syn match   wastStringSpecial "\\\x\x\|\\[tnr'\\\"]\|\\u\x\+" contained containedin=wastString display
-
-" Float literals
-" https://webassembly.github.io/spec/core/text/values.html#floating-point
-syn match   wastFloat         "\<-\=\d\%(_\=\d\)*\%(\.\d\%(_\=\d\)*\)\=\%([eE][-+]\=\d\%(_\=\d\)*\)\=" display contained
-syn match   wastFloat         "\<-\=0x\x\%(_\=\x\)*\%(\.\x\%(_\=\x\)*\)\=\%([pP][-+]\=\d\%(_\=\d\)*\)\=" display contained
-syn keyword wastFloat         inf nan contained
-syn match   wastFloat         "nan:0x\x\%(_\=\x\)*" display contained
-
-" Integer literals
-" https://webassembly.github.io/spec/core/text/values.html#integers
-syn match   wastNumber        "\<-\=\d\%(_\=\d\)*\>" 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=";\@<!)" contains=@wastNotTop
-
-" Types
-" https://webassembly.github.io/spec/core/text/types.html
-" Note: `mut` was changed to `const`/`var` at Wasm 2.0
-syn keyword wastType          i64 i32 f64 f32 param result funcref func externref extern mut v128 const var contained
-syn match   wastType          "\%((\_s*\)\@<=func\%(\_s*[()]\)\@=" display contained
-
-" Modules
-" https://webassembly.github.io/spec/core/text/modules.html
-syn keyword wastModule        module type export import table memory global data elem contained
-syn match   wastModule        "\%((\_s*\)\@<=func\%(\_s\+\$\)\@=" display contained
-
-syn sync maxlines=100
-
-hi def link wastModule        PreProc
-hi def link wastListDelimiter Delimiter
-hi def link wastInstWithType  Operator
-hi def link wastInstGetSet    Operator
-hi def link wastInstGeneral   Operator
-hi def link wastControlInst   Statement
-hi def link wastSimdInst      Operator
-hi def link wastParamInst     Conditional
-hi def link wastString        String
-hi def link wastStringSpecial Special
-hi def link wastNamedVar      Identifier
-hi def link wastUnnamedVar    PreProc
-hi def link wastFloat         Float
-hi def link wastNumber        Number
-hi def link wastComment       Comment
-hi def link wastType          Type
-hi def link wastEscapedUtf8   Special
-
-let b:current_syntax = "wast"
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
diff --git a/runtime/syntax/wat.vim b/runtime/syntax/wat.vim
new file mode 100644 (file)
index 0000000..a6b926b
--- /dev/null
@@ -0,0 +1,97 @@
+" Vim syntax file
+" Language:     WebAssembly
+" Maintainer:   rhysd <lin90162@yahoo.co.jp>
+" 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:]!#$%&'∗./:=><?@\\^_`~+-]*" contained contains=watEscapeUtf8
+syn match   watUnnamedVar    "$\+\d\+[[:alnum:]!#$%&'∗./:=><?@\\^_`~+-]\@!" contained display
+" Presuming the source text is itself encoded correctly, strings that do not
+" contain any uses of hexadecimal byte escapes are always valid names.
+" https://webassembly.github.io/spec/core/text/values.html#names
+syn match   watEscapedUtf8   "\\\x\{1,6}" contained containedin=watNamedVar display
+
+" String literals
+" https://webassembly.github.io/spec/core/text/values.html#strings
+syn region  watString        start=+"+ skip=+\\\\\|\\"+ end=+"+ contained contains=watStringSpecial
+syn match   watStringSpecial "\\\x\x\|\\[tnr'\\\"]\|\\u\x\+" contained containedin=watString display
+
+" Float literals
+" https://webassembly.github.io/spec/core/text/values.html#floating-point
+syn match   watFloat         "\<-\=\d\%(_\=\d\)*\%(\.\d\%(_\=\d\)*\)\=\%([eE][-+]\=\d\%(_\=\d\)*\)\=" display contained
+syn match   watFloat         "\<-\=0x\x\%(_\=\x\)*\%(\.\x\%(_\=\x\)*\)\=\%([pP][-+]\=\d\%(_\=\d\)*\)\=" display contained
+syn keyword watFloat         inf nan contained
+syn match   watFloat         "nan:0x\x\%(_\=\x\)*" display contained
+
+" Integer literals
+" https://webassembly.github.io/spec/core/text/values.html#integers
+syn match   watNumber        "\<-\=\d\%(_\=\d\)*\>" 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=";\@<!)" contains=@watNotTop
+
+" Types
+" https://webassembly.github.io/spec/core/text/types.html
+" Note: `mut` was changed to `const`/`var` at Wasm 2.0
+syn keyword watType          i64 i32 f64 f32 param result funcref func externref extern mut v128 const var contained
+syn match   watType          "\%((\_s*\)\@<=func\%(\_s*[()]\)\@=" display contained
+
+" Modules
+" https://webassembly.github.io/spec/core/text/modules.html
+syn keyword watModule        module type export import table memory global data elem contained
+syn match   watModule        "\%((\_s*\)\@<=func\%(\_s\+\$\)\@=" display contained
+
+syn sync maxlines=100
+
+hi def link watModule        PreProc
+hi def link watListDelimiter Delimiter
+hi def link watInstWithType  Operator
+hi def link watInstGetSet    Operator
+hi def link watInstGeneral   Operator
+hi def link watControlInst   Statement
+hi def link watSimdInst      Operator
+hi def link watParamInst     Conditional
+hi def link watString        String
+hi def link watStringSpecial Special
+hi def link watNamedVar      Identifier
+hi def link watUnnamedVar    PreProc
+hi def link watFloat         Float
+hi def link watNumber        Number
+hi def link watComment       Comment
+hi def link watType          Type
+hi def link watEscapedUtf8   Special
+
+let b:current_syntax = "wat"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
index 9a0a6dad522d02954d3ffc549c4c0514f8bce56b..483d01b89b42668ae0fcd37300768bb2b473fb65 100644 (file)
@@ -786,8 +786,7 @@ def s:GetFilenameChecks(): dict<list<string>>
     vrml: ['file.wrl'],
     vroom: ['file.vroom'],
     vue: ['file.vue'],
-    wat: ['file.wat'],
-    wast: ['file.wast'],
+    wat: ['file.wat', 'file.wast'],
     wdl: ['file.wdl'],
     webmacro: ['file.wm'],
     wget: ['.wgetrc', 'wgetrc'],