runtime(vim): Update base syntax, match enum constructor type args
Commit:
https://github.com/vim/vim/commit/4de931daae88784aacd1dc4ecd92ca6fb4a45977
Author: Doug Kearns <[email protected]>
Date: Thu Jul 24 18:54:16 2025 +0200
runtime(vim): Update base syntax, match enum constructor type args
closes: https://github.com/vim/vim/issues/17840
Co-authored-by: Aliaksei Budavei <[email protected]>
Signed-off-by: Doug Kearns <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/syntax/generator/vim.vim.base
b/runtime/syntax/generator/vim.vim.base
index 7a3e45905..ceee9fe9f 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <[email protected]>
-" Last Change: 2025 Jul 23
+" Last Change: 2025 Jul 24
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -698,12 +698,19 @@ if s:vim9script
syn cluster vim9EnumNameContinue
contains=vim9EnumNameContinue,vim9EnumNameContinueComment
" enforce enum value list location
- syn match vim9EnumValue contained "\< \w*\>"
nextgroup=vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
+ syn match vim9EnumValue contained "\< \w*\>"
nextgroup=vim9EnumValueTypeArgs,vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
syn match vim9EnumValueListComma contained "," skipwhite
skipempty nextgroup=vim9EnumValue,vim9EnumValueListCommaComment
syn region vim9EnumValueListCommaComment contained
\ start="#" skip="
\s*\%(\\|#\ \)" end="$"
\ skipwhite skipempty
nextgroup=vim9EnumValueListCommaComment,vim9EnumValue
\ contains=@vimCommentGroup,vimCommentString
+ syn region vim9EnumValueTypeArgs contained
+ \ matchgroup=Delimiter
+ \ start="<\ze "
+ \ end=">"
+ \ nextgroup=vim9EnumValueArgList
+ \ contains=@vimType
+ \ oneline
syn region vim9EnumValueArgList contained
\ matchgroup=vimParenSep start="(" end=")"
\ nextgroup=vim9EnumValueListComma
diff --git
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_enum_00.dump
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_enum_00.dump
new file mode 100644
index 000000000..165cc4c79
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_enum_00.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t|
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P|
|h|i|g|h|l|i|g|h|t| |l|i|n|k| |v|i|m|9|D|e|f|T|y|p|e|P|a|r|a|m| |T|o|d|o|
+0#0000000&@19
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P|
|h|i|g|h|l|i|g|h|t| |l|i|n|k| |v|i|m|9|E|n|u|m|V|a|l|u|e| |I|d|e|n|t|i|f|i|e|r|
+0#0000000&@16
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t|
|g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |"+0#e000002&|e|f|"| +0#0000000&@28
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l|
|f|d|c|=|2| |f|d|l|=|9@1| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@27
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| +0#0000000&|S+0#e000e06&|e@1|:|
+0#0000e05&|h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|p|u|l@1|/|1|7|3|1|3|#|i|s@1|u|e|c|o|m@1|e|n|t|-|3|0|3@1|5|3|7|1|2|7|
|(|A|l|i
+| +0&#a8a8a8255@1|a+0&#ffffff0|k|s|e|i| |B|u|d|a|v|e|i|)| +0#0000000&@58
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|u|m|
+0#0000000&|C|o|m@1|o|n|P|a|i|r| @57
+||+0#0000e05#a8a8a8255| |
+0#0000000#ffffff0@3|H+0#00e0e07&|e|l@1|o|W|o|r|l|d|<+0#e000e06&|s+0#00e0003&|t|r|i|n|g|,+0#0000000&|
|s+0#00e0003&|t|r|i|n|g|>+0#e000e06&|(|'+0#e000002&|h|e|l@1|o|'|,+0#0000000&|
|'+0#e000002&|w|o|r|l|d|'|)+0#e000e06&|,+0#0000000&| @23
+||+0#0000e05#a8a8a8255| |
+0#0000000#ffffff0@3|B+0#00e0e07&|o@1|l|e|a|n|s|<+0#e000e06&|b+0#00e0003&|o@1|l|,+0#0000000&|
|b+0#00e0003&|o@1|l|>+0#e000e06&|(|t+0#e000002&|r|u|e|,+0#0000000&|
|f+0#e000002&|a|l|s|e|)+0#e000e06&| +0#0000000&@35
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t|
+0#0000000&|_|f|s|t|:| |a+0#00e0003&|n|y| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t|
+0#0000000&|_|s|n|d|:| |a+0#00e0003&|n|y| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f|
+0#0000000&|n+0#00e0e07&|e|w|<+0#e000e06&|T+0#0000001#ffff4012|,+0#0000000#ffffff0|
|U+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|f+0#0000000&|s|t|:| |T|,|
|s|n|d|:| |U|)+0#e000e06&| +0#0000000&@39
+|2+0#0000e05#a8a8a8255| |
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|f|s|t|
|=+0#af5f00255&| +0#0000000&|f|s|t| @49
+|2+0#0000e05#a8a8a8255| |
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|n|d|
|=+0#af5f00255&| +0#0000000&|s|n|d| @49
+@57|1|,|1| @10|T|o|p|
diff --git
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_enum_01.dump
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_enum_01.dump
new file mode 100644
index 000000000..e7f119701
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_enum_01.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t|
+0#0000000&|_|f|s|t|:| |a+0#00e0003&|n|y| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t|
+0#0000000&|_|s|n|d|:| |a+0#00e0003&|n|y| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f|
+0#0000000&|n+0#00e0e07&|e|w|<+0#e000e06&|T+0#0000001#ffff4012|,+0#0000000#ffffff0|
|U+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|f+0#0000000&|s|t|:| |T|,|
|s|n|d|:| |U|)+0#e000e06&| +0#0000000&@39
+|2+0#0000e05#a8a8a8255| |
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|f|s|t|
|=+0#af5f00255&| +0#0000000&|f|s|t| @49
+|2+0#0000e05#a8a8a8255| |
+0#0000000#ffffff0@7>t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|n|d|
|=+0#af5f00255&| +0#0000000&|s|n|d| @49
+|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f|
+0#0000000&@62
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f|
+0#0000000&|F|i|r|s|t|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
|T| @51
+|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n|
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|f|s|t| @48
+|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f|
+0#0000000&@62
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f|
+0#0000000&|S|e|c|o|n|d|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
|T| @50
+|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n|
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|n|d| @48
+|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f|
+0#0000000&@62
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f|
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)|:+0#0000000&|
|s+0#00e0003&|t|r|i|n|g| +0#0000000&@48
+|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n|
+0#0000000&|p+0#00e0e07&|r|i|n|t|f|(+0#e000e06&|"+0#e000002&|(|%|s|,|
|%|s|)|"|,+0#0000000&| |t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|f|s|t|,|
|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|n|d|)+0#e000e06&|
+0#0000000&@17
+|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f|
+0#0000000&@62
+@57|1|8|,|9| @9|7|0|%|
diff --git
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_enum_02.dump
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_enum_02.dump
new file mode 100644
index 000000000..4dde18a4f
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_enum_02.dump
@@ -0,0 +1,20 @@
+|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f|
+0#0000000&@62
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d|e|n|u|m| +0#0000000&@65
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o|
+0#0000000&|C|o|m@1|o|n|P|a|i|r|.+0#af5f00255&|H+0#0000000&|e|l@1|o|W|o|r|l|d|
@46
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o|
+0#0000000&|C|o|m@1|o|n|P|a|i|r|.+0#af5f00255&|B+0#0000000&|o@1|l|e|a|n|s| @48
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|3|6|,|0|-|1| @7|B|o|t|
diff --git
a/runtime/syntax/testdir/input/vim9_generic_function_example_enum.vim
b/runtime/syntax/testdir/input/vim9_generic_function_example_enum.vim
new file mode 100644
index 000000000..037392134
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_generic_function_example_enum.vim
@@ -0,0 +1,36 @@
+vim9script
+# VIM_TEST_SETUP highlight link vim9DefTypeParam Todo
+# VIM_TEST_SETUP highlight link vim9EnumValue Identifier
+# VIM_TEST_SETUP let g:vimsyn_folding = "ef"
+# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
+# See: https://github.com/vim/vim/pull/17313#issuecomment-3033537127 (Aliaksei
Budavei)
+
+
+enum CommonPair
+ HelloWorld<string, string>('hello', 'world'),
+ Booleans<bool, bool>(true, false)
+
+ const _fst: any
+ const _snd: any
+
+ def new<T, U>(fst: T, snd: U)
+ this._fst = fst
+ this._snd = snd
+ enddef
+
+ def First<T>(): T
+ return this._fst
+ enddef
+
+ def Second<T>(): T
+ return this._snd
+ enddef
+
+ def string(): string
+ return printf("(%s, %s)", this._fst, this._snd)
+ enddef
+endenum
+
+echo CommonPair.HelloWorld
+echo CommonPair.Booleans
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index ec7d4784d..eebd6ba4a 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <[email protected]>
-" Last Change: 2025 Jul 23
+" Last Change: 2025 Jul 24
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -752,12 +752,19 @@ if s:vim9script
syn cluster vim9EnumNameContinue
contains=vim9EnumNameContinue,vim9EnumNameContinueComment
" enforce enum value list location
- syn match vim9EnumValue contained "\< \w*\>"
nextgroup=vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
+ syn match vim9EnumValue contained "\< \w*\>"
nextgroup=vim9EnumValueTypeArgs,vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
syn match vim9EnumValueListComma contained "," skipwhite
skipempty nextgroup=vim9EnumValue,vim9EnumValueListCommaComment
syn region vim9EnumValueListCommaComment contained
\ start="#" skip="
\s*\%(\\|#\ \)" end="$"
\ skipwhite skipempty
nextgroup=vim9EnumValueListCommaComment,vim9EnumValue
\ contains=@vimCommentGroup,vimCommentString
+ syn region vim9EnumValueTypeArgs contained
+ \ matchgroup=Delimiter
+ \ start="<\ze "
+ \ end=">"
+ \ nextgroup=vim9EnumValueArgList
+ \ contains=@vimType
+ \ oneline
syn region vim9EnumValueArgList contained
\ matchgroup=vimParenSep start="(" end=")"
\ nextgroup=vim9EnumValueListComma
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1uezIf-007yaQ-Nr%40256bit.org.