runtime(vim): Update base-syntax, match Vim9 function calls after "|"
Match Vim9 function calls after ex-bar. These are also currently
matched but invalid syntax for legacy script.
fixes: #16721
closes: #16747
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index 47e2240..8ae6929 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2025 Feb 23
+" Last Change: 2025 Feb 27
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -204,7 +204,8 @@
" All vimCommands are contained by vimIsCommand. {{{2
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimFuncFold,vimGlobal,vimHighlight,vimLet,vimLoadkeymap,vimLockvar,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList
syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var
-syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1
+syn match vimCmdSep "\\\@1<!|" skipwhite nextgroup=@vimCmdList,vimSubst1,vimFunc
+syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1
syn match vimCount contained "\d\+"
syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" nextgroup=vimBang contains=vimCommand
syn match vimBang contained "!"
diff --git a/runtime/syntax/testdir/dumps/vim9_function_calls_00.dump b/runtime/syntax/testdir/dumps/vim9_function_calls_00.dump
new file mode 100644
index 0000000..83d5c4d
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_function_calls_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| |c|a|l@1|s| +0#0000000&@53
+@75
+|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@60
+|:|c+0#af5f00255&|a|l@1| +0#0000000&|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@54
+|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@47
+@75
+@75
+|#+0#0000e05&| |I|s@1|u|e| |1|6|7|2|1| |(|v|i|m|s|c|r|i|p|t| |h|i|g|h|l|i|g|h|t| |o|f| |b|u|i|l|t|i|n| |f|u|n|c|t|i|o|n| |a|f|t|e|r| |||)| +0#0000000&@11
+@75
+|&+0#00e0e07&|d|i|r|e|c|t|o|r|y| +0#0000000&|=+0#af5f00255&| +0#0000000&|$+0#e000002&|'|{+0#e000e06&|$|M|Y|V|I|M|D|I|R|}|/+0#e000002&|.|d|a|t|a|/|s|w|a|p|/|'| +0#0000000&@35
+|&+0#00e0e07&|b|a|c|k|u|p|d|i|r| +0#0000000&|=+0#af5f00255&| +0#0000000&|$+0#e000002&|'|{+0#e000e06&|$|M|Y|V|I|M|D|I|R|}|/+0#e000002&|.|d|a|t|a|/|b|a|c|k|u|p|/@1|'| +0#0000000&@32
+|&+0#00e0e07&|u|n|d|o|d|i|r| +0#0000000&|=+0#af5f00255&| +0#0000000&|$+0#e000002&|'|{+0#e000e06&|$|M|Y|V|I|M|D|I|R|}|/+0#e000002&|.|d|a|t|a|/|u|n|d|o|/@1|'| +0#0000000&@36
+|i+0#af5f00255&|f| +0#0000000&|!+0#af5f00255&|i+0#00e0e07&|s|d|i|r|e|c|t|o|r|y|(+0#e000e06&|&+0#00e0e07&|u|n|d|o|d|i|r|)+0#e000e06&| +0#0000000&@2||| |m+0#00e0e07&|k|d|i|r|(+0#e000e06&|&+0#00e0e07&|u|n|d|o|d|i|r|,+0#0000000&| |"+0#e000002&|p|"|)+0#e000e06&| +0#0000000&@2||| |e+0#af5f00255&|n|d|i|f| +0#0000000&@14
+|i+0#af5f00255&|f| +0#0000000&|!+0#af5f00255&|i+0#00e0e07&|s|d|i|r|e|c|t|o|r|y|(+0#e000e06&|&+0#00e0e07&|b|a|c|k|u|p|d|i|r|)+0#e000e06&| +0#0000000&||| |m+0#00e0e07&|k|d|i|r|(+0#e000e06&|&+0#00e0e07&|b|a|c|k|u|p|d|i|r|,+0#0000000&| |"+0#e000002&|p|"|)+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|n|d|i|f| +0#0000000&@14
+|i+0#af5f00255&|f| +0#0000000&|!+0#af5f00255&|i+0#00e0e07&|s|d|i|r|e|c|t|o|r|y|(+0#e000e06&|&+0#00e0e07&|d|i|r|e|c|t|o|r|y|)+0#e000e06&| +0#0000000&||| |m+0#00e0e07&|k|d|i|r|(+0#e000e06&|&+0#00e0e07&|d|i|r|e|c|t|o|r|y|,+0#0000000&| |"+0#e000002&|p|"|)+0#e000e06&| +0#0000000&||| |e+0#af5f00255&|n|d|i|f| +0#0000000&@14
+@75
+|~+0#4040ff13&| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1|
diff --git a/runtime/syntax/testdir/dumps/vim_function_calls_00.dump b/runtime/syntax/testdir/dumps/vim_function_calls_00.dump
new file mode 100644
index 0000000..df0a3cd
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_function_calls_00.dump
@@ -0,0 +1,20 @@
+>"+0#0000e05#ffffff0| |V|i|m| |f|u|n|c|t|i|o|n| |c|a|l@1|s| +0#0000000&@54
+@75
+|c+0#af5f00255&|a|l@1| +0#0000000&|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@55
+|:|c+0#af5f00255&|a|l@1| +0#0000000&|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@54
+|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&||| |c+0#af5f00255&|a|l@1| +0#0000000&|c+0#00e0e07&|l|e|a|r|m|a|t|c|h|e|s|(+0#e000e06&|)| +0#0000000&@42
+@75
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1|
diff --git a/runtime/syntax/testdir/input/vim9_function_calls.vim b/runtime/syntax/testdir/input/vim9_function_calls.vim
new file mode 100644
index 0000000..aecfc11
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_function_calls.vim
@@ -0,0 +1,18 @@
+vim9script
+
+# Vim9 function calls
+
+clearmatches()
+:call clearmatches()
+echo "Foo" | clearmatches()
+
+
+# Issue 16721 (vimscript highlight of builtin function after |)
+
+&directory = $'{$MYVIMDIR}/.data/swap/'
+&backupdir = $'{$MYVIMDIR}/.data/backup//'
+&undodir = $'{$MYVIMDIR}/.data/undo//'
+if !isdirectory(&undodir) | mkdir(&undodir, "p") | endif
+if !isdirectory(&backupdir) | mkdir(&backupdir, "p") | endif
+if !isdirectory(&directory) | mkdir(&directory, "p") | endif
+
diff --git a/runtime/syntax/testdir/input/vim_function_calls.vim b/runtime/syntax/testdir/input/vim_function_calls.vim
new file mode 100644
index 0000000..5401f6e
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_function_calls.vim
@@ -0,0 +1,6 @@
+" Vim function calls
+
+call clearmatches()
+:call clearmatches()
+echo "Foo" | call clearmatches()
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 143d54a..5cab4ae 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -2,7 +2,7 @@
" Language: Vim script
" Maintainer: Hirohito Higashi <h.east.727 ATMARK gmail.com>
" Doug Kearns <dougkearns@gmail.com>
-" Last Change: 2025 Feb 23
+" Last Change: 2025 Feb 27
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -242,7 +242,8 @@
" All vimCommands are contained by vimIsCommand. {{{2
syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCall,vimCatch,vimConst,vimDebuggreedy,vimDef,vimDefFold,vimDelcommand,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimFuncFold,vimGlobal,vimHighlight,vimLet,vimLoadkeymap,vimLockvar,vimMap,vimMark,vimMatch,vimNotFunc,vimNormal,vimSet,vimSleep,vimSyntax,vimThrow,vimUnlet,vimUnlockvar,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate,@vim9CmdList,@vimExUserCmdList
syn cluster vim9CmdList contains=vim9Abstract,vim9Class,vim9Const,vim9Enum,vim9Export,vim9Final,vim9For,vim9Interface,vim9Type,vim9Var
-syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1
+syn match vimCmdSep "\\\@1<!|" skipwhite nextgroup=@vimCmdList,vimSubst1,vimFunc
+syn match vimCmdSep ":\+" skipwhite nextgroup=@vimCmdList,vimSubst1
syn match vimCount contained "\d\+"
syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" nextgroup=vimBang contains=vimCommand
syn match vimBang contained "!"