summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2024-06-22 11:20:36 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-22 11:20:36 +0200
commitfc64ac0be2c4f9446798de4d66b029526d1afa85 (patch)
tree68f44f33a0a49f8251a1148c3325230b30026a4b
parentf0e691442005c12a7c35746048f0942f44e23a4c (diff)
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 <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--runtime/syntax/generator/vim.vim.base25
-rw-r--r--runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_02.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comment_errors_99.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_02.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim9_ex_function_def_tail_comments_99.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_def_05.dump2
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_02.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comment_errors_99.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_00.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_01.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_02.dump20
-rw-r--r--runtime/syntax/testdir/dumps/vim_ex_function_def_tail_comments_99.dump20
-rw-r--r--runtime/syntax/testdir/input/vim9_ex_function_def_tail_comment_errors.vim44
-rw-r--r--runtime/syntax/testdir/input/vim9_ex_function_def_tail_comments.vim44
-rw-r--r--runtime/syntax/testdir/input/vim_ex_def.vim2
-rw-r--r--runtime/syntax/testdir/input/vim_ex_def_fold.vim2
-rw-r--r--runtime/syntax/testdir/input/vim_ex_function_def_tail_comment_errors.vim43
-rw-r--r--runtime/syntax/testdir/input/vim_ex_function_def_tail_comments.vim43
-rw-r--r--runtime/syntax/vim.vim47
25 files changed, 538 insertions, 34 deletions
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index adfd68ee62..6bb2d44c88 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 <dougkearns@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=+\n\s*\\\|\n\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=+\n\s*\\\|\n\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\+\a" 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 0000000000..04f643ddfc
--- /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 0000000000..cb7caf5687
--- /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 0000000000..e74df6743a
--- /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 0000000000..3e5b280079
--- /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 0000000000..b6ed4904da
--- /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 0000000000..6cb37d1258
--- /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 0000000000..7df9e8f150
--- /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 0000000000..42d9f8cdc1
--- /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 2db207b43b..076428cd9b 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 0000000000..04f6fd2162
--- /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 0000000000..3e5b4bd02a
--- /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 0000000000..0d9de4b143
--- /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 0000000000..ac4a64b8da
--- /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 0000000000..f8c0ccc90a
--- /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