From: Doug Kearns Date: Thu, 27 Feb 2025 18:15:20 +0000 (+0100) Subject: runtime(vim): Update base-syntax, match Vim9 function calls after "|" X-Git-Tag: v9.1.1155~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=60bd140256be4f567c28c60eb84be72c19a164bd;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index 47e22400c0..8ae6929689 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 " Doug Kearns -" Last Change: 2025 Feb 23 +" Last Change: 2025 Feb 27 " Former Maintainer: Charles E. Campbell " DO NOT CHANGE DIRECTLY. @@ -204,7 +204,8 @@ syn case match " 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" 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 0000000000..83d5c4db47 --- /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 0000000000..df0a3cdea0 --- /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 0000000000..aecfc11427 --- /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 0000000000..5401f6ec8c --- /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 143d54ac88..5cab4aeba2 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -2,7 +2,7 @@ " Language: Vim script " Maintainer: Hirohito Higashi " Doug Kearns -" Last Change: 2025 Feb 23 +" Last Change: 2025 Feb 27 " Former Maintainer: Charles E. Campbell " DO NOT CHANGE DIRECTLY. @@ -242,7 +242,8 @@ syn case match " 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" nextgroup=vimBang contains=vimCommand syn match vimBang contained "!"