diff options
-rw-r--r-- | runtime/syntax/generator/gen_syntax_vim.vim | 45 | ||||
-rw-r--r-- | runtime/syntax/generator/vim.vim.base | 33 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_ex_echo_00.dump | 4 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_ex_echo_01.dump | 20 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_ex_echo_99.dump | 32 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_ex_execute_00.dump | 20 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_ex_execute_01.dump | 20 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_ex_execute_02.dump | 20 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_ex_execute_99.dump | 20 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_ex_func_00.dump | 20 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_ex_func_99.dump | 20 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_line_continuation_00.dump | 14 | ||||
-rw-r--r-- | runtime/syntax/testdir/dumps/vim_line_continuation_01.dump | 14 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/vim_ex_echo.vim | 18 | ||||
-rw-r--r-- | runtime/syntax/testdir/input/vim_ex_execute.vim | 41 | ||||
-rw-r--r-- | runtime/syntax/vim.vim | 36 |
16 files changed, 295 insertions, 82 deletions
diff --git a/runtime/syntax/generator/gen_syntax_vim.vim b/runtime/syntax/generator/gen_syntax_vim.vim index 1aa55f4df6..5c797deb7d 100644 --- a/runtime/syntax/generator/gen_syntax_vim.vim +++ b/runtime/syntax/generator/gen_syntax_vim.vim @@ -2,8 +2,8 @@ " Language: Vim script " Maintainer: Hirohito Higashi (h_east) " URL: https://github.com/vim-jp/syntax-vim-ex -" Last Change: 2024 Mar 09 -" Version: 2.0.5 +" Last Change: 2024 Mar 14 +" Version: 2.0.6 let s:keepcpo= &cpo set cpo&vim @@ -264,23 +264,21 @@ function! s:get_vim_command_type(cmd_name) " Return value: " 0: normal " 1: (Reserved) - " 2: abbrev - " 3: echo - " 4: menu - " 5: map - " 6: mapclear - " 7: unmap + " 2: abbrev (without un) + " 3: menu + " 4: map + " 5: mapclear + " 6: unmap " 99: (Exclude registration of "syn keyword") let menu_prefix = '^\%([acinostvx]\?\|tl\)' let map_prefix = '^[acilnostvx]\?' - let echo_suffix = '\%(n\|hl\|msg\|window\|err\|console\|\)$' let exclude_list = [ \ 'map', 'mapclear', \ 'substitute', 'smagic', 'snomagic', \ 'setlocal', 'setglobal', 'set', 'var', \ 'autocmd', 'augroup', 'doautocmd', 'doautoall', - \ 'echohl', - \ 'execute', + \ 'echo', 'echoconsole', 'echoerr', 'echohl', 'echomsg', 'echon', 'echowindow', + \ 'execute', \ 'behave', 'augroup', 'normal', 'syntax', \ 'append', 'insert', \ 'Next', 'Print', 'X', @@ -293,16 +291,14 @@ function! s:get_vim_command_type(cmd_name) let ret = 99 elseif a:cmd_name =~# '^\%(\%(un\)\?abbreviate\|noreabbrev\|\l\%(nore\|un\)\?abbrev\)$' let ret = 2 - elseif a:cmd_name =~# '^echo' . echo_suffix - let ret = 3 elseif a:cmd_name =~# menu_prefix . '\%(nore\|un\)\?menu$' - let ret = 4 + let ret = 3 elseif a:cmd_name =~# map_prefix . '\%(nore\)\?map$' - let ret = 5 + let ret = 4 elseif a:cmd_name =~# map_prefix . 'mapclear$' - let ret = 6 + let ret = 5 elseif a:cmd_name =~# map_prefix . 'unmap$' - let ret = 7 + let ret = 6 else let ret = 0 endif @@ -621,19 +617,16 @@ function! s:update_syntax_vim_file(vim_info) let li = a:vim_info.cmd let lnum = s:search_and_check(kword . ' abbrev', base_fname, str_info) let lnum = s:append_syn_vimcmd(lnum, str_info, li, 2) - " vimCommand - echo - let lnum = s:search_and_check(kword . ' echo', base_fname, str_info) - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3) - " vimCommand - menu - let lnum = s:search_and_check(kword . ' menu', base_fname, str_info) - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 4) " vimCommand - map let lnum = s:search_and_check(kword . ' map', base_fname, str_info) - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 5) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 4) let lnum = s:search_and_check(kword . ' mapclear', base_fname, str_info) - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 6) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 5) let lnum = s:search_and_check(kword . ' unmap', base_fname, str_info) - let lnum = s:append_syn_vimcmd(lnum, str_info, li, 7) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 6) + " vimCommand - menu + let lnum = s:search_and_check(kword . ' menu', base_fname, str_info) + let lnum = s:append_syn_vimcmd(lnum, str_info, li, 3) update quit! diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base index d259058589..2d9a2d34b3 100644 --- a/runtime/syntax/generator/vim.vim.base +++ b/runtime/syntax/generator/vim.vim.base @@ -167,7 +167,7 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,@vimEcho,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1 syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" @@ -450,15 +450,27 @@ syn match vimAutoCmdMod "\(++\)\=\(once\|nested\)" " Echo And Execute: -- prefer strings! {{{2 " ================ -" GEN_SYN_VIM: vimCommand echo, START_STR='syn keyword vimEcho', END_STR='skipwhite nextgroup=vimEchoExpr' -syn region vimEchoExpr contained start="[^[:space:]|]" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" end="$" contains=@vimContinue,@vimExprList - -syn match vimEchoHL "\<echohl\=\>" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone +" NOTE: No trailing comments + +syn region vimEcho + \ matchgroup=vimCommand + \ start="\<ec\%[ho]\>" + \ start="\<echoe\%[rr]\>" + \ start="\<echom\%[sg]\>" + \ start="\<echoc\%[onsole]\>" + \ start="\<echon\>" + \ start="\<echow\%[indow]\>" + \ skip=+\\|\|\n\s*\\\|\n\s*"\\ + + \ matchgroup=vimCmdSep end="|" excludenl end="$" contains=@vimContinue,@vimExprList transparent + +syn match vimEchohl "\<echohl\=\>" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchohlNone syn case ignore -syn keyword vimEchoHLNone none +syn keyword vimEchohlNone contained none syn case match -syn region vimExecute oneline excludenl matchgroup=vimCommand start="\<exe\%[cute]\>" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar +syn cluster vimEcho contains=vimEcho.* + +syn region vimExecute matchgroup=vimCommand start="\<exe\%[cute]\>" skip=+\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" excludenl end="$" contains=@vimContinue,@vimExprList transparent " Maps: {{{2 " ==== @@ -529,9 +541,8 @@ syn case match " User Function Highlighting: {{{2 " (following Gautam Iyer's suggestion) " ========================== -syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncEcho,vimFuncName,vimUserFunc,vimExecute +syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation -syn keyword vimFuncEcho contained ec ech echo " User Command Highlighting: {{{2 syn match vimUsrCmd '^\s*\zs\u\%(\w*\)\@>\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!' @@ -971,8 +982,8 @@ if !exists("skip_vim_syntax_inits") hi def link vimContinueComment vimComment hi def link vimCtrlChar SpecialChar hi def link vimEcho vimCommand - hi def link vimEchoHLNone vimGroup - hi def link vimEchoHL vimCommand + hi def link vimEchohlNone vimGroup + hi def link vimEchohl vimCommand hi def link vimElseIfErr Error hi def link vimElseif vimCondHL hi def link vimEnvvar PreProc diff --git a/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump b/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump index a626c7b247..f42ea1da6d 100644 --- a/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump +++ b/runtime/syntax/testdir/dumps/vim_ex_echo_00.dump @@ -15,6 +15,6 @@ @5|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@59 @6|\+0#e000e06&| +0#0000000&|4+0#e000002&|2| +0#0000000&@64 @75 -|"+0#0000e05&| |:|e|c|h|o| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@52 -|e+0#af5f00255&|c|h|o||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@58 +|e+0#af5f00255&|c|h|o| +0#0000000&@70 +@6|\+0#e000e06&| +0#0000000&|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&@55 @57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_echo_01.dump b/runtime/syntax/testdir/dumps/vim_ex_echo_01.dump new file mode 100644 index 0000000000..21e7bd2ae0 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_echo_01.dump @@ -0,0 +1,20 @@ +|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&@58 +@5|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@59 +@6|\+0#e000e06&| +0#0000000&|4+0#e000002&|2| +0#0000000&@64 +@75 +|e+0#af5f00255&|c|h|o| +0#0000000&@70 +@6>\+0#e000e06&| +0#0000000&|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&@55 +@5|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@59 +@6|\+0#e000e06&| +0#0000000&|4+0#e000002&|2| +0#0000000&@64 +@75 +|"+0#0000e05&| |:|e|c|h|o| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@52 +|e+0#af5f00255&|c|h|o||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@58 +@75 +|"+0#0000e05&| |t|r|a|i|l|i|n|g| |c|o|m@1|e|n|t| |n|e@1|d|s| ||| +0#0000000&@48 +|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|f|o@1|"| +0#0000000&||| |"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@52 +@75 +@75 +|"+0#0000e05&| |I|s@1|u|e| |#|9@1|8|7| |(|p|a|r|e|n|t|h|e|s|i|s|e|d| |a|r|g|u|m|e|n|t| |-| |n|o|t| |a| |f|u|n|c|t|i|o|n| |c|a|l@1|)| +0#0000000&@14 +@75 +|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|'+0#e000002&|e|n|d|'|:+0#0000000&| |1+0#e000002&|2|3|}+0#e000e06&| +0#0000000&@52 +@57|1|9|,|7| @9|6|8|%| diff --git a/runtime/syntax/testdir/dumps/vim_ex_echo_99.dump b/runtime/syntax/testdir/dumps/vim_ex_echo_99.dump index e8dd4541bc..ba37bb7086 100644 --- a/runtime/syntax/testdir/dumps/vim_ex_echo_99.dump +++ b/runtime/syntax/testdir/dumps/vim_ex_echo_99.dump @@ -1,20 +1,20 @@ -| +0&#ffffff0@74 -|e+0#af5f00255&|c|h|o| +0#0000000&@7|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 -|e+0#af5f00255&|c|h|o|n| +0#0000000&@6|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 -|e+0#af5f00255&|c|h|o|m|s|g| +0#0000000&@4|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 -|e+0#af5f00255&|c|h|o|w|i|n|d|o|w| +0#0000000&@1|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 -|e+0#af5f00255&|c|h|o|e|r@1| +0#0000000&@4|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 -|e+0#af5f00255&|c|h|o|c|o|n|s|o|l|e| +0#0000000&|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&|4+0#e000002&|2| +0#0000000&@48 -@75 -|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|f|o|l@1|o|w|i|n|g| |c|o|m@1|a|n|d| |i|s| |:|||"| +0#0000000&||| ||| @40 -@75 -|e+0#af5f00255&|c|h|o|h|l| +0#0000000&|W+0#00e0003&|a|r|n|i|n|g|M|s|g| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|D|o|n|'|t| |p|a|n|i|c|!|"| +0#0000000&||| |e+0#af5f00255&|c|h|o|h|l| +0#0000000&|N+0#00e0003&|o|n|e| +0#0000000&@21 -@75 -|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|A|n|s|w|e|r| |=| |"| +0#0000000&@58 -@5|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@59 +| +0&#ffffff0@4|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@59 @6|\+0#e000e06&| +0#0000000&|4+0#e000002&|2| +0#0000000&@64 @75 |"+0#0000e05&| |:|e|c|h|o| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@52 |e+0#af5f00255&|c|h|o||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@58 -> @74 -@57|2|0|,|0|-|1| @7|B|o|t| +@75 +|"+0#0000e05&| |t|r|a|i|l|i|n|g| |c|o|m@1|e|n|t| |n|e@1|d|s| ||| +0#0000000&@48 +|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|f|o@1|"| +0#0000000&||| |"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@52 +@75 +@75 +|"+0#0000e05&| |I|s@1|u|e| |#|9@1|8|7| |(|p|a|r|e|n|t|h|e|s|i|s|e|d| |a|r|g|u|m|e|n|t| |-| |n|o|t| |a| |f|u|n|c|t|i|o|n| |c|a|l@1|)| +0#0000000&@14 +@75 +|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|'+0#e000002&|e|n|d|'|:+0#0000000&| |1+0#e000002&|2|3|}+0#e000e06&| +0#0000000&@52 +@75 +|i+0#af5f00255&|f| +0#0000000&|1+0#e000002&|2|3| +0#0000000&@68 +@8|e|c|h|o| |(+0#e000e06&|f+0#00e0e07&|o@1|.+0#af5f00255&|e+0#00e0e07&|n|d|)+0#e000e06&| +0#0000000&@52 +|e+0#af5f00255&|l|s|e| +0#0000000&@70 +@8|e+0#af5f00255&|c|h|o| +0#0000000&|'+0#e000002&|b|a|r|'| +0#0000000&@56 +>e+0#af5f00255&|n|d|i|f| +0#0000000&@69 +@57|3|8|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/dumps/vim_ex_execute_00.dump b/runtime/syntax/testdir/dumps/vim_ex_execute_00.dump new file mode 100644 index 0000000000..55d88afaee --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_execute_00.dump @@ -0,0 +1,20 @@ +>"+0#0000e05#ffffff0| |V|i|m| |:|e|x|e|c|u|t|e| |c|o|m@1|a|n|d| +0#0000000&@52 +@75 +|"+0#0000e05&| |:|h|e|l|p| |:|e|x|e|c|u|t|e| +0#0000000&@58 +@75 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|b|u|f@1|e|r|"| +0#0000000&|n+0#00e0e07&|e|x|t|b|u|f| +0#0000000&@50 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|n|o|r|m|a|l|"| +0#0000000&|c+0#00e0e07&|o|u|n|t| +0#0000000&|.+0#af5f00255&@1| +0#0000000&|"+0#e000002&|w|"| +0#0000000&@45 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|'+0#e000002&|!|l|s|'| +0#0000000&||| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|t|h|e@1|n|d|"| +0#0000000&@45 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|n|o|r|m|a|l| |i|x@2|\+0#e000e06&|<|E|s|c|>|"+0#e000002&| +0#0000000&@47 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|e| |"| +0#0000000&|.+0#af5f00255&@1| +0#0000000&|f+0#00e0e07&|n|a|m|e@1|s|c|a|p|e|(+0#e000e06&|f+0#00e0e07&|i|l|e|n|a|m|e|)+0#e000e06&| +0#0000000&@37 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|!|l|s| |"| +0#0000000&|.+0#af5f00255&@1| +0#0000000&|s+0#00e0e07&|h|e|l@1|e|s|c|a|p|e|(+0#e000e06&|f+0#00e0e07&|i|l|e|n|a|m|e|,+0#0000000&| |1+0#e000002&|)+0#e000e06&| +0#0000000&@32 +|i+0#af5f00255&|f| +0#0000000&|0+0#e000002&| +0#0000000&@70 +@1|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|'+0#e000002&|w|h|i|l|e| |i| |>| |5|'| +0#0000000&@52 +@2|e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|t|e|s|t|"| +0#0000000&@61 +@1|e+0#af5f00255&|n|d|w|h|i|l|e| +0#0000000&@65 +|e+0#af5f00255&|n|d|i|f| +0#0000000&@69 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|'+0#e000002&|w|h|i|l|e| |i| |<| |5| ||| |e|c|h|o| |i| ||| |l|e|t| |i| |=| |i| |+| |1| ||| |e|n|d|w|h|i|l|e|'| +0#0000000&@17 +@75 +|"+0#0000e05&| |f|o|l@1|o|w|i|n|g| |c|o|m@1|a|n|d| |i|s| |:|||"| +0#0000000&@48 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|c|a|l@1| |F|o@1|(|)|"| +0#0000000&||| ||| @50 +@57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_ex_execute_01.dump b/runtime/syntax/testdir/dumps/vim_ex_execute_01.dump new file mode 100644 index 0000000000..5330ff3dee --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_execute_01.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0|e+0#af5f00255&|n|d|w|h|i|l|e| +0#0000000&@65 +|e+0#af5f00255&|n|d|i|f| +0#0000000&@69 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|'+0#e000002&|w|h|i|l|e| |i| |<| |5| ||| |e|c|h|o| |i| ||| |l|e|t| |i| |=| |i| |+| |1| ||| |e|n|d|w|h|i|l|e|'| +0#0000000&@17 +@75 +|"+0#0000e05&| |f|o|l@1|o|w|i|n|g| |c|o|m@1|a|n|d| |i|s| |:|||"| +0#0000000&@48 +>e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|c|a|l@1| |F|o@1|(|)|"| +0#0000000&||| ||| @50 +@75 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|c|a|l@1|"| +0#0000000&@60 +@6|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|"+0#e000002&|F|o@1|(|)|"| +0#0000000&@59 +@75 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&@67 +@6|\+0#e000e06&| +0#0000000&|"+0#e000002&|c|a|l@1|"| +0#0000000&@60 +@6|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|"+0#e000002&|F|o@1|(|)|"| +0#0000000&@59 +@75 +|"+0#0000e05&| |:|e|x|e|c|u|t|e| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@49 +|e+0#af5f00255&|x|e|c|u|t|e||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@55 +@75 +@57|1|9|,|1| @9|5|9|%| diff --git a/runtime/syntax/testdir/dumps/vim_ex_execute_02.dump b/runtime/syntax/testdir/dumps/vim_ex_execute_02.dump new file mode 100644 index 0000000000..fbc1fea6a8 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_execute_02.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@74 +|"+0#0000e05&| |t|r|a|i|l|i|n|g| |c|o|m@1|e|n|t| |n|e@1|d|s| ||| +0#0000000&@48 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|f|o@1|"| +0#0000000&||| |"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@49 +@75 +@75 +>"+0#0000e05&| |I|s@1|u|e| |#|9@1|8|7| |(|p|a|r|e|n|t|h|e|s|i|s|e|d| |a|r|g|u|m|e|n|t| |-| |n|o|t| |a| |f|u|n|c|t|i|o|n| |c|a|l@1|)| +0#0000000&@14 +@75 +|"+0#0000e05&| +0#0000000&|F+0#0000001#ffff4012|I|X|M|E|:+0#e000e06#ffffff0| +0#0000e05&|e|x|e|c|u|t|e| |i|s| |e|x| |c|o|m@1|a|n|d| |n|o|t| |b|u|i|l|t|i|n| |f|u|n|c|t|i|o|n| +0#0000000&@23 +|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|'+0#e000002&|a|r|g|'|:+0#0000000&| |"+0#e000002&|c|a|l@1| |F|o@1|(|)|"|}+0#e000e06&| +0#0000000&@43 +|e+0#00e0e07&|x|e|c|u|t|e| +0#0000000&|(+0#e000e06&|f+0#00e0e07&|o@1|.+0#af5f00255&|a+0#00e0e07&|r|g|)+0#e000e06&| +0#0000000&@57 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@56|3|7|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/dumps/vim_ex_execute_99.dump b/runtime/syntax/testdir/dumps/vim_ex_execute_99.dump new file mode 100644 index 0000000000..afc498c789 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_execute_99.dump @@ -0,0 +1,20 @@ +| +0&#ffffff0@5|\+0#e000e06&| +0#0000000&|"+0#e000002&|F|o@1|(|)|"| +0#0000000&@59 +@75 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&@67 +@6|\+0#e000e06&| +0#0000000&|"+0#e000002&|c|a|l@1|"| +0#0000000&@60 +@6|"+0#0000e05&|\| |c|o|m@1|e|n|t| +0#0000000&@58 +@6|\+0#e000e06&| +0#0000000&|"+0#e000002&|F|o@1|(|)|"| +0#0000000&@59 +@75 +|"+0#0000e05&| |:|e|x|e|c|u|t|e| |w|i|t|h|o|u|t| |{|e|x|p|r|}| +0#0000000&@49 +|e+0#af5f00255&|x|e|c|u|t|e||+0#0000000&| |e+0#af5f00255&|c|h|o| +0#0000000&|"+0#e000002&|F|o@1|"| +0#0000000&@55 +@75 +|"+0#0000e05&| |t|r|a|i|l|i|n|g| |c|o|m@1|e|n|t| |n|e@1|d|s| ||| +0#0000000&@48 +|e+0#af5f00255&|x|e|c|u|t|e| +0#0000000&|"+0#e000002&|f|o@1|"| +0#0000000&||| |"+0#0000e05&| |c|o|m@1|e|n|t| +0#0000000&@49 +@75 +@75 +|"+0#0000e05&| |I|s@1|u|e| |#|9@1|8|7| |(|p|a|r|e|n|t|h|e|s|i|s|e|d| |a|r|g|u|m|e|n|t| |-| |n|o|t| |a| |f|u|n|c|t|i|o|n| |c|a|l@1|)| +0#0000000&@14 +@75 +|"+0#0000e05&| +0#0000000&|F+0#0000001#ffff4012|I|X|M|E|:+0#e000e06#ffffff0| +0#0000e05&|e|x|e|c|u|t|e| |i|s| |e|x| |c|o|m@1|a|n|d| |n|o|t| |b|u|i|l|t|i|n| |f|u|n|c|t|i|o|n| +0#0000000&@23 +|l+0#af5f00255&|e|t| +0#0000000&|f+0#00e0e07&|o@1| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|'+0#e000002&|a|r|g|'|:+0#0000000&| |"+0#e000002&|c|a|l@1| |F|o@1|(|)|"|}+0#e000e06&| +0#0000000&@43 +>e+0#00e0e07&|x|e|c|u|t|e| +0#0000000&|(+0#e000e06&|f+0#00e0e07&|o@1|.+0#af5f00255&|a+0#00e0e07&|r|g|)+0#e000e06&| +0#0000000&@57 +@57|4|1|,|1| @9|B|o|t| diff --git a/runtime/syntax/testdir/dumps/vim_ex_func_00.dump b/runtime/syntax/testdir/dumps/vim_ex_func_00.dump new file mode 100644 index 0000000000..d89f64efb9 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_func_00.dump @@ -0,0 +1,20 @@ +>"+0#0000e05#ffffff0| |Y|N|T|A|X|_|E|X|E| |l|e|t| |g|:|v|i|m|s|y|n|_|n|o|e|r@1|o|r| |=| |1| +0#0000000&@38 +@75 +|f+0#af5f00255&|u|n|c| +0#0000000&|d+0#ffffff16#ff404010|o|i|t|(+0#e000e06#ffffff0|)| +0#0000000&@63 +@75 +|e+0#af5f00255&|n|d|f|u|n|c| +0#0000000&@67 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@74 diff --git a/runtime/syntax/testdir/dumps/vim_ex_func_99.dump b/runtime/syntax/testdir/dumps/vim_ex_func_99.dump new file mode 100644 index 0000000000..f4ec08f066 --- /dev/null +++ b/runtime/syntax/testdir/dumps/vim_ex_func_99.dump @@ -0,0 +1,20 @@ +|"+0#0000e05#ffffff0| |Y|N|T|A|X|_|E|X|E| |l|e|t| |g|:|v|i|m|s|y|n|_|n|o|e|r@1|o|r| |=| |1| +0#0000000&@38 +@75 +|f+0#af5f00255&|u|n|c| +0#0000000&|d+0#ffffff16#ff404010|o|i|t|(+0#e000e06#ffffff0|)| +0#0000000&@63 +@75 +>e+0#af5f00255&|n|d|f|u|n|c| +0#0000000&@67 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +|~| @73 +| +0#0000000&@74 diff --git a/runtime/syntax/testdir/dumps/vim_line_continuation_00.dump b/runtime/syntax/testdir/dumps/vim_line_continuation_00.dump index 3bc4ebaa50..d6b526ffda 100644 --- a/runtime/syntax/testdir/dumps/vim_line_continuation_00.dump +++ b/runtime/syntax/testdir/dumps/vim_line_continuation_00.dump @@ -9,12 +9,12 @@ @6|\+0#e000e06&| +0#0000000&|c+0#00e0e07&| +0#0000000&@65 @6|\+0#e000e06&|)| +0#0000000&@66 @2|e+0#af5f00255&|c|h|o|m|s|g| +0#0000000&@65 -| +0#0000e05&@7|"|\| |s|t|a|r|t| |s|t|r|i|n|g| +0#0000000&@51 +@8|"+0#0000e05&|\| |s|t|a|r|t| |s|t|r|i|n|g| +0#0000000&@51 @8|\+0#e000e06&| +0#0000000&|$|"| @62 -| +0#0000e05&@7|"|\| |p|r|i|n|t| |a| +0#0000000&@56 -@8|\+0#e000e06&| +0#0000000&|a+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|a|}+0#e000e06&|,+0#0000000&| @54 -| +0#0000e05&@7|"|\| |p|r|i|n|t| |b| +0#0000000&@56 -@8|\+0#e000e06&| +0#0000000&|b+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|b|}+0#e000e06&|,+0#0000000&| @54 -| +0#0000e05&@7|"|\| |p|r|i|n|t| |c| +0#0000000&@56 -@8|\+0#e000e06&| +0#0000000&|c+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|c|}+0#e000e06&| +0#0000000&@55 +@8|"+0#0000e05&|\| |p|r|i|n|t| |a| +0#0000000&@56 +@8|\+0#e000e06&| +0#0000000&|a+0#00e0e07&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|a|}+0#e000e06&|,+0#0000000&| @54 +@8|"+0#0000e05&|\| |p|r|i|n|t| |b| +0#0000000&@56 +@8|\+0#e000e06&| +0#0000000&|b+0#00e0e07&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|b|}+0#e000e06&|,+0#0000000&| @54 +@8|"+0#0000e05&|\| |p|r|i|n|t| |c| +0#0000000&@56 +@8|\+0#e000e06&| +0#0000000&|c+0#00e0e07&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|c|}+0#e000e06&| +0#0000000&@55 @57|1|,|1| @10|T|o|p| diff --git a/runtime/syntax/testdir/dumps/vim_line_continuation_01.dump b/runtime/syntax/testdir/dumps/vim_line_continuation_01.dump index a2e4820acb..e5a9a186ac 100644 --- a/runtime/syntax/testdir/dumps/vim_line_continuation_01.dump +++ b/runtime/syntax/testdir/dumps/vim_line_continuation_01.dump @@ -1,10 +1,10 @@ -| +0#0000e05#ffffff0@7|"|\| |p|r|i|n|t| |a| +0#0000000&@56 -@8|\+0#e000e06&| +0#0000000&|a+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|a|}+0#e000e06&|,+0#0000000&| @54 -| +0#0000e05&@7|"|\| |p|r|i|n|t| |b| +0#0000000&@56 -@8|\+0#e000e06&| +0#0000000&|b+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|b|}+0#e000e06&|,+0#0000000&| @54 -| +0#0000e05&@7|"|\| |p|r|i|n|t| |c| +0#0000000&@56 -@8>\+0#e000e06&| +0#0000000&|c+0#af5f00255&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|c|}+0#e000e06&| +0#0000000&@55 -| +0#0000e05&@7|"|\| |e|n|d| |s|t|r|i|n|g| +0#0000000&@53 +| +0&#ffffff0@7|"+0#0000e05&|\| |p|r|i|n|t| |a| +0#0000000&@56 +@8|\+0#e000e06&| +0#0000000&|a+0#00e0e07&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|a|}+0#e000e06&|,+0#0000000&| @54 +@8|"+0#0000e05&|\| |p|r|i|n|t| |b| +0#0000000&@56 +@8|\+0#e000e06&| +0#0000000&|b+0#00e0e07&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|b|}+0#e000e06&|,+0#0000000&| @54 +@8|"+0#0000e05&|\| |p|r|i|n|t| |c| +0#0000000&@56 +@8>\+0#e000e06&| +0#0000000&|c+0#00e0e07&| +0#0000000&|=+0#af5f00255&| +0#0000000&|{+0#e000e06&|a+0#00e0e07&|:|c|}+0#e000e06&| +0#0000000&@55 +@8|"+0#0000e05&|\| |e|n|d| |s|t|r|i|n|g| +0#0000000&@53 @8|\+0#e000e06&|"+0#0000000&| @64 |e+0#af5f00255&|n|d|f|u|n|c|t|i|o|n| +0#0000000&@63 @75 diff --git a/runtime/syntax/testdir/input/vim_ex_echo.vim b/runtime/syntax/testdir/input/vim_ex_echo.vim index c031724b8a..df2bf5c97d 100644 --- a/runtime/syntax/testdir/input/vim_ex_echo.vim +++ b/runtime/syntax/testdir/input/vim_ex_echo.vim @@ -15,6 +15,24 @@ echo "Answer = " "\ comment \ 42 +echo + \ "Answer = " + "\ comment + \ 42 + " :echo without {expr} echo| echo "Foo" +" trailing comment needs | +echo "foo" | " comment + + +" Issue #9987 (parenthesised argument - not a function call) + +let foo = {'end': 123} + +if 123 + echo (foo.end) +else + echo 'bar' +endif diff --git a/runtime/syntax/testdir/input/vim_ex_execute.vim b/runtime/syntax/testdir/input/vim_ex_execute.vim new file mode 100644 index 0000000000..2ec507e1c1 --- /dev/null +++ b/runtime/syntax/testdir/input/vim_ex_execute.vim @@ -0,0 +1,41 @@ +" Vim :execute command + +" :help :execute + +execute "buffer" nextbuf +execute "normal" count .. "w" +execute '!ls' | echo "theend" +execute "normal ixxx\<Esc>" +execute "e " .. fnameescape(filename) +execute "!ls " .. shellescape(filename, 1) +if 0 + execute 'while i > 5' + echo "test" + endwhile +endif +execute 'while i < 5 | echo i | let i = i + 1 | endwhile' + +" following command is :|" +execute "call Foo()" | | + +execute "call" + "\ comment + \ "Foo()" + +execute + \ "call" + "\ comment + \ "Foo()" + +" :execute without {expr} +execute| echo "Foo" + +" trailing comment needs | +execute "foo" | " comment + + +" Issue #9987 (parenthesised argument - not a function call) + +" FIXME: execute is ex command not builtin function +let foo = {'arg': "call Foo()"} +execute (foo.arg) diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 1896d4b9b6..174520f4aa 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -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 Mar 10 +" Last Change: 2024 Mar 15 " Former Maintainer: Charles E. Campbell " Base File URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Base File Version: 9.0-25 @@ -205,7 +205,7 @@ syn match vimNumber '\%(^\|\A\)\zs#\x\{6}' skipwhite nextgroup=vimGlobal,vimSub syn case match " All vimCommands are contained by vimIsCommand. {{{2 -syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimEcho,vimEchoHL,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate +syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,@vimEcho,vimExecute,vimIsCommand,vimExtCmd,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate syn match vimCmdSep "[:|]\+" skipwhite nextgroup=@vimCmdList,vimSubst1 syn match vimIsCommand "\<\%(\h\w*\|[23]mat\%[ch]\)\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" @@ -490,16 +490,27 @@ syn match vimAutoCmdMod "\(++\)\=\(once\|nested\)" " Echo And Execute: -- prefer strings! {{{2 " ================ -" GEN_SYN_VIM: vimCommand echo, START_STR='syn keyword vimEcho', END_STR='skipwhite nextgroup=vimEchoExpr' -syn keyword vimEcho ec[ho] echoe[rr] echom[sg] echoc[onsole] echon echow[indow] skipwhite nextgroup=vimEchoExpr -syn region vimEchoExpr contained start="[^[:space:]|]" skip=+\\\\\|\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" end="$" contains=@vimContinue,@vimExprList - -syn match vimEchoHL "\<echohl\=\>" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchoHLNone +" NOTE: No trailing comments + +syn region vimEcho + \ matchgroup=vimCommand + \ start="\<ec\%[ho]\>" + \ start="\<echoe\%[rr]\>" + \ start="\<echom\%[sg]\>" + \ start="\<echoc\%[onsole]\>" + \ start="\<echon\>" + \ start="\<echow\%[indow]\>" + \ skip=+\\|\|\n\s*\\\|\n\s*"\\ + + \ matchgroup=vimCmdSep end="|" excludenl end="$" contains=@vimContinue,@vimExprList transparent + +syn match vimEchohl "\<echohl\=\>" skipwhite nextgroup=vimGroup,vimHLGroup,vimEchohlNone syn case ignore -syn keyword vimEchoHLNone none +syn keyword vimEchohlNone contained none syn case match -syn region vimExecute oneline excludenl matchgroup=vimCommand start="\<exe\%[cute]\>" skip="\(\\\\\)*\\|" end="$\||\|<[cC][rR]>" contains=vimFuncVar,vimIsCommand,vimOper,vimNotation,vimOperParen,vimString,vimVar +syn cluster vimEcho contains=vimEcho.* + +syn region vimExecute matchgroup=vimCommand start="\<exe\%[cute]\>" skip=+\\|\|\n\s*\\\|\n\s*"\\ + matchgroup=vimCmdSep end="|" excludenl end="$" contains=@vimContinue,@vimExprList transparent " Maps: {{{2 " ==== @@ -574,9 +585,8 @@ syn case match " User Function Highlighting: {{{2 " (following Gautam Iyer's suggestion) " ========================== -syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncEcho,vimFuncName,vimUserFunc,vimExecute +syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation -syn keyword vimFuncEcho contained ec ech echo " User Command Highlighting: {{{2 syn match vimUsrCmd '^\s*\zs\u\%(\w*\)\@>\%([(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!' @@ -1016,8 +1026,8 @@ if !exists("skip_vim_syntax_inits") hi def link vimContinueComment vimComment hi def link vimCtrlChar SpecialChar hi def link vimEcho vimCommand - hi def link vimEchoHLNone vimGroup - hi def link vimEchoHL vimCommand + hi def link vimEchohlNone vimGroup + hi def link vimEchohl vimCommand hi def link vimElseIfErr Error hi def link vimElseif vimCondHL hi def link vimEnvvar PreProc |