]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(vim): Update base syntax, fix mismtatched :def return type
authorDoug Kearns <dougkearns@gmail.com>
Mon, 25 May 2026 16:33:27 +0000 (16:33 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 25 May 2026 16:33:27 +0000 (16:33 +0000)
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>
runtime/syntax/generator/vim.vim.base
runtime/syntax/testdir/dumps/vim_ex_def_01.dump
runtime/syntax/testdir/dumps/vim_ex_def_02.dump
runtime/syntax/testdir/dumps/vim_ex_def_03.dump
runtime/syntax/testdir/dumps/vim_ex_def_04.dump
runtime/syntax/testdir/dumps/vim_ex_def_05.dump
runtime/syntax/testdir/dumps/vim_ex_def_06.dump
runtime/syntax/testdir/dumps/vim_ex_def_07.dump
runtime/syntax/testdir/input/vim_ex_def.vim
runtime/syntax/vim.vim

index 24a51167ac9c32db7d1ffc21a2a8bc6da9717b16..48414714fc83551455d7ed8d784202a42f965bd2 100644 (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
index f13f4f4e3c8e6260354a3ce68c9bb50eddf2e49b..92211445a8755989d5aea18b607d9540c34235de 100644 (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|%| 
index 14cffbda0969fb3ad9b52eee7da70338c443849d..0f575f8436512c7ba28e7dbf3d85649e6a70145a 100644 (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|%| 
index 4ab6ef5e9b7d5d5c11751383d7e1c4ce092892b3..3c325f4809d119978b497349e63aa053fdbe2358 100644 (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|%| 
index 6b5e93d8dce142f5a05b8ce3272cd9bf2eb4e1b3..cccc2bad10ed0a84d3f4fcd9d7e31d827c6df6f9 100644 (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|%| 
index 65192267462a5648492e8bb73a7405b22b1fce27..56950e93fac1de5b28e394c1730fe16cdc747132 100644 (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|%| 
index 3c4b3ab06cadde1e49f0a98605d93ae8577aec55..317bb43f31dcfc1c968ca58744ba1726b920dae3 100644 (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|%| 
index 87f3964bd008144903ace6e79fd2bd7eb1937e75..381b7ae553bdaef9986a9c242afa14a55ffeb5d7 100644 (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| 
index 7b1d39f4d1877b269fdadc50566a9a696cf968a0..a48273f8750a344b0d483b96485056034946900e 100644 (file)
@@ -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
+
index 4c2c137a041cd7fe6e9f5bb3f2dc72a47acb6ceb..e4538dd8dcd0d961c2a9105a84a67568b05f998b 100644 (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