runtime(vim): Update base-syntax, improve enum highlighting
Match enum values and missing class keywords.
fixes: #15970
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index 9b46afd..650f2b8 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 <dougkearns@gmail.com>
-" Last Change: 2025 Apr 27
+" Last Change: 2025 May 01
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -447,8 +447,6 @@
syn region vimDefFold start="\<def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\)\+(" end="\<enddef\>" contains=vimDef fold keepend extend transparent
endif
-syn match vimFuncBlank contained "\s\+"
-
" Types: {{{2
" =====
@@ -478,6 +476,7 @@
" =============================
if s:vim9script
+
" Methods {{{3
syn match vim9MethodDef contained "\<def\>" skipwhite nextgroup=vim9MethodDefName,vim9ConstructorDefName
syn match vim9MethodDefName contained "\<\h\w*\>" nextgroup=vim9MethodDefParams contains=@vim9MethodName
@@ -557,10 +556,48 @@
VimFoldc syn region vim9ClassBody start="\<class\>" matchgroup=vimCommand end="\<endclass\>" contains=@vim9ClassBodyList transparent
" Enums {{{3
- syn cluster vim9EnumBodyList contains=vim9Comment,vim9LineComment,@vim9Continue,vim9Enum,vim9Implements,@vim9MethodDef,vim9Const,vim9Final,vim9Var
+ syn cluster vim9EnumBodyList contains=vim9Comment,vim9LineComment,@vim9Continue,vim9Enum,@vimExprList,@vim9MethodDef,vim9Public,vim9Static,vim9Const,vim9Final,vim9This,vim9Var
- syn match vim9Enum contained "\<enum\>" skipwhite nextgroup=vim9EnumName
- syn match vim9EnumName contained "\<\u\w*\>" skipwhite skipnl nextgroup=vim9Implements
+ syn match vim9Enum contained "\<enum\>" skipwhite nextgroup=vim9EnumName
+
+ syn match vim9EnumName contained "\<\u\w*\>" skipwhite skipempty nextgroup=vim9EnumNameTrailing,vim9EnumNameEmpty,vim9EnumNameComment,@vim9EnumNameContinue,vim9EnumImplements
+ syn match vim9EnumNameTrailing contained "\S.*"
+ syn region vim9EnumNameComment contained
+ \ start="#" skip="\n\s*\%(\\\|#\\ \)" end="$"
+ \ skipwhite skipempty nextgroup=vim9EnumNameComment,vim9EnumValue
+ \ contains=@vimCommentGroup,vimCommentString
+ " vim9EnumName's "skipempty" should only apply to comments and enum values and not implements clauses
+ syn match vim9EnumNameEmpty contained "^" skipwhite skipempty nextgroup=vim9EnumNameComment,vim9EnumValue
+ " allow line continuation between enum name and "implements"
+ syn match vim9EnumNameContinue contained
+ \ "^\s*\\"
+ \ skipwhite skipnl nextgroup=vim9EnumNameTrailing,vim9EnumNameEmpty,vim9EnumNameComment,@vim9EnumNameContinue,vim9EnumImplements
+ \ contains=vimWhitespace
+ syn match vim9EnumNameContinueComment contained
+ \ "^\s*#\\ .*"
+ \ skipwhite skipnl nextgroup=vim9EnumNameEmpty,vim9EnumNameComment,@vim9EnumNameContinue
+ \ contains=vimWhitespace
+ syn cluster vim9EnumNameContinue contains=vim9EnumNameContinue,vim9EnumNameContinueComment
+
+ " enforce enum value list location
+ syn match vim9EnumValue contained "\<\a\w*\>" nextgroup=vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
+ syn match vim9EnumValueListComma contained "," skipwhite skipempty nextgroup=vim9EnumValue,vim9EnumValueListCommaComment
+ syn region vim9EnumValueListCommaComment contained
+ \ start="#" skip="\n\s*\%(\\\|#\\ \)" end="$"
+ \ skipwhite skipempty nextgroup=vim9EnumValueListCommaComment,vim9EnumValue
+ \ contains=@vimCommentGroup,vimCommentString
+ syn region vim9EnumValueArgList contained
+ \ matchgroup=vimParenSep start="(" end=")"
+ \ nextgroup=vim9EnumValueListComma
+ \ contains=@vimExprList,vimContinueString,vim9Comment
+
+ syn keyword vim9EnumImplements contained implements skipwhite nextgroup=vim9EnumImplementedInterface
+ syn match vim9EnumImplementedInterface contained "\<\u\w*\>" skipwhite skipnl nextgroup=vim9EnumInterfaceListComma,vim9EnumImplementedInterfaceComment,vim9EnumValue
+ syn match vim9EnumInterfaceListComma contained "," skipwhite nextgroup=vim9EnumImplementedInterface
+ syn region vim9EnumImplementedInterfaceComment contained
+ \ start="#" skip="\n\s*\%(\\\|#\\ \)" end="$"
+ \ skipwhite skipempty nextgroup=vim9EnumImplementedInterfaceComment,vim9EnumValue
+ \ contains=@vimCommentGroup,vimCommentString
VimFolde syn region vim9EnumBody start="\<enum\>" matchgroup=vimCommand end="\<endenum\>" contains=@vim9EnumBodyList transparent
@@ -2026,6 +2063,12 @@
hi def link vim9Const vimCommand
hi def link vim9ContinueComment vimContinueComment
hi def link vim9Enum vimCommand
+ hi def link vim9EnumImplementedInterfaceComment vim9Comment
+ hi def link vim9EnumImplements vim9Implements
+ hi def link vim9EnumNameComment vim9Comment
+ hi def link vim9EnumNameContinue vimContinue
+ hi def link vim9EnumNameContinueComment vim9Comment
+ hi def link vim9EnumValueListCommaComment vim9Comment
hi def link vim9Export vimCommand
hi def link vim9Extends Keyword
hi def link vim9Final vimCommand
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum2_00.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum2_00.dump
new file mode 100644
index 0000000..9e3d0b0
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum2_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+|#+0#0000e05&| |V|i|m| |:|e|n|u|m| |c|o|m@1|a|n|d| +0#0000000&@55
+|#+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |v|i|m|9|E|n|u|m|V|a|l|u|e| |T|o|d|o| +0#0000000&@31
+@75
+@75
+|#+0#0000e05&| +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|6|3|6|5|#|i|s@1|u|e|c|o|m@1|e|n|t|-|2|5|7|1|4|2|0|5@1|1| +0#0000000&@6
+@75
+|e+0#af5f00255&|n|u|m| +0#0000000&|L|e|t@1|e|r| @63
+@4|#+0#0000e05&| +0#0000000&@69
+@4|#+0#0000e05&@40| +0#0000000&@29
+@4|A+0#0000001#ffff4012|(+0#e000e06#ffffff0|"+0#e000002&|(|\+0#e000e06&|"| +0#e000002&|#| |n|o|t| |a| |c|o|m@1|e|n|t| |N|O|R|_|A|N|O|T|H|E|R|_|V|A|L|U|E|,| +0#0000000&@29
+| +0#e000002&@7|\+0#e000e06&| +0#e000002&|"|)+0#e000e06&|,+0#0000000&| |B+0#0000001#ffff4012|(+0#e000e06#ffffff0|"+0#e000002&|)|\+0#e000e06&|"|"+0#e000002&|)+0#e000e06&|,+0#0000000&| |C+0#0000001#ffff4012|(+0#e000e06#ffffff0|$+0#e000002&|"|'@1|)| +0#0000000&@43
+| +0#e000002&@7|\+0#e000e06&|(+0#e000002&|'|"|)+0#e000e06&|,+0#0000000&| |D+0#0000001#ffff4012|(+0#e000e06#ffffff0|$+0#e000002&|'|"@1|(|)|,|"|'|)+0#e000e06&|,+0#0000000&| |E+0#0000001#ffff4012|,+0#0000000#ffffff0| @43
+@4|F+0#0000001#ffff4012|(+0#e000e06#ffffff0| +0#0000000&@68
+@4|"+0#e000002&|)|"| +0#0000000&|.+0#af5f00255&@1| +0#0000000&|#+0#0000e05&| |F|A|,| +0#0000000&@58
+@4|"+0#e000002&|(|"| +0#0000000&|#+0#0000e05&| |F|B|,| +0#0000000&@61
+@4|)+0#e000e06&|,+0#0000000&| |G+0#0000001#ffff4012| +0#0000000#ffffff0@66
+@4|#+0#0000e05&|e|n|u|m| |N|o|t|S|u|p@1|o|r|t|e|d| +0#0000000&@52
+@4|#+0#0000e05&|e|n|d|e|n|u|m| +0#0000000&@62
+@57|1|,|1| @10|T|o|p|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum2_01.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum2_01.dump
new file mode 100644
index 0000000..17e107e
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum2_01.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@3|F+0#0000001#ffff4012|(+0#e000e06#ffffff0| +0#0000000&@68
+@4|"+0#e000002&|)|"| +0#0000000&|.+0#af5f00255&@1| +0#0000000&|#+0#0000e05&| |F|A|,| +0#0000000&@58
+@4|"+0#e000002&|(|"| +0#0000000&|#+0#0000e05&| |F|B|,| +0#0000000&@61
+@4|)+0#e000e06&|,+0#0000000&| |G+0#0000001#ffff4012| +0#0000000#ffffff0@66
+@4|#+0#0000e05&|e|n|u|m| |N|o|t|S|u|p@1|o|r|t|e|d| +0#0000000&@52
+@4>#+0#0000e05&|e|n|d|e|n|u|m| +0#0000000&@62
+@75
+@4|d+0#af5f00255&|e|f| +0#0000000&|n+0#00e0e07&|e|w|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|v+0#00e0e07&|a|l|u|e| +0#0000000&|=+0#af5f00255&| +0#0000000&|v+0#00e0e07&|:|n|o|n|e|)+0#e000e06&| +0#0000000&@42
+@8|r+0#af5f00255&|e|t|u|r|n| +0#0000000&@60
+@4|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
+@4|c+0#af5f00255&|o|n|s|t| +0#0000000&|v+0#00e0e07&|a|l|u|e|:+0#0000000&| |s+0#00e0003&|t|r|i|n|g| +0#0000000&@51
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+@75
+|f+0#af5f00255&|o|r| +0#0000000&|l+0#00e0e07&|e|t@1|e|r| +0#0000000&|i+0#af5f00255&|n| +0#0000000&|L+0#00e0e07&|e|t@1|e|r|.+0#af5f00255&|v+0#00e0e07&|a|l|u|e|s| +0#0000000&@47
+@4|e+0#af5f00255&|c|h|o| +0#0000000&|l+0#00e0e07&|e|t@1|e|r| +0#0000000&@59
+|e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+@75
+|e+0#af5f00255&|c|h|o| +0#0000000&|L+0#00e0e07&|e|t@1|e|r|.+0#af5f00255&|D+0#00e0e07&| +0#0000000&@61
+@75
+@57|1|9|,|5| @9|B|o|t|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_00.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_00.dump
new file mode 100644
index 0000000..f75f63f
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+|#+0#0000e05&| |V|i|m| |:|e|n|u|m| |c|o|m@1|a|n|d| +0#0000000&@55
+|#+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |v|i|m|9|E|n|u|m|V|a|l|u|e| |T|o|d|o| +0#0000000&@31
+@75
+@75
+|i+0#af5f00255&|n|t|e|r|f|a|c|e| +0#0000000&|I|n|t|e|r|f|a|c|e|1| @54
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@62
+|e+0#af5f00255&|n|d|i|n|t|e|r|f|a|c|e| +0#0000000&@62
+|i+0#af5f00255&|n|t|e|r|f|a|c|e| +0#0000000&|I|n|t|e|r|f|a|c|e|2| @54
+|e+0#af5f00255&|n|d|i|n|t|e|r|f|a|c|e| +0#0000000&@62
+@75
+|#+0#0000e05&| |e|n|u|m|-|i|m|p|l|e|m|e|n|t|s| |c|l|a|u|s|e| |w|i|t|h| |i|n|t|e|r|s|p|e|r|s|e|d| |c|o|m@1|e|n|t|s| +0#0000000&@23
+@75
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|1| |i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @30
+@2|V+0#0000001#ffff4012|a|l|u|e|1| +0#0000000#ffffff0@66
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+@75
+@57|1|,|1| @10|T|o|p|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_01.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_01.dump
new file mode 100644
index 0000000..44352cf
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_01.dump
@@ -0,0 +1,20 @@
+|e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|E|n|u|m|1| |i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @30
+@2|V+0#0000001#ffff4012|a|l|u|e|1| +0#0000000#ffffff0@66
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+> @74
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|2| @64
+@6|\+0#e000e06&| +0#0000000&|i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @33
+@2|V+0#0000001#ffff4012|a|l|u|e|1| +0#0000000#ffffff0@66
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+@75
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|3| |#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@54
+| +0#0000e05&@5|\| |i|m|p|l|e|m|e|n|t|s| |I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| +0#0000000&@33
+@2|V+0#0000001#ffff4012|a|l|u|e|1| +0#0000000#ffffff0@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+@75
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|4| @64
+@57|1|9|,|0|-|1| @7|1|4|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_02.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_02.dump
new file mode 100644
index 0000000..6f50dcd
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_02.dump
@@ -0,0 +1,20 @@
+|e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|E|n|u|m|4| @64
+@6|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
+| +0#0000e05&@5|\| |i|m|p|l|e|m|e|n|t|s| |I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| +0#0000000&@33
+@2|V+0#0000001#ffff4012|a|l|u|e|1| +0#0000000#ffffff0@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+> @74
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|5| @64
+@6|\+0#e000e06&| +0#0000000&|i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| |#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@23
+@2|V+0#0000001#ffff4012|a|l|u|e|1| +0#0000000#ffffff0@66
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+@75
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|6| @64
+@6|#+0#0000e05&|\| +0#0000000&|c+0#0000e05&|o|m@1|e|n|t| +0#0000000&@58
+@6|\+0#e000e06&| +0#0000000&|i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @33
+@2|V+0#0000001#ffff4012|a|l|u|e|1| +0#0000000#ffffff0@66
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+@57|3|7|,|0|-|1| @7|3@1|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_03.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_03.dump
new file mode 100644
index 0000000..5bcf508
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_03.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@1|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+@75
+|#+0#0000e05&| |[|e|n|u|m| |E|n|u|m|7|.|V|a|l|u|e|1| |{|n|a|m|e|:| |'|V|a|l|u|e|1|'|,| |o|r|d|i|n|a|l|:| |0|,| |v|a|l|1|:| |0|,| |v|a|l|2|:| |0|}|,| |e|n|u|m| |E
+|n|u|m|7|.|V|a|l|u|e|2| |{|n|a|m|e|:| |'|V|a|l|u|e|2|'|,| |o|r|d|i|n|a|l|:| |1|,| |v|a|l|1|:| |1|,| |v|a|l|2|:| |0|}|,| |e|n|u|m| |E|n|u|m|7|.|V|a|l|u
+|e|3| |{|n|a|m|e|:| |'|V|a|l|u|e|3|'|,| |o|r|d|i|n|a|l|:| |2|,| |v|a|l|1|:| |2|,| |v|a|l|2|:| |0|}|]| +0#0000000&@24
+>#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@65
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|7| @64
+@6|\+0#e000e06&| +0#0000000&@67
+@6|#+0#0000e05&|\| +0#0000000&|c+0#0000e05&|o|m@1|e|n|t| +0#0000000&@58
+@6|\+0#e000e06&| +0#0000000&@67
+@6|#+0#0000e05&|\| +0#0000000&|c+0#0000e05&|o|m@1|e|n|t| +0#0000000&@58
+@6|\+0#e000e06&| +0#0000000&|i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| |#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@23
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|V+0#0000001#ffff4012|a|l|u|e|1|,+0#0000000#ffffff0| @7|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@46
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|V+0#0000001#ffff4012|a|l|u|e|2|(+0#e000e06#ffffff0|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|)+0#e000e06&|,+0#0000000&| |#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@46
+@57|5|4|,|1| @9|5|2|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_04.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_04.dump
new file mode 100644
index 0000000..2aa72a9
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_04.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@3|V+0#0000001#ffff4012|a|l|u|e|2|(+0#e000e06#ffffff0|1+0#e000002&| +0#0000000&|++0#af5f00255&| +0#0000000&|0+0#e000002&|)+0#e000e06&|,+0#0000000&| |#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@46
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|V+0#0000001#ffff4012|a|l|u|e|3|(+0#e000e06#ffffff0| +0#0000000&@2|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@51
+@6|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
+@6>1+0#e000002&| +0#0000000&@6|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@51
+@8|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@57
+@8|++0#af5f00255&| +0#0000000&@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@51
+@6|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
+@6|1+0#e000002&| +0#0000000&@6|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@51
+@4|)+0#e000e06&| +0#0000000&@8|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@51
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|v+0#af5f00255&|a|r| +0#0000000&|v+0#00e0e07&|a|l|1|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@44
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@60
+@4|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|s+0#af5f00255&|t|a|t|i|c| +0#0000000&|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|2|(+0#e000e06&|)| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@43
+@6|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
+@57|7|1|,|7| @9|7|0|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_05.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_05.dump
new file mode 100644
index 0000000..e4e7836
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_05.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@5|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@59
+@4|e+0#af5f00255&|n|d@1|e|f| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@54
+@4|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@61
+@4|p+0#af5f00255&|u|b|l|i|c| +0#0000000&|v+0#af5f00255&|a|r| +0#0000000&|v+0#00e0e07&|a|l|2|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@37
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+> @74
+|#+0#0000e05&| |[|e|n|u|m| |E|n|u|m|8|.|i|m|p|l|e|m|e|n|t|s| |{|n|a|m|e|:| |'|i|m|p|l|e|m|e|n|t|s|'|,| |o|r|d|i|n|a|l|:| |0|}|]| +0#0000000&@16
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|8| |i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @30
+@2|i+0#0000001#ffff4012|m|p|l|e|m|e|n|t|s| +0#0000000#ffffff0@62
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+@75
+|#+0#0000e05&| |[|e|n|u|m| |E|n|u|m|9|.|V|a|l|u|e|1| |{|n|a|m|e|:| |'|V|a|l|u|e|1|'|,| |o|r|d|i|n|a|l|:| |0|,| |i|m|p|l|e|m|e|n|t|s|:| |0|}|]| +0#0000000&@9
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|9| |i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @30
+@2|V+0#0000001#ffff4012|a|l|u|e|1| +0#0000000#ffffff0@66
+@2|v+0#af5f00255&|a|r| +0#0000000&|i+0#00e0e07&|m|p|l|e|m|e|n|t|s|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&@50
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+@57|8|9|,|0|-|1| @7|9|0|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_06.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_06.dump
new file mode 100644
index 0000000..38215de
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_06.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@1|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+@75
+|#+0#0000e05&| |[|e|n|u|m| |E|n|u|m|1|0|.|i|m|p|l|e|m|e|n|t|s| |{|n|a|m|e|:| |'|i|m|p|l|e|m|e|n|t|s|'|,| |o|r|d|i|n|a|l|:| |0|}|]| +0#0000000&@15
+|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|1|0| |i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @29
+@2>i+0#0000001#ffff4012|m|p|l|e|m|e|n|t|s| +0#0000000#ffffff0@62
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|e|f|1|(+0#e000e06&|)| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@66
+|e+0#af5f00255&|n|d|e|n|u|m| +0#0000000&@67
+@75
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|0|7|,|3| @8|B|o|t|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_00.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_00.dump
index 07eba76..706820b 100644
--- a/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_00.dump
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_00.dump
@@ -2,6 +2,8 @@
| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|i|m| |:|e|n|u|m| |c|o|m@1|a|n|d| +0#0000000&@53
| +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| |=| |'|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| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |v|i|m|9|E|n|u|m|V|a|l|u|e| |T|o|d|o| +0#0000000&@29
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
| +0#0000e05#a8a8a8255@1|i+0#af5f00255#ffffff0|n|t|e|r|f|a|c|e| +0#0000000&|I|n|t|e|r|f|a|c|e|1| @52
| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|i|n|t|e|r|f|a|c|e| +0#0000000&@60
@@ -15,6 +17,4 @@
||+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| |e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|E|n|u|m|3| @62
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V|a|l|u|e|1|,| @63
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V|a|l|u|e|2|,| @63
@57|1|,|1| @10|T|o|p|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_01.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_01.dump
index 1d06184..73744dd 100644
--- a/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_01.dump
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_01.dump
@@ -1,20 +1,20 @@
+||+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| |e+0#af5f00255#ffffff0|x|p|o|r|t| +0#0000000&|e+0#af5f00255&|n|u|m| +0#0000000&|E|n|u|m|2| @55
||+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| |e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|E|n|u|m|3| @62
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V|a|l|u|e|1|,| @63
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1>V|a|l|u|e|2|,| @63
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V|a|l|u|e|3| @64
+|-+0#0000e05#a8a8a8255| >e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|E|n|u|m|3| @62
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|1|,+0#0000000#ffffff0| @63
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|2|,+0#0000000#ffffff0| @63
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|3| +0#0000000#ffffff0@64
||+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| |e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|E|n|u|m|4| @62
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V|a|l|u|e|1|,| @63
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V|a|l|u|e|2|,| @63
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V|a|l|u|e|3| @64
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|1|,+0#0000000#ffffff0| @63
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|2|,+0#0000000#ffffff0| @63
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|3| +0#0000000#ffffff0@64
|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|d+0#af5f00255&|e|f| +0#0000000&|M|e|t|h|o|d|1|(+0#e000e06&|)| +0#0000000&@57
|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
||+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| |e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|E|n|u|m|5| |i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @28
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|V|a|l|u|e|1|,| @61
-@57|1|9|,|3| @9|6|5|%|
+@57|1|9|,|1| @9|4|1|%|
diff --git a/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_02.dump b/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_02.dump
index fe40d4b..b88ba57 100644
--- a/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_02.dump
+++ b/runtime/syntax/testdir/dumps/vim9_ex_enum_fold_02.dump
@@ -1,20 +1,20 @@
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|V|a|l|u|e|1|,| @61
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|V|a|l|u|e|2|,| @61
-||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|V|a|l|u|e|3| @62
-|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| +0#0000000&|M|e|t|h|o|d|1|(+0#e000e06&|)| +0#0000000&@55
-|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@5|d+0#af5f00255&|e|f| +0#0000000&|N|e|s|t|e|d|(+0#e000e06&|)| +0#0000000&@54
-|3+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@5>e+0#af5f00255&|n|d@1|e|f| +0#0000000&@60
-|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|E|n|u|m|5| |i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @28
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|1|,+0#0000000#ffffff0| @63
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|2|,+0#0000000#ffffff0| @63
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|3| +0#0000000#ffffff0@64
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1>d+0#af5f00255&|e|f| +0#0000000&|M|e|t|h|o|d|1|(+0#e000e06&|)| +0#0000000&@57
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| +0#0000000&|N|e|s|t|e|d|(+0#e000e06&|)| +0#0000000&@56
+|3+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@62
+|2+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d|e|n|u|m| +0#0000000&@65
-|~+0#4040ff13&| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-|~| @73
-| +0#0000000&@56|3|7|,|7| @9|B|o|t|
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|u|m| +0#0000000&|E|n|u|m|6| @62
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@5|#+0#0000e05&|\| +0#0000000&|c+0#0000e05&|o|m@1|e|n|t| +0#0000000&@56
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@5|\+0#e000e06&| +0#0000000&|i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|I|n|t|e|r|f|a|c|e|1|,| |I|n|t|e|r|f|a|c|e|2| @31
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|1|,+0#0000000#ffffff0| @63
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|2|,+0#0000000#ffffff0| @63
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|V+0#0000001#ffff4012|a|l|u|e|3| +0#0000000#ffffff0@64
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d|e|n|u|m| +0#0000000&@65
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+@57|3|7|,|3| @9|B|o|t|
diff --git a/runtime/syntax/testdir/input/setup/vim9_ex_enum.vim b/runtime/syntax/testdir/input/setup/vim9_ex_enum.vim
new file mode 100644
index 0000000..ebd90ed
--- /dev/null
+++ b/runtime/syntax/testdir/input/setup/vim9_ex_enum.vim
@@ -0,0 +1 @@
+hi link vimVar Identifier
diff --git a/runtime/syntax/testdir/input/setup/vim9_ex_enum2.vim b/runtime/syntax/testdir/input/setup/vim9_ex_enum2.vim
new file mode 100644
index 0000000..ebd90ed
--- /dev/null
+++ b/runtime/syntax/testdir/input/setup/vim9_ex_enum2.vim
@@ -0,0 +1 @@
+hi link vimVar Identifier
diff --git a/runtime/syntax/testdir/input/vim9_ex_enum.vim b/runtime/syntax/testdir/input/vim9_ex_enum.vim
new file mode 100644
index 0000000..8529ded
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_ex_enum.vim
@@ -0,0 +1,111 @@
+vim9script
+# Vim :enum command
+# VIM_TEST_SETUP hi link vim9EnumValue Todo
+
+
+interface Interface1
+ def Def1()
+endinterface
+interface Interface2
+endinterface
+
+# enum-implements clause with interspersed comments
+
+enum Enum1 implements Interface1, Interface2
+ Value1
+ def Def1()
+ enddef
+endenum
+
+enum Enum2
+ \ implements Interface1, Interface2
+ Value1
+ def Def1()
+ enddef
+endenum
+
+enum Enum3 # comment
+ \ implements Interface1, Interface2
+ Value1
+endenum
+
+enum Enum4
+ # comment
+ \ implements Interface1, Interface2
+ Value1
+endenum
+
+enum Enum5
+ \ implements Interface1, Interface2 # comment
+ Value1
+ def Def1()
+ enddef
+endenum
+
+enum Enum6
+ #\ comment
+ \ implements Interface1, Interface2
+ Value1
+ def Def1()
+ enddef
+endenum
+
+# [enum Enum7.Value1 {name: 'Value1', ordinal: 0, val1: 0, val2: 0}, enum Enum7.Value2 {name: 'Value2', ordinal: 1, val1: 1, val2: 0}, enum Enum7.Value3 {name: 'Value3', ordinal: 2, val1: 2, val2: 0}]
+# comment
+enum Enum7
+ \
+ #\ comment
+ \
+ #\ comment
+ \ implements Interface1, Interface2 # comment
+ # comment
+ # comment
+ Value1, # comment
+ # comment
+ # comment
+ Value2(1 + 0), # comment
+ # comment
+ # comment
+ Value3( # comment
+ # comment
+ 1 # comment
+ # comment
+ + # comment
+ # comment
+ 1 # comment
+ ) # comment
+ # comment
+ var val1: number # comment
+ # comment
+ def Def1()
+ enddef
+ # comment
+ static def Def2() # comment
+ # comment
+ enddef # comment
+ # comment
+ public var val2: number # comment
+endenum
+
+# [enum Enum8.implements {name: 'implements', ordinal: 0}]
+enum Enum8 implements Interface1, Interface2
+ implements
+ def Def1()
+ enddef
+endenum
+
+# [enum Enum9.Value1 {name: 'Value1', ordinal: 0, implements: 0}]
+enum Enum9 implements Interface1, Interface2
+ Value1
+ var implements: number
+ def Def1()
+ enddef
+endenum
+
+# [enum Enum10.implements {name: 'implements', ordinal: 0}]
+enum Enum10 implements Interface1, Interface2
+ implements
+ def Def1()
+ enddef
+endenum
+
diff --git a/runtime/syntax/testdir/input/vim9_ex_enum2.vim b/runtime/syntax/testdir/input/vim9_ex_enum2.vim
new file mode 100644
index 0000000..e3b3d2d
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_ex_enum2.vim
@@ -0,0 +1,32 @@
+vim9script
+# Vim :enum command
+# VIM_TEST_SETUP hi link vim9EnumValue Todo
+
+
+# See: https://github.com/vim/vim/pull/16365#issuecomment-2571420551
+
+enum Letter
+ #
+ #########################################
+ A("(\" # not a comment NOR_ANOTHER_VALUE,
+ \ "), B(")\""), C($"'')
+ \('"), D($'""(),"'), E,
+ F(
+ ")" .. # FA,
+ "(" # FB,
+ ), G
+ #enum NotSupported
+ #endenum
+
+ def new(this.value = v:none)
+ return
+ enddef
+ const value: string
+endenum
+
+for letter in Letter.values
+ echo letter
+endfor
+
+echo Letter.D
+
diff --git a/runtime/syntax/testdir/input/vim9_ex_enum_fold.vim b/runtime/syntax/testdir/input/vim9_ex_enum_fold.vim
index 0656907..b6dfc4e 100644
--- a/runtime/syntax/testdir/input/vim9_ex_enum_fold.vim
+++ b/runtime/syntax/testdir/input/vim9_ex_enum_fold.vim
@@ -2,6 +2,8 @@
# Vim :enum command
# VIM_TEST_SETUP let g:vimsyn_folding = 'ef'
# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
+# VIM_TEST_SETUP hi link vim9EnumValue Todo
+
interface Interface1
endinterface
@@ -29,11 +31,20 @@
endenum
enum Enum5 implements Interface1, Interface2
- Value1,
- Value2,
- Value3
- def Method1()
- def Nested()
- enddef
+ Value1,
+ Value2,
+ Value3
+ def Method1()
+ def Nested()
enddef
+ enddef
endenum
+
+enum Enum6
+ #\ comment
+ \ implements Interface1, Interface2
+ Value1,
+ Value2,
+ Value3
+endenum
+
diff --git a/runtime/syntax/testdir/input/vim9_shebang.vim b/runtime/syntax/testdir/input/vim9_shebang.vim
old mode 100755
new mode 100644
diff --git a/runtime/syntax/testdir/input/vim_shebang.vim b/runtime/syntax/testdir/input/vim_shebang.vim
old mode 100755
new mode 100644
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 2bf0f7d..5b8a5ba 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 <dougkearns@gmail.com>
-" Last Change: 2025 Apr 27
+" Last Change: 2025 May 01
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -499,8 +499,6 @@
syn region vimDefFold start="\<def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\)\+(" end="\<enddef\>" contains=vimDef fold keepend extend transparent
endif
-syn match vimFuncBlank contained "\s\+"
-
" Types: {{{2
" =====
@@ -530,6 +528,7 @@
" =============================
if s:vim9script
+
" Methods {{{3
syn match vim9MethodDef contained "\<def\>" skipwhite nextgroup=vim9MethodDefName,vim9ConstructorDefName
syn match vim9MethodDefName contained "\<\h\w*\>" nextgroup=vim9MethodDefParams contains=@vim9MethodName
@@ -609,10 +608,48 @@
VimFoldc syn region vim9ClassBody start="\<class\>" matchgroup=vimCommand end="\<endclass\>" contains=@vim9ClassBodyList transparent
" Enums {{{3
- syn cluster vim9EnumBodyList contains=vim9Comment,vim9LineComment,@vim9Continue,vim9Enum,vim9Implements,@vim9MethodDef,vim9Const,vim9Final,vim9Var
+ syn cluster vim9EnumBodyList contains=vim9Comment,vim9LineComment,@vim9Continue,vim9Enum,@vimExprList,@vim9MethodDef,vim9Public,vim9Static,vim9Const,vim9Final,vim9This,vim9Var
- syn match vim9Enum contained "\<enum\>" skipwhite nextgroup=vim9EnumName
- syn match vim9EnumName contained "\<\u\w*\>" skipwhite skipnl nextgroup=vim9Implements
+ syn match vim9Enum contained "\<enum\>" skipwhite nextgroup=vim9EnumName
+
+ syn match vim9EnumName contained "\<\u\w*\>" skipwhite skipempty nextgroup=vim9EnumNameTrailing,vim9EnumNameEmpty,vim9EnumNameComment,@vim9EnumNameContinue,vim9EnumImplements
+ syn match vim9EnumNameTrailing contained "\S.*"
+ syn region vim9EnumNameComment contained
+ \ start="#" skip="\n\s*\%(\\\|#\\ \)" end="$"
+ \ skipwhite skipempty nextgroup=vim9EnumNameComment,vim9EnumValue
+ \ contains=@vimCommentGroup,vimCommentString
+ " vim9EnumName's "skipempty" should only apply to comments and enum values and not implements clauses
+ syn match vim9EnumNameEmpty contained "^" skipwhite skipempty nextgroup=vim9EnumNameComment,vim9EnumValue
+ " allow line continuation between enum name and "implements"
+ syn match vim9EnumNameContinue contained
+ \ "^\s*\\"
+ \ skipwhite skipnl nextgroup=vim9EnumNameTrailing,vim9EnumNameEmpty,vim9EnumNameComment,@vim9EnumNameContinue,vim9EnumImplements
+ \ contains=vimWhitespace
+ syn match vim9EnumNameContinueComment contained
+ \ "^\s*#\\ .*"
+ \ skipwhite skipnl nextgroup=vim9EnumNameEmpty,vim9EnumNameComment,@vim9EnumNameContinue
+ \ contains=vimWhitespace
+ syn cluster vim9EnumNameContinue contains=vim9EnumNameContinue,vim9EnumNameContinueComment
+
+ " enforce enum value list location
+ syn match vim9EnumValue contained "\<\a\w*\>" nextgroup=vim9EnumValueArgList,vim9EnumValueListComma,vim9Comment
+ syn match vim9EnumValueListComma contained "," skipwhite skipempty nextgroup=vim9EnumValue,vim9EnumValueListCommaComment
+ syn region vim9EnumValueListCommaComment contained
+ \ start="#" skip="\n\s*\%(\\\|#\\ \)" end="$"
+ \ skipwhite skipempty nextgroup=vim9EnumValueListCommaComment,vim9EnumValue
+ \ contains=@vimCommentGroup,vimCommentString
+ syn region vim9EnumValueArgList contained
+ \ matchgroup=vimParenSep start="(" end=")"
+ \ nextgroup=vim9EnumValueListComma
+ \ contains=@vimExprList,vimContinueString,vim9Comment
+
+ syn keyword vim9EnumImplements contained implements skipwhite nextgroup=vim9EnumImplementedInterface
+ syn match vim9EnumImplementedInterface contained "\<\u\w*\>" skipwhite skipnl nextgroup=vim9EnumInterfaceListComma,vim9EnumImplementedInterfaceComment,vim9EnumValue
+ syn match vim9EnumInterfaceListComma contained "," skipwhite nextgroup=vim9EnumImplementedInterface
+ syn region vim9EnumImplementedInterfaceComment contained
+ \ start="#" skip="\n\s*\%(\\\|#\\ \)" end="$"
+ \ skipwhite skipempty nextgroup=vim9EnumImplementedInterfaceComment,vim9EnumValue
+ \ contains=@vimCommentGroup,vimCommentString
VimFolde syn region vim9EnumBody start="\<enum\>" matchgroup=vimCommand end="\<endenum\>" contains=@vim9EnumBodyList transparent
@@ -2086,6 +2123,12 @@
hi def link vim9Const vimCommand
hi def link vim9ContinueComment vimContinueComment
hi def link vim9Enum vimCommand
+ hi def link vim9EnumImplementedInterfaceComment vim9Comment
+ hi def link vim9EnumImplements vim9Implements
+ hi def link vim9EnumNameComment vim9Comment
+ hi def link vim9EnumNameContinue vimContinue
+ hi def link vim9EnumNameContinueComment vim9Comment
+ hi def link vim9EnumValueListCommaComment vim9Comment
hi def link vim9Export vimCommand
hi def link vim9Extends Keyword
hi def link vim9Final vimCommand