runtime(vim): Update base-syntax, fix function tail comments
Commit:
https://github.com/vim/vim/commit/fc64ac0be2c4f9446798de4d66b029526d1afa85
Author: Doug Kearns <dougkea...@gmail.com>
Date: Sat Jun 22 11:20:36 2024 +0200
runtime(vim): Update base-syntax, fix function tail comments
Match Vim9-script comments after :def and :enddef and legacy-script
comments after :func and :endfunc, in any definition context.
Highlight incorrect comment types after these commands as errors.
fixes: #15062
closes: #15072
Signed-off-by: Doug Kearns <dougkea...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>
diff --git a/runtime/syntax/generator/vim.vim.base
b/runtime/syntax/generator/vim.vim.base
index adfd68ee6..6bb2d44c8 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -3,7 +3,7 @@
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkea...@gmail.com>
" URL: https://github.com/vim-jp/syntax-vim-ex
-" Last Change: 2024 Jun 17
+" Last Change: 2024 Jun 21
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -277,19 +277,19 @@ syn keyword vimFuncKey contained
fu[nction]
syn keyword vimDefKey contained def
syn keyword vimMethodName contained empty len string
-syn region vimFuncParams contained matchgroup=Delimiter start="("
skip=+
\s*\\|
\s*"\ + end=")" skipwhite skipnl
nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod
contains=vimFuncParam,@vimContinue
-syn region vimDefParams contained matchgroup=Delimiter start="("
end=")" skipwhite skipnl
nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType
contains=vimDefParam,vim9Comment
+syn region vimFuncParams contained matchgroup=Delimiter start="("
skip=+
\s*\\|
\s*"\ + end=")" skipwhite skipnl
nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError
contains=vimFuncParam,@vimContinue
+syn region vimDefParams contained matchgroup=Delimiter start="("
end=")" skipwhite skipnl
nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError
contains=vimDefParam,vim9Comment
syn match vimFuncParam contained "\<\h\w*\>\|\.\.\."
skipwhite nextgroup=vimFuncParamEquals
syn match vimDefParam contained "\<\h\w*\>"
skipwhite nextgroup=vimParamType,vimFuncParamEquals
syn match vimFuncParamEquals contained "="
skipwhite nextgroup=@vimExprList
-syn match vimFuncMod contained
"\<\%(abort\|closure\|dict\|range\)\>" skipwhite skipnl
nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod
+syn match vimFuncMod contained
"\<\%(abort\|closure\|dict\|range\)\>" skipwhite skipnl
nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError
-syn region vimFuncBody contained start="^"
matchgroup=vimCommand end="\<endfu\%[nction]\>" contains=@vimFuncBodyList
-syn region vimDefBody contained start="^"
matchgroup=vimCommand end="\<enddef\>" contains=@vimDefBodyList
+syn region vimFuncBody contained start="^.\="
matchgroup=vimCommand end="\<endfu\%[nction]\>" contains=@vimFuncBodyList
skipwhite nextgroup=vimCmdSep,vimComment,vim9CommentError
+syn region vimDefBody contained start="^.\="
matchgroup=vimCommand end="\<enddef\>" contains=@vimDefBodyList skipwhite
nextgroup=vimCmdSep,vim9Comment,vimCommentError
-syn match vimEndfunction "\<endf\%[unction]\>"
-syn match vimEnddef "\<enddef\>"
+syn match vimEndfunction "\<endf\%[unction]\>" skipwhite
nextgroup=vimCmdSep,vimComment,vim9CommentError
+syn match vimEnddef "\<enddef\>" skipwhite
nextgroup=vimCmdSep,vim9Comment,vimCommentError
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
syn region vimFuncFold
start="^\s*:\=\s*fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+\s*("
end="^\s*:\=\s*endf\%[unction]\>" contains=vimFunction fold keepend
extend transparent
@@ -303,7 +303,7 @@ syn match vimFuncBlank contained "\s\+"
" Types: {{{2
" =====
" vimTypes : new for vim9
-syn region vimReturnType contained start=":\s" end="$"
matchgroup=vim9Comment end="\ze#" skipwhite skipnl
nextgroup=vimDefBody,vimDefComment,vimEnddef contains=vimTypeSep transparent
+syn region vimReturnType contained start=":\s" end="$"
matchgroup=vim9Comment end="\ze[#"]" skipwhite skipnl
nextgroup=vimDefBody,vimDefComment,vimEnddef,vimCommentError
contains=vimTypeSep transparent
syn match vimParamType contained ":\s\+ "
skipwhite skipnl nextgroup=vimFuncParamEquals
contains=vimTypeSep,@vimType
syn match vimTypeSep contained ":\s\@=" skipwhite
nextgroup=@vimType
@@ -408,6 +408,9 @@ else
syn cluster vimComment contains=vimComment
endif
+syn match vim9CommentError contained "#.*"
+syn match vimCommentError contained +".*+
+
" Environment Variables: {{{2
" =====================
syn match vimEnvvar "\$\I\i*"
@@ -1091,7 +1094,9 @@ if !exists("skip_vim_syntax_inits")
hi def link vimCmplxRepeat SpecialChar
hi def link vimCommand Statement
hi def link vimComment Comment
+ hi def link vimCommentError vimError
hi def link vim9Comment Comment
+ hi def link vim9CommentError vimError
hi def link vimCommentString vimString
hi def link vimCommentTitle PreProc
hi def link vim9CommentTitle PreProc
@@ -1100,7 +1105,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimContinue Special
hi def link vimContinueComment vimComment
hi def link vimCtrlChar SpecialChar
- hi def link vimDefComment vimComment
+ hi def link vimDefComment vim9Comment
hi def link vimDefKey vimCommand
hi def link vimDefParam vimVar
hi def link vimEcho vimCommand
diff --git
a/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_00.dump
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_00.dump
new file mode 100644
index 000000000..04f643ddf
--- /dev/null
+++
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+@75
+|#+0#0000e05&| |V|i|m|9| |:|f|u|n|c|t|i|o|n| |a|n|d| |:|d|e|f| |t|a|i|l|
|c|o|m@1|e|n|t| |e|r@1|o|r|s| +0#0000000&@29
+|#+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |u|n|l|e|t|!|
|g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| +0#0000000&@34
+@75
+|f+0#af5f00255&|u|n| +0#0000000&|T|e|s|t|1|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|1+0#e000002&| +0#0000000&@64
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|2|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@12|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|2+0#e000002&| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|"+0#ffffff16#ff404010| |e|n|d@1|e|f|
+0#0000000#ffffff0@34
+@75
+|f+0#af5f00255&|u|n| +0#0000000&|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@2|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@8|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|3+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|#+0#ffffff16#ff404010|
|e|n|d|f|u|n| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@57|1|,|1| @10|T|o|p|
diff --git
a/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_01.dump
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_01.dump
new file mode 100644
index 000000000..cb7caf568
--- /dev/null
+++
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_01.dump
@@ -0,0 +1,20 @@
+|f+0#af5f00255#ffffff0|u|n| +0#0000000&|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@2|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@8|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|3+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|#+0#ffffff16#ff404010|
|e|n|d|f|u|n| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&@54
+>e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@12|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|o|T|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@8|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|4+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|"+0#ffffff16#ff404010|
|e|n|d@1|e|f| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|4|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|"+0#ffffff16#ff404010| |e|n|d@1|e|f|
+0#0000000#ffffff0@34
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|5|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@12|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@2|f+0#af5f00255&|u|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@10|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|5+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|#+0#ffffff16#ff404010|
|e|n|d|f|u|n| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&@56
+@57|1|9|,|1| @9|5|2|%|
diff --git
a/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_02.dump
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_02.dump
new file mode 100644
index 000000000..e74df6743
--- /dev/null
+++
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_02.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@1|r+0#af5f00255&|e|t|u|r|n|
+0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)| +0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|"+0#ffffff16#ff404010| |e|n|d@1|e|f|
+0#0000000#ffffff0@34
+@75
+|f+0#af5f00255&|u|n| +0#0000000&|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@2|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|6|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@6|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@4>r+0#af5f00255&|e|t|u|r|n| +0#0000000&|6+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|"+0#ffffff16#ff404010|
|e|n|d@1|e|f| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@75
+|f+0#af5f00255&|o|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|i+0#af5f00255&|n|
+0#0000000&|r+0#00e0e07&|a|n|g|e|(+0#e000e06&|1+0#e000002&|,+0#0000000&|
|6+0#e000002&|)+0#e000e06&| +0#0000000&@54
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|e|c|h|o|
|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|(+0#e000002&|)|'| +0#0000000&@50
+|e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|3|7|,|5| @9|B|o|t|
diff --git
a/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_99.dump
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_99.dump
new file mode 100644
index 000000000..3e5b28007
--- /dev/null
+++
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_99.dump
@@ -0,0 +1,20 @@
+|e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@25|"+0#ffffff16#ff404010|
|e|n|d@1|e|f| +0#0000000#ffffff0@34
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|5|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@12|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@2|f+0#af5f00255&|u|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@10|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|5+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|#+0#ffffff16#ff404010|
|e|n|d|f|u|n| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|"+0#ffffff16#ff404010| |e|n|d@1|e|f|
+0#0000000#ffffff0@34
+@75
+|f+0#af5f00255&|u|n| +0#0000000&|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@2|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|6|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@6|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|6+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|"+0#ffffff16#ff404010|
|e|n|d@1|e|f| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@75
+|f+0#af5f00255&|o|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|i+0#af5f00255&|n|
+0#0000000&|r+0#00e0e07&|a|n|g|e|(+0#e000e06&|1+0#e000002&|,+0#0000000&|
|6+0#e000002&|)+0#e000e06&| +0#0000000&@54
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|e|c|h|o|
|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|(+0#e000002&|)|'| +0#0000000&@50
+>e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+@57|4@1|,|1| @9|B|o|t|
diff --git
a/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_00.dump
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_00.dump
new file mode 100644
index 000000000..b6ed4904d
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+@75
+|#+0#0000e05&| |V|i|m|9| |:|f|u|n|c|t|i|o|n| |a|n|d| |:|d|e|f| |t|a|i|l|
|c|o|m@1|e|n|t|s| +0#0000000&@35
+|#+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |u|n|l|e|t|!|
|g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| +0#0000000&@34
+@75
+|f+0#af5f00255&|u|n| +0#0000000&|T|e|s|t|1|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|1+0#e000002&| +0#0000000&@64
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|2|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@12|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|2+0#e000002&| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@75
+|f+0#af5f00255&|u|n| +0#0000000&|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@2|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@8|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|3+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@57|1|,|1| @10|T|o|p|
diff --git
a/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_01.dump
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_01.dump
new file mode 100644
index 000000000..6cb37d125
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_01.dump
@@ -0,0 +1,20 @@
+|f+0#af5f00255#ffffff0|u|n| +0#0000000&|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@2|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@8|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|3+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&@54
+>e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@12|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|o|T|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@8|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|4+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|4|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|5|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@12|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@2|f+0#af5f00255&|u|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@10|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|5+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&@56
+@57|1|9|,|1| @9|5|2|%|
diff --git
a/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_02.dump
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_02.dump
new file mode 100644
index 000000000..7df9e8f15
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_02.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@1|r+0#af5f00255&|e|t|u|r|n|
+0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)| +0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@75
+|f+0#af5f00255&|u|n| +0#0000000&|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@2|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|6|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@6|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@4>r+0#af5f00255&|e|t|u|r|n| +0#0000000&|6+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@75
+|f+0#af5f00255&|o|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|i+0#af5f00255&|n|
+0#0000000&|r+0#00e0e07&|a|n|g|e|(+0#e000e06&|1+0#e000002&|,+0#0000000&|
|6+0#e000002&|)+0#e000e06&| +0#0000000&@54
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|e|c|h|o|
|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|(+0#e000002&|)|'| +0#0000000&@50
+|e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|3|7|,|5| @9|B|o|t|
diff --git
a/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_99.dump
b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_99.dump
new file mode 100644
index 000000000..42d9f8cdc
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_99.dump
@@ -0,0 +1,20 @@
+|e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@25|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|5|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@12|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@2|f+0#af5f00255&|u|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@10|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|5+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@75
+|f+0#af5f00255&|u|n| +0#0000000&|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@14|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@2|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|6|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@6|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|6+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@75
+|f+0#af5f00255&|o|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|i+0#af5f00255&|n|
+0#0000000&|r+0#00e0e07&|a|n|g|e|(+0#e000e06&|1+0#e000002&|,+0#0000000&|
|6+0#e000002&|)+0#e000e06&| +0#0000000&@54
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|e|c|h|o|
|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|(+0#e000002&|)|'| +0#0000000&@50
+>e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+@57|4@1|,|1| @9|B|o|t|
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_05.dump
b/runtime/syntax/testdir/dumps/vim_ex_def_05.dump
index 2db207b43..076428cd9 100644
--- a/runtime/syntax/testdir/dumps/vim_ex_def_05.dump
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_05.dump
@@ -1,6 +1,6 @@
| +0&#ffffff0@74
|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@65
-|e+0#af5f00255&|n|d@1|e|f| +0#0000000&|"+0#0000e05&| |c|o|m@1|e|n|t|
+0#0000000&@58
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t|
+0#0000000&@58
@75
@75
>"+0#0000e05&| |p|a|r|a|m|e|t|e|r|s| +0#0000000&@62
diff --git
a/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_00.dump
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_00.dump
new file mode 100644
index 000000000..04f6fd216
--- /dev/null
+++
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_00.dump
@@ -0,0 +1,20 @@
+>"+0#0000e05#ffffff0| |V|i|m| |:|f|u|n|c|t|i|o|n| |a|n|d| |:|d|e|f| |t|a|i|l|
|c|o|m@1|e|n|t| |e|r@1|o|r|s| +0#0000000&@30
+|"+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |u|n|l|e|t|!|
|g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| +0#0000000&@34
+@75
+|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|1|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@12|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|1+0#e000002&| +0#0000000&@64
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@75
+|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|2|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|2+0#e000002&| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|"+0#ffffff16#ff404010| |e|n|d@1|e|f|
+0#0000000#ffffff0@34
+@75
+|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@12|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@2|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@8|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|3+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|#+0#ffffff16#ff404010|
|e|n|d|f|u|n| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@75
+|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@57|1|,|1| @10|T|o|p|
diff --git
a/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_01.dump
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_01.dump
new file mode 100644
index 000000000..3e5b4bd02
--- /dev/null
+++
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_01.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|3+0#e000002&|
+0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|#+0#ffffff16#ff404010|
|e|n|d|f|u|n| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@75
+>d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|o|T|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@8|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|4+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|"+0#ffffff16#ff404010|
|e|n|d@1|e|f| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|4|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|"+0#ffffff16#ff404010| |e|n|d@1|e|f|
+0#0000000#ffffff0@34
+@75
+|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|5|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@2|f+0#af5f00255&|u|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@10|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|5+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|#+0#ffffff16#ff404010|
|e|n|d|f|u|n| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|"+0#ffffff16#ff404010| |e|n|d@1|e|f|
+0#0000000#ffffff0@34
+@75
+@57|1|9|,|1| @9|5|4|%|
diff --git
a/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_02.dump
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_02.dump
new file mode 100644
index 000000000..0d9de4b14
--- /dev/null
+++
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_02.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|6|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@12|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@2|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|6|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@6|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|6+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|"+0#ffffff16#ff404010|
|e|n|d@1|e|f| +0#0000000#ffffff0@34
+@2>r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@75
+|f+0#af5f00255&|o|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|i+0#af5f00255&|n|
+0#0000000&|r+0#00e0e07&|a|n|g|e|(+0#e000e06&|1+0#e000002&|,+0#0000000&|
|6+0#e000002&|)+0#e000e06&|-+0#af5f00255&|>|r+0#00e0e07&|e|v|e|r|s|e|(+0#e000e06&|)|
+0#0000000&@43
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|e|c|h|o|
|s|:|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|(+0#e000002&|)|'|
+0#0000000&@48
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|d|e|l|f|u|n|c|t|i|o|n|
|s|:|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|'+0#e000002&| +0#0000000&@43
+|e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|3|7|,|3| @9|B|o|t|
diff --git
a/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_99.dump
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_99.dump
new file mode 100644
index 000000000..ac4a64b8d
--- /dev/null
+++
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_99.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|5|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@2|f+0#af5f00255&|u|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@10|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|5+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|#+0#ffffff16#ff404010|
|e|n|d|f|u|n| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|"+0#ffffff16#ff404010| |e|n|d@1|e|f|
+0#0000000#ffffff0@34
+@75
+|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|6|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@12|#+0#ffffff16#ff404010| |f|u|n|
+0#0000000#ffffff0@37
+@2|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|6|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@6|"+0#ffffff16#ff404010| |d|e|f|
+0#0000000#ffffff0@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|6+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|"+0#ffffff16#ff404010|
|e|n|d@1|e|f| +0#0000000#ffffff0@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|#+0#ffffff16#ff404010| |e|n|d|f|u|n|
+0#0000000#ffffff0@34
+@75
+|f+0#af5f00255&|o|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|i+0#af5f00255&|n|
+0#0000000&|r+0#00e0e07&|a|n|g|e|(+0#e000e06&|1+0#e000002&|,+0#0000000&|
|6+0#e000002&|)+0#e000e06&|-+0#af5f00255&|>|r+0#00e0e07&|e|v|e|r|s|e|(+0#e000e06&|)|
+0#0000000&@43
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|e|c|h|o|
|s|:|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|(+0#e000002&|)|'|
+0#0000000&@48
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|d|e|l|f|u|n|c|t|i|o|n|
|s|:|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|'+0#e000002&| +0#0000000&@43
+>e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+@57|4|3|,|1| @9|B|o|t|
diff --git
a/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_00.dump
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_00.dump
new file mode 100644
index 000000000..f8c0ccc90
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_00.dump
@@ -0,0 +1,20 @@
+>"+0#0000e05#ffffff0| |V|i|m| |:|f|u|n|c|t|i|o|n| |a|n|d| |:|d|e|f| |t|a|i|l|
|c|o|m@1|e|n|t|s| +0#0000000&@36
+|"+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |u|n|l|e|t|!|
|g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| +0#0000000&@34
+@75
+|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|1|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@12|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|1+0#e000002&| +0#0000000&@64
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@75
+|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|2|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|2+0#e000002&| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@75
+|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@12|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@2|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@8|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|3+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@75
+|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@57|1|,|1| @10|T|o|p|
diff --git
a/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_01.dump
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_01.dump
new file mode 100644
index 000000000..326a2496d
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_01.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|3+0#e000002&|
+0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|3|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@75
+>d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@2|d+0#af5f00255&|e|f| +0#0000000&|D|o|T|e|s|t|4|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@8|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|4+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|4|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@75
+|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|5|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@2|f+0#af5f00255&|u|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@10|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|5+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@75
+@57|1|9|,|1| @9|5|4|%|
diff --git
a/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_02.dump
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_02.dump
new file mode 100644
index 000000000..8dcb0b979
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_02.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|6|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@12|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@2|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|6|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@6|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|6+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@2>r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@75
+|f+0#af5f00255&|o|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|i+0#af5f00255&|n|
+0#0000000&|r+0#00e0e07&|a|n|g|e|(+0#e000e06&|1+0#e000002&|,+0#0000000&|
|6+0#e000002&|)+0#e000e06&|-+0#af5f00255&|>|r+0#00e0e07&|e|v|e|r|s|e|(+0#e000e06&|)|
+0#0000000&@43
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|e|c|h|o|
|s|:|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|(+0#e000002&|)|'|
+0#0000000&@48
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|d|e|l|f|u|n|c|t|i|o|n|
|s|:|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|'+0#e000002&| +0#0000000&@43
+|e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|3|7|,|3| @9|B|o|t|
diff --git
a/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_99.dump
b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_99.dump
new file mode 100644
index 000000000..02e15091b
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_99.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|5|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@10|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@2|f+0#af5f00255&|u|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@10|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|5+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@23|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|D|o|T|e|s|t|5|(+0#e000e06&|)|
+0#0000000&@56
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@25|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@75
+|f+0#af5f00255&|u|n|
+0#0000000&|s+0#e000e06&|:|T+0#0000000&|e|s|t|6|(+0#e000e06&|)|
+0#0000000&|a+0#e000e06&|b|o|r|t| +0#0000000&@12|"+0#0000e05&| |f|u|n|
+0#0000000&@37
+@2|d+0#af5f00255&|e|f|
+0#0000000&|s+0#e000e06&|:|D+0#0000000&|o|T|e|s|t|6|(+0#e000e06&|)|:+0#0000000&|
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@6|#+0#0000e05&| |d|e|f| +0#0000000&@37
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|6+0#e000002&| +0#0000000&@62
+@2|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@23|#+0#0000e05&| |e|n|d@1|e|f|
+0#0000000&@34
+@2|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|s|:|D|o|T|e|s|t|6|(+0#e000e06&|)|
+0#0000000&@54
+|e+0#af5f00255&|n|d|f|u|n| +0#0000000&@25|"+0#0000e05&| |e|n|d|f|u|n|
+0#0000000&@34
+@75
+|f+0#af5f00255&|o|r| +0#0000000&|d+0#00e0e07&| +0#0000000&|i+0#af5f00255&|n|
+0#0000000&|r+0#00e0e07&|a|n|g|e|(+0#e000e06&|1+0#e000002&|,+0#0000000&|
|6+0#e000002&|)+0#e000e06&|-+0#af5f00255&|>|r+0#00e0e07&|e|v|e|r|s|e|(+0#e000e06&|)|
+0#0000000&@43
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|e|c|h|o|
|s|:|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|(+0#e000002&|)|'|
+0#0000000&@48
+@2|e+0#af5f00255&|x|e|c| +0#0000000&|$+0#e000002&|'|d|e|l|f|u|n|c|t|i|o|n|
|s|:|T|e|s|t|{+0#e000e06&|d+0#00e0e07&|}+0#e000e06&|'+0#e000002&| +0#0000000&@43
+>e+0#af5f00255&|n|d|f|o|r| +0#0000000&@68
+@57|4|3|,|1| @9|B|o|t|
diff --git
a/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comment_errors.vim
b/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comment_errors.vim
new file mode 100644
index 000000000..b4b9f6de0
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comment_errors.vim
@@ -0,0 +1,44 @@
+vim9script
+
+# Vim9 :function and :def tail comment errors
+# VIM_TEST_SETUP unlet! g:vimsyn_folding
+
+fun Test1() abort # fun
+ return 1
+endfun # endfun
+
+def Test2(): number " def
+ return 2
+enddef " enddef
+
+fun Test3() abort # fun
+ fun s:DoTest3() abort # fun
+ return 3
+ endfun # endfun
+ return s:DoTest3()
+endfun # endfun
+
+def Test4(): number " def
+ def DoTest4(): number " def
+ return 4
+ enddef " enddef
+ return DoTest4()
+enddef " enddef
+
+def Test5(): number " def
+ fun DoTest5() abort # fun
+ return 5
+ endfun # endfun
+ return DoTest5()
+enddef " enddef
+
+fun Test6() abort # fun
+ def s:DoTest6(): number " def
+ return 6
+ enddef " enddef
+ return s:DoTest6()
+endfun # endfun
+
+for d in range(1, 6)
+ exec $'echo Test{d}()'
+endfor
diff --git
a/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comments.vim
b/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comments.vim
new file mode 100644
index 000000000..12f7942cf
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_ex_function_def_tail_comments.vim
@@ -0,0 +1,44 @@
+vim9script
+
+# Vim9 :function and :def tail comments
+# VIM_TEST_SETUP unlet! g:vimsyn_folding
+
+fun Test1() abort " fun
+ return 1
+endfun " endfun
+
+def Test2(): number # def
+ return 2
+enddef # enddef
+
+fun Test3() abort " fun
+ fun s:DoTest3() abort " fun
+ return 3
+ endfun " endfun
+ return s:DoTest3()
+endfun " endfun
+
+def Test4(): number # def
+ def DoTest4(): number # def
+ return 4
+ enddef # enddef
+ return DoTest4()
+enddef # enddef
+
+def Test5(): number # def
+ fun DoTest5() abort " fun
+ return 5
+ endfun " endfun
+ return DoTest5()
+enddef # enddef
+
+fun Test6() abort " fun
+ def s:DoTest6(): number # def
+ return 6
+ enddef # enddef
+ return s:DoTest6()
+endfun " endfun
+
+for d in range(1, 6)
+ exec $'echo Test{d}()'
+endfor
diff --git a/runtime/syntax/testdir/input/vim_ex_def.vim
b/runtime/syntax/testdir/input/vim_ex_def.vim
index 2685ba5fd..a1d538158 100644
--- a/runtime/syntax/testdir/input/vim_ex_def.vim
+++ b/runtime/syntax/testdir/input/vim_ex_def.vim
@@ -85,7 +85,7 @@ def Foo()
enddef | echo "Foo"
def Foo()
-enddef " comment
+enddef # comment
" parameters
diff --git a/runtime/syntax/testdir/input/vim_ex_def_fold.vim
b/runtime/syntax/testdir/input/vim_ex_def_fold.vim
index 3326075a3..d85f27352 100644
--- a/runtime/syntax/testdir/input/vim_ex_def_fold.vim
+++ b/runtime/syntax/testdir/input/vim_ex_def_fold.vim
@@ -86,7 +86,7 @@ def Foo()
enddef | echo "Foo"
def Foo()
-enddef " comment
+enddef # comment
" parameters
diff --git
a/runtime/syntax/testdir/input/vim_ex_function_def_tail_comment_errors.vim
b/runtime/syntax/testdir/input/vim_ex_function_def_tail_comment_errors.vim
new file mode 100644
index 000000000..e5d746439
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_function_def_tail_comment_errors.vim
@@ -0,0 +1,43 @@
+" Vim :function and :def tail comment errors
+" VIM_TEST_SETUP unlet! g:vimsyn_folding
+
+fun s:Test1() abort # fun
+ return 1
+endfun # endfun
+
+def s:Test2(): number " def
+ return 2
+enddef " enddef
+
+fun s:Test3() abort # fun
+ fun s:DoTest3() abort # fun
+ return 3
+ endfun # endfun
+ return s:DoTest3()
+endfun # endfun
+
+def s:Test4(): number " def
+ def DoTest4(): number " def
+ return 4
+ enddef " enddef
+ return DoTest4()
+enddef " enddef
+
+def s:Test5(): number " def
+ fun DoTest5() abort # fun
+ return 5
+ endfun # endfun
+ return DoTest5()
+enddef " enddef
+
+fun s:Test6() abort # fun
+ def s:DoTest6(): number " def
+ return 6
+ enddef " enddef
+ return s:DoTest6()
+endfun # endfun
+
+for d in range(1, 6)->reverse()
+ exec $'echo s:Test{d}()'
+ exec $'delfunction s:Test{d}'
+endfor
diff --git a/runtime/syntax/testdir/input/vim_ex_function_def_tail_comments.vim
b/runtime/syntax/testdir/input/vim_ex_function_def_tail_comments.vim
new file mode 100644
index 000000000..e46bf752e
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_function_def_tail_comments.vim
@@ -0,0 +1,43 @@
+" Vim :function and :def tail comments
+" VIM_TEST_SETUP unlet! g:vimsyn_folding
+
+fun s:Test1() abort " fun
+ return 1
+endfun " endfun
+
+def s:Test2(): number # def
+ return 2
+enddef # enddef
+
+fun s:Test3() abort " fun
+ fun s:DoTest3() abort " fun
+ return 3
+ endfun " endfun
+ return s:DoTest3()
+endfun " endfun
+
+def s:Test4(): number # def
+ def DoTest4(): number # def
+ return 4
+ enddef # enddef
+ return DoTest4()
+enddef # enddef
+
+def s:Test5(): number # def
+ fun DoTest5() abort " fun
+ return 5
+ endfun " endfun
+ return DoTest5()
+enddef # enddef
+
+fun s:Test6() abort " fun
+ def s:DoTest6(): number # def
+ return 6
+ enddef # enddef
+ return s:DoTest6()
+endfun " endfun
+
+for d in range(1, 6)->reverse()
+ exec $'echo s:Test{d}()'
+ exec $'delfunction s:Test{d}'
+endfor
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 033251f63..ca23000d9 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -3,7 +3,7 @@
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkea...@gmail.com>
" URL: https://github.com/vim-jp/syntax-vim-ex
-" Last Change: 2024 Jun 15
+" Last Change: 2024 Jun 21
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -108,11 +108,11 @@ syn keyword vimFuncName contained abs acos add and append
appendbufline argc arg
syn keyword vimFuncName contained clearmatches col complete complete_add
complete_check complete_info confirm copy cos cosh count cscope_connection
cursor debugbreak deepcopy delete deletebufline did_filetype diff diff_filler
diff_hlID digraph_get digraph_getlist digraph_set digraph_setlist echoraw empty
environ err_teapot escape eval eventhandler executable execute exepath exists
exists_compiled exp expand expandcmd extend extendnew feedkeys filecopy
filereadable filewritable filter finddir findfile flatten flattennew float2nr
floor fmod fnameescape fnamemodify foldclosed foldclosedend foldlevel foldtext
foldtextresult foreach foreground fullcommand funcref function garbagecollect
get getbufinfo getbufline getbufoneline getbufvar getcellwidths getchangelist
getchar
syn keyword vimFuncName contained getcharmod getcharpos getcharsearch
getcharstr getcmdcompltype getcmdline getcmdpos getcmdscreenpos getcmdtype
getcmdwintype getcompletion getcurpos getcursorcharpos getcwd getenv
getfontname getfperm getfsize getftime getftype getimstatus getjumplist getline
getloclist getmarklist getmatches getmousepos getmouseshape getpid getpos
getqflist getreg getreginfo getregion getregionpos getregtype getscriptinfo
gettabinfo gettabvar gettabwinvar gettagstack gettext getwininfo getwinpos
getwinposx getwinposy getwinvar glob glob2regpat globpath has has_key
haslocaldir hasmapto histadd histdel histget histnr hlID hlexists hlget hlset
hostname iconv indent index indexof input inputdialog inputlist inputrestore
inputsave inputsecret insert
syn keyword vimFuncName contained instanceof interrupt invert isabsolutepath
isdirectory isinf islocked isnan items job_getchannel job_info job_setoptions
job_start job_status job_stop join js_decode js_encode json_decode json_encode
keys keytrans len libcall libcallnr line line2byte lispindent list2blob
list2str listener_add listener_flush listener_remove localtime log log10
luaeval map maparg mapcheck maplist mapnew mapset match matchadd matchaddpos
matcharg matchbufline matchdelete matchend matchfuzzy matchfuzzypos matchlist
matchstr matchstrlist matchstrpos max menu_info min mkdir mode mzeval
nextnonblank nr2char or pathshorten perleval popup_atcursor popup_beval
popup_clear popup_close popup_create popup_dialog popup_filter_menu
popup_filter_yesno popup_findecho
-syn keyword vimFuncName contained popup_findinfo popup_findpreview
popup_getoptions popup_getpos popup_hide popup_list popup_locate popup_menu
popup_move popup_notification popup_setoptions popup_settext popup_show pow
prevnonblank printf prompt_getprompt prompt_setcallback prompt_setinterrupt
prompt_setprompt prop_add prop_add_list prop_clear prop_find prop_list
prop_remove prop_type_add prop_type_change prop_type_delete prop_type_get
prop_type_list pum_getpos pumvisible py3eval pyeval pyxeval rand range readblob
readdir readdirex readfile reduce reg_executing reg_recording reltime
reltimefloat reltimestr remote_expr remote_foreground remote_peek remote_read
remote_send remote_startserver remove rename repeat resolve reverse round
rubyeval screenattr screenchar
-syn keyword vimFuncName contained screenchars screencol screenpos screenrow
screenstring search searchcount searchdecl searchpair searchpairpos searchpos
server2client serverlist setbufline setbufvar setcellwidths setcharpos
setcharsearch setcmdline setcmdpos setcursorcharpos setenv setfperm setline
setloclist setmatches setpos setqflist setreg settabvar settabwinvar
settagstack setwinvar sha256 shellescape shiftwidth sign_define sign_getdefined
sign_getplaced sign_jump sign_place sign_placelist sign_undefine sign_unplace
sign_unplacelist simplify sin sinh slice sort sound_clear sound_playevent
sound_playfile sound_stop soundfold spellbadword spellsuggest split sqrt srand
state str2float str2list str2nr strcharlen strcharpart strchars strdisplaywidth
strftime
-syn keyword vimFuncName contained strgetchar stridx string strlen strpart
strptime strridx strtrans strutf16len strwidth submatch substitute swapfilelist
swapinfo swapname synID synIDattr synIDtrans synconcealed synstack system
systemlist tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan tanh
tempname term_dumpdiff term_dumpload term_dumpwrite term_getaltscreen
term_getansicolors term_getattr term_getcursor term_getjob term_getline
term_getscrolled term_getsize term_getstatus term_gettitle term_gettty
term_list term_scrape term_sendkeys term_setansicolors term_setapi term_setkill
term_setrestore term_setsize term_start term_wait terminalprops test_alloc_fail
test_autochdir test_feedinput test_garbagecollect_now test_garbagecollect_soon
test_getvalue test_gui_event
-syn keyword vimFuncName contained test_ignore_error test_mswin_event
test_null_blob test_null_channel test_null_dict test_null_function
test_null_job test_null_list test_null_partial test_null_string
test_option_not_set test_override test_refcount test_setmouse test_settime
test_srand_seed test_unknown test_void timer_info timer_pause timer_start
timer_stop timer_stopall tolower toupper tr trim trunc type typename undofile
undotree uniq utf16idx values virtcol virtcol2col visualmode wildmenumode
win_execute win_findbuf win_getid win_gettype win_gotoid win_id2tabwin
win_id2win win_move_separator win_move_statusline win_screenpos win_splitmove
winbufnr wincol windowsversion winheight winlayout winline winnr winrestcmd
winrestview winsaveview winwidth wordcount writefile
-syn keyword vimFuncName contained xor
+syn keyword vimFuncName contained popup_findinfo popup_findpreview
popup_getoptions popup_getpos popup_hide popup_list popup_locate popup_menu
popup_move popup_notification popup_setbuf popup_setoptions popup_settext
popup_show pow prevnonblank printf prompt_getprompt prompt_setcallback
prompt_setinterrupt prompt_setprompt prop_add prop_add_list prop_clear
prop_find prop_list prop_remove prop_type_add prop_type_change prop_type_delete
prop_type_get prop_type_list pum_getpos pumvisible py3eval pyeval pyxeval rand
range readblob readdir readdirex readfile reduce reg_executing reg_recording
reltime reltimefloat reltimestr remote_expr remote_foreground remote_peek
remote_read remote_send remote_startserver remove rename repeat resolve reverse
round rubyeval screenattr
+syn keyword vimFuncName contained screenchar screenchars screencol screenpos
screenrow screenstring search searchcount searchdecl searchpair searchpairpos
searchpos server2client serverlist setbufline setbufvar setcellwidths
setcharpos setcharsearch setcmdline setcmdpos setcursorcharpos setenv setfperm
setline setloclist setmatches setpos setqflist setreg settabvar settabwinvar
settagstack setwinvar sha256 shellescape shiftwidth sign_define sign_getdefined
sign_getplaced sign_jump sign_place sign_placelist sign_undefine sign_unplace
sign_unplacelist simplify sin sinh slice sort sound_clear sound_playevent
sound_playfile sound_stop soundfold spellbadword spellsuggest split sqrt srand
state str2float str2list str2nr strcharlen strcharpart strchars strdisplaywidth
+syn keyword vimFuncName contained strftime strgetchar stridx string strlen
strpart strptime strridx strtrans strutf16len strwidth submatch substitute
swapfilelist swapinfo swapname synID synIDattr synIDtrans synconcealed synstack
system systemlist tabpagebuflist tabpagenr tabpagewinnr tagfiles taglist tan
tanh tempname term_dumpdiff term_dumpload term_dumpwrite term_getaltscreen
term_getansicolors term_getattr term_getcursor term_getjob term_getline
term_getscrolled term_getsize term_getstatus term_gettitle term_gettty
term_list term_scrape term_sendkeys term_setansicolors term_setapi term_setkill
term_setrestore term_setsize term_start term_wait terminalprops test_alloc_fail
test_autochdir test_feedinput test_garbagecollect_now test_garbagecollect_soon
test_getvalue
+syn keyword vimFuncName contained test_gui_event test_ignore_error
test_mswin_event test_null_blob test_null_channel test_null_dict
test_null_function test_null_job test_null_list test_null_partial
test_null_string test_option_not_set test_override test_refcount test_setmouse
test_settime test_srand_seed test_unknown test_void timer_info timer_pause
timer_start timer_stop timer_stopall tolower toupper tr trim trunc type
typename undofile undotree uniq utf16idx values virtcol virtcol2col visualmode
wildmenumode win_execute win_findbuf win_getid win_gettype win_gotoid
win_id2tabwin win_id2win win_move_separator win_move_statusline win_screenpos
win_splitmove winbufnr wincol windowsversion winheight winlayout winline winnr
winrestcmd winrestview winsaveview winwidth
+syn keyword vimFuncName contained wordcount writefile xor
"--- syntax here and above generated by mkvimvim ---
" Special Vim Highlighting (not automatic) {{{1
@@ -315,19 +315,19 @@ syn keyword vimFuncKey contained
fu[nction]
syn keyword vimDefKey contained def
syn keyword vimMethodName contained empty len string
-syn region vimFuncParams contained matchgroup=Delimiter start="("
skip=+
\s*\\|
\s*"\ + end=")" skipwhite skipnl
nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod
contains=vimFuncParam,@vimContinue
-syn region vimDefParams contained matchgroup=Delimiter start="("
end=")" skipwhite skipnl
nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType
contains=vimDefParam,vim9Comment
+syn region vimFuncParams contained matchgroup=Delimiter start="("
skip=+
\s*\\|
\s*"\ + end=")" skipwhite skipnl
nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError
contains=vimFuncParam,@vimContinue
+syn region vimDefParams contained matchgroup=Delimiter start="("
end=")" skipwhite skipnl
nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError
contains=vimDefParam,vim9Comment
syn match vimFuncParam contained "\<\h\w*\>\|\.\.\."
skipwhite nextgroup=vimFuncParamEquals
syn match vimDefParam contained "\<\h\w*\>"
skipwhite nextgroup=vimParamType,vimFuncParamEquals
syn match vimFuncParamEquals contained "="
skipwhite nextgroup=@vimExprList
-syn match vimFuncMod contained
"\<\%(abort\|closure\|dict\|range\)\>" skipwhite skipnl
nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod
+syn match vimFuncMod contained
"\<\%(abort\|closure\|dict\|range\)\>" skipwhite skipnl
nextgroup=vimFuncBody,vimFuncComment,vimEndfunction,vimFuncMod,vim9CommentError
-syn region vimFuncBody contained start="^"
matchgroup=vimCommand end="\<endfu\%[nction]\>" contains=@vimFuncBodyList
-syn region vimDefBody contained start="^"
matchgroup=vimCommand end="\<enddef\>" contains=@vimDefBodyList
+syn region vimFuncBody contained start="^.\="
matchgroup=vimCommand end="\<endfu\%[nction]\>" contains=@vimFuncBodyList
skipwhite nextgroup=vimCmdSep,vimComment,vim9CommentError
+syn region vimDefBody contained start="^.\="
matchgroup=vimCommand end="\<enddef\>" contains=@vimDefBodyList skipwhite
nextgroup=vimCmdSep,vim9Comment,vimCommentError
-syn match vimEndfunction "\<endf\%[unction]\>"
-syn match vimEnddef "\<enddef\>"
+syn match vimEndfunction "\<endf\%[unction]\>" skipwhite
nextgroup=vimCmdSep,vimComment,vim9CommentError
+syn match vimEnddef "\<enddef\>" skipwhite
nextgroup=vimCmdSep,vim9Comment,vimCommentError
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
syn region vimFuncFold
start="^\s*:\=\s*fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+\s*("
end="^\s*:\=\s*endf\%[unction]\>" contains=vimFunction fold keepend
extend transparent
@@ -341,7 +341,7 @@ syn match vimFuncBlank contained "\s\+"
" Types: {{{2
" =====
" vimTypes : new for vim9
-syn region vimReturnType contained start=":\s" end="$"
matchgroup=vim9Comment end="\ze#" skipwhite skipnl
nextgroup=vimDefBody,vimDefComment,vimEnddef contains=vimTypeSep transparent
+syn region vimReturnType contained start=":\s" end="$"
matchgroup=vim9Comment end="\ze[#"]" skipwhite skipnl
nextgroup=vimDefBody,vimDefComment,vimEnddef,vimCommentError
contains=vimTypeSep transparent
syn match vimParamType contained ":\s\+ "
skipwhite skipnl nextgroup=vimFuncParamEquals
contains=vimTypeSep,@vimType
syn match vimTypeSep contained ":\s\@=" skipwhite
nextgroup=@vimType
@@ -447,6 +447,9 @@ else
syn cluster vimComment contains=vimComment
endif
+syn match vim9CommentError contained "#.*"
+syn match vimCommentError contained +".*+
+
" Environment Variables: {{{2
" =====================
syn match vimEnvvar "\$\I\i*"
@@ -919,12 +922,12 @@ endif
" Allows users to specify the type of embedded script highlighting
" they want: (perl/python/ruby/tcl support)
" g:vimsyn_embed == 0 : don't embed any scripts
-" g:vimsyn_embed =~# 'l' : embed lua (but only if vim supports it)
-" g:vimsyn_embed =~# 'm' : embed mzscheme (but only if vim supports it)
-" g:vimsyn_embed =~# 'p' : embed perl (but only if vim supports it)
-" g:vimsyn_embed =~# 'P' : embed python (but only if vim supports it)
-" g:vimsyn_embed =~# 'r' : embed ruby (but only if vim supports it)
-" g:vimsyn_embed =~# 't' : embed tcl (but only if vim supports it)
+" g:vimsyn_embed =~# 'l' : embed Lua (but only if vim supports it)
+" g:vimsyn_embed =~# 'm' : embed MzScheme (but only if vim supports it)
+" g:vimsyn_embed =~# 'p' : embed Perl (but only if vim supports it)
+" g:vimsyn_embed =~# 'P' : embed Python (but only if vim supports it)
+" g:vimsyn_embed =~# 'r' : embed Ruby (but only if vim supports it)
+" g:vimsyn_embed =~# 't' : embed Tcl (but only if vim supports it)
if !exists("g:vimsyn_embed")
let g:vimsyn_embed= "lmpPr"
endif
@@ -1136,7 +1139,9 @@ if !exists("skip_vim_syntax_inits")
hi def link vimCmplxRepeat SpecialChar
hi def link vimCommand Statement
hi def link vimComment Comment
+ hi def link vimCommentError vimError
hi def link vim9Comment Comment
+ hi def link vim9CommentError vimError
hi def link vimCommentString vimString
hi def link vimCommentTitle PreProc
hi def link vim9CommentTitle PreProc
@@ -1145,7 +1150,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimContinue Special
hi def link vimContinueComment vimComment
hi def link vimCtrlChar SpecialChar
- hi def link vimDefComment vimComment
+ hi def link vimDefComment vim9Comment
hi def link vimDefKey vimCommand
hi def link vimDefParam vimVar
hi def link vimEcho vimCommand
--
--
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1sKx4P-00AaHM-UH%40256bit.org.