runtime(vim): Update base syntax, fix mismtatched :def return type

Anchor the return type separator ':' with a lookbehind as the relevant
nextgroup options use skipwhite.

closes: #20319

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Doug Kearns
2026-05-25 16:33:27 +00:00
committed by Christian Brabandt
parent 3a90b2ba8e
commit dfdeba16d7
10 changed files with 31 additions and 24 deletions
+5 -5
View File
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
" Last Change: 2026 Feb 20
" Last Change: 2026 May 24
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -520,7 +520,7 @@ syn match vim9LambdaParams contained
\ "(\%(\<func(\|[^(]\)*\%(\n\s*\\\%(\<func(\|[^(]\)*\|\n\s*#\\ .*\)*\ze\s\+=>"
\ skipwhite nextgroup=vim9LambdaOperator
\ contains=@vim9Continue,vimDefParam,vim9LambdaParen,vim9LambdaReturnType
syn region vim9LambdaReturnType contained start=")\@<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent
syn region vim9LambdaReturnType contained start=")\@1<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent
syn region vim9LambdaBlock contained matchgroup=vimSep start="{" end="^\s*\zs}" contains=@vimDefBodyList
syn match vim9LambdaOperatorComment contained "#.*" skipwhite skipempty nextgroup=@vimExprList,vim9LambdaBlock,vim9LambdaOperatorComment
@@ -630,7 +630,7 @@ syn match vimDelfunction "\<delf\%[unction]\>" skipwhite nextgroup=vimDelfunct
" =====
syn region vimReturnType contained
\ start=":\%(\s\|\n\)\@="
\ start=")\@1<=:\%(\s\|\n\)\@="
\ skip=+\n\s*\%(\\\|#\\ \)\|^\s*#\\ +
\ end="$"
\ matchgroup=vim9Comment
@@ -697,7 +697,7 @@ if s:vim9script
\ contains=vim9DefTypeParam
syn region vim9MethodDefReturnType contained
\ start=":\%(\s\|\n\)\@="
\ start=")\@1<=:\%(\s\|\n\)\@="
\ skip=+\n\s*\%(\\\|#\\ \)\|^\s*#\\ +
\ end="$"
\ matchgroup=vim9Comment
@@ -825,7 +825,7 @@ if s:vim9script
\ skipwhite skipnl nextgroup=vimDefComment,vim9AbstractDefReturnType,vimCommentError
\ contains=vimDefParam,vim9Comment,vimFunctionParamEquals
syn region vim9AbstractDefReturnType contained
\ start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
\ start=")\@1<=:\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
\ skipwhite skipnl nextgroup=vimDefComment,vimCommentError
\ contains=vimTypeSep
\ transparent
+1 -1
View File
@@ -17,4 +17,4 @@
@75
|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@55
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
@57|1|9|,|1| @9|1|2|%|
@57|1|9|,|1| @9|1@1|%|
+1 -1
View File
@@ -17,4 +17,4 @@
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
@75
|d+0#af5f00255&|e|f| +0#0000000&|<+0#e000e06&|S|I|D|>|F+0#0000000&|o@1|(+0#e000e06&|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r| +0#0000000&@52
@57|3|7|,|0|-|1| @7|2|8|%|
@57|3|7|,|0|-|1| @7|2|7|%|
+1 -1
View File
@@ -17,4 +17,4 @@
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
@75
|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)|:+0#0000000&| |v+0#00e0003&|o|i|d| +0#0000000&|#+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@49
@57|5@1|,|3| @9|4|5|%|
@57|5@1|,|3| @9|4|2|%|
+1 -1
View File
@@ -17,4 +17,4 @@
@75
|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&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@55
@57|7|3|,|0|-|1| @7|6|2|%|
@57|7|3|,|0|-|1| @7|5|8|%|
+1 -1
View File
@@ -17,4 +17,4 @@
@75
|"+0#0000e05&| |I|s@1|u|e| |#|1|6|2|4|3| |(|V|i|m| |s|c|r|i|p|t| |d|e|f| |p|a|r|a|m|e|t|e|r|s| |s|y|n|t|a|x| |h|i|g|h|l|i|g|h|t| |i|s| |w|r|o|n|g|)| +0#0000000&@6
@75
@57|9|0|,|0|-|1| @7|7|8|%|
@57|9|0|,|0|-|1| @7|7|3|%|
+1 -1
View File
@@ -17,4 +17,4 @@
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
@75
@75
@57|1|0|8|,|1| @8|9|5|%|
@57|1|0|8|,|1| @8|8|9|%|
+8 -8
View File
@@ -4,17 +4,17 @@
|s+0#af5f00255&|i|l|e|n|t|!| +0#0000000&|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@57
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
> @74
@75
|"+0#0000e05&| |U|n|r|e|p|o|r|t|e|d| |i|s@1|u|e| |(|r|e|t|u|r|n| |t|y|p|e| |c|o|l|o|n| |m|u|s|t| |f|o|l@1|o|w| |i|m@1|e|d|i|a|t|e|l|y| |a|f|t|e|r| |c|l|o|s|i|n|g
| |p|a|r|a|m|e|t|e|r|-|l|i|s|t| |p|a|r|e|n|)| +0#0000000&@52
@75
|d+0#af5f00255&|e|f| +0#0000000&|F|o@1|(+0#e000e06&|)| +0#0000000&@65
|:| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|n|o|t| |a| |m|i|s|m|a|t|c|h|e|d| |r|e|t|u|r|n| |t|y|p|e|"| +0#0000000&@37
|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
@75
|~+0#4040ff13&| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
|~| @73
| +0#0000000&@56|1|2|6|,|0|-|1| @6|B|o|t|
@@ -124,3 +124,10 @@ enddef
silent! def Foo()
enddef
" Unreported issue (return type colon must follow immediately after closing parameter-list paren)
def Foo()
: echo "not a mismatched return type"
enddef
+5 -5
View File
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
" Last Change: 2026 May 17
" Last Change: 2026 May 24
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -575,7 +575,7 @@ syn match vim9LambdaParams contained
\ "(\%(\<func(\|[^(]\)*\%(\n\s*\\\%(\<func(\|[^(]\)*\|\n\s*#\\ .*\)*\ze\s\+=>"
\ skipwhite nextgroup=vim9LambdaOperator
\ contains=@vim9Continue,vimDefParam,vim9LambdaParen,vim9LambdaReturnType
syn region vim9LambdaReturnType contained start=")\@<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent
syn region vim9LambdaReturnType contained start=")\@1<=:\s" end="\ze\s*#" end="\ze\s*=>" contains=@vim9Continue,@vimType transparent
syn region vim9LambdaBlock contained matchgroup=vimSep start="{" end="^\s*\zs}" contains=@vimDefBodyList
syn match vim9LambdaOperatorComment contained "#.*" skipwhite skipempty nextgroup=@vimExprList,vim9LambdaBlock,vim9LambdaOperatorComment
@@ -685,7 +685,7 @@ syn match vimDelfunction "\<delf\%[unction]\>" skipwhite nextgroup=vimDelfunct
" =====
syn region vimReturnType contained
\ start=":\%(\s\|\n\)\@="
\ start=")\@1<=:\%(\s\|\n\)\@="
\ skip=+\n\s*\%(\\\|#\\ \)\|^\s*#\\ +
\ end="$"
\ matchgroup=vim9Comment
@@ -752,7 +752,7 @@ if s:vim9script
\ contains=vim9DefTypeParam
syn region vim9MethodDefReturnType contained
\ start=":\%(\s\|\n\)\@="
\ start=")\@1<=:\%(\s\|\n\)\@="
\ skip=+\n\s*\%(\\\|#\\ \)\|^\s*#\\ +
\ end="$"
\ matchgroup=vim9Comment
@@ -880,7 +880,7 @@ if s:vim9script
\ skipwhite skipnl nextgroup=vimDefComment,vim9AbstractDefReturnType,vimCommentError
\ contains=vimDefParam,vim9Comment,vimFunctionParamEquals
syn region vim9AbstractDefReturnType contained
\ start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
\ start=")\@1<=:\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
\ skipwhite skipnl nextgroup=vimDefComment,vimCommentError
\ contains=vimTypeSep
\ transparent