summaryrefslogtreecommitdiffstats
path: root/runtime/syntax/generator
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-20 03:56:58 +0000
commit0f75b2ad2e23107f8112b6dcd4785eeef6cc34aa (patch)
tree25185226a8d172d94b0ff72f5a611659252c76d6 /runtime/syntax/generator
parentReleasing progress-linux version 2:9.1.0377-1~progress7.99u1. (diff)
downloadvim-0f75b2ad2e23107f8112b6dcd4785eeef6cc34aa.tar.xz
vim-0f75b2ad2e23107f8112b6dcd4785eeef6cc34aa.zip
Merging upstream version 2:9.1.0496.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'runtime/syntax/generator')
-rw-r--r--runtime/syntax/generator/gen_syntax_vim.vim60
-rw-r--r--runtime/syntax/generator/vim.vim.base70
2 files changed, 96 insertions, 34 deletions
diff --git a/runtime/syntax/generator/gen_syntax_vim.vim b/runtime/syntax/generator/gen_syntax_vim.vim
index d320bdb..8b76775 100644
--- a/runtime/syntax/generator/gen_syntax_vim.vim
+++ b/runtime/syntax/generator/gen_syntax_vim.vim
@@ -274,20 +274,48 @@ function! s:get_vim_command_type(cmd_name)
let ab_prefix = '^[ci]\?'
let menu_prefix = '^\%([acinostvx]\?\|tl\)'
let map_prefix = '^[acilnostvx]\?'
- let exclude_list = [
- \ 'map', 'mapclear',
- \ 'substitute', 'smagic', 'snomagic',
- \ 'setlocal', 'setglobal', 'set', 'var',
- \ 'autocmd', 'augroup', 'doautocmd', 'doautoall',
- \ 'echo', 'echoconsole', 'echoerr', 'echohl', 'echomsg', 'echon', 'echowindow',
- \ 'execute',
- \ 'function', 'endfunction', 'def', 'enddef',
- \ 'behave', 'augroup', 'normal', 'syntax',
- \ 'append', 'insert',
- \ 'Next', 'Print', 'X',
- \ 'new', 'popup',
- \ 'vim9script',
- \ ]
+ let exclude_list =<< trim EOL
+ Next
+ Print
+ X
+ append
+ augroup
+ augroup
+ autocmd
+ behave
+ catch
+ def
+ doautoall
+ doautocmd
+ echo
+ echoconsole
+ echoerr
+ echohl
+ echomsg
+ echon
+ echowindow
+ enddef
+ endfunction
+ execute
+ function
+ insert
+ map
+ mapclear
+ new
+ normal
+ popup
+ set
+ setglobal
+ setlocal
+ sleep
+ smagic
+ snomagic
+ substitute
+ syntax
+ throw
+ var
+ vim9script
+ EOL
" Required for original behavior
" \ 'global', 'vglobal'
@@ -464,6 +492,10 @@ function! s:parse_vim_hlgroup(li)
let item.type = 'both'
call add(a:li, copy(item))
+ " "Conceal" is an option and cannot be used as keyword, so remove it.
+ " (Separately specified as 'syn match' in vim.vim.base).
+ call filter(a:li, {idx, val -> val.name !=# 'Conceal'})
+
quit!
if empty(a:li)
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index 90e1ee5..adfd68e 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -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 Apr 13
+" Last Change: 2024 Jun 17
" Former Maintainer: Charles E. Campbell
" DO NOT CHANGE DIRECTLY.
@@ -70,6 +70,7 @@ syn keyword vimGroup contained Comment Constant String Character Number Boolean
" Default highlighting groups {{{2
" GEN_SYN_VIM: vimHLGroup, START_STR='syn keyword vimHLGroup contained', END_STR=''
+syn match vimHLGroup contained "\<Conceal\>"
syn case match
" Function Names {{{2
@@ -174,7 +175,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,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSyntax,vimUnlet,vimUnmap,vimUserCmd,vimMenu,vimMenutranslate
+syn cluster vimCmdList contains=vimAbb,vimAddress,vimAutoCmd,vimAugroup,vimBehave,vimCatch,vimDef,@vimEcho,vimEnddef,vimEndfunction,vimExecute,vimIsCommand,vimExtCmd,vimFor,vimFunction,vimGlobal,vimHighlight,vimLet,vimMap,vimMark,vimNotFunc,vimNorm,vimSet,vimSleep,vimSyntax,vimThrow,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#_]*\>"
@@ -205,6 +206,11 @@ syn match vimBehave "\<be\%[have]\>" nextgroup=vimBehaveBang,vimBehaveModel,vi
syn match vimBehaveBang contained "\a\@1<=!" nextgroup=vimBehaveModel skipwhite
syn keyword vimBehaveModel contained mswin xterm
+" Exception Handling {{{2
+syn keyword vimThrow th[row] skipwhite nextgroup=@vimExprList
+syn keyword vimCatch cat[ch] skipwhite nextgroup=vimCatchPattern
+syn region vimCatchPattern contained matchgroup=Delimiter start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)" skip="\\\\\|\\\z1" end="\z1" contains=@vimSubstList oneline
+
" Filetypes {{{2
" =========
syn match vimFiletype "\<filet\%[ype]\(\s\+\I\i*\)*" skipwhite contains=vimFTCmd,vimFTOption,vimFTError
@@ -368,7 +374,9 @@ syn region vimUserCmdBlock contained matchgroup=vimSep start="{" end="}" contain
" Lower Priority Comments: after some vim commands... {{{2
" =======================
-syn region vimCommentString contained oneline start='\S\s\+"'ms=e end='"'
+if get(g:, "vimsyn_comment_strings", 1)
+ syn region vimCommentString contained oneline start='\S\s\+"'ms=e end='"'
+endif
if s:vim9script
syn match vimComment excludenl +\s"[^\-:.%#=*].*$+lc=1 contains=@vimCommentGroup,vimCommentString contained
@@ -437,12 +445,10 @@ syn match vimStringInterpolationBrace contained "}}"
syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation
syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation
syn cluster vimSubstList add=vimCollection
-syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat
-syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat
-syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
-syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>[\"#|]\@!" nextgroup=vimSubstPat
-syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)_\@=" nextgroup=vimSubstPat
-syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
+syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat
+syn match vimSubst "^\s*\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)[_#]\@=" skipwhite nextgroup=vimSubstPat
+syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)\>" skipwhite nextgroup=vimSubstPat
+syn match vimSubst1 contained "\%(s\%[ubstitute]\|sm\%[agic]\>\|sno\%[magic]\)[_#]\@=" skipwhite nextgroup=vimSubstPat
" TODO: Vim9 illegal separators for abbreviated :s form are [-.:], :su\%[...] required
" : # is allowed but "not recommended" (see :h pattern-delimiter)
syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([!#$%&'()*+,-./:;<=>?@[\]^_`{}~]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline
@@ -455,6 +461,10 @@ syn match vimSubstTwoBS contained "\\\\"
syn match vimSubstFlagErr contained "[^< \t\r|]\+" contains=vimSubstFlags
syn match vimSubstFlags contained "[&cegiIlnpr#]\+"
+" Vi compatibility
+syn match vimSubstDelim contained "\\"
+syn match vimSubstPat contained "\\\ze[/?&]" contains=vimSubstDelim nextgroup=vimSubstRep4
+
" 'String': {{{2
syn match vimString "[^(,]'[^']\{-}\zs'"
@@ -644,6 +654,12 @@ syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<retu\%[rn]\>\|\<while\>" skipwhi
syn match vimNorm "\<norm\%[al]!\=" skipwhite nextgroup=vimNormCmds
syn match vimNormCmds contained ".*$"
+" Sleep: {{{2
+" =====
+syn keyword vimSleep sl[eep] skipwhite nextgroup=vimSleepBang,vimSleepArg
+syn match vimSleepBang contained "\a\@1<=!" skipwhite nextgroup=vimSleepArg
+syn match vimSleepArg contained "\<\%(\d\+\)\=m\=\>"
+
" Syntax: {{{2
"=======
syn match vimGroupList contained "[^[:space:],]\+\%(\s*,\s*[^[:space:],]\+\)*" contains=vimGroupSpecial
@@ -809,16 +825,23 @@ syn match vimCtrlChar "[- -]"
" Beginners - Patterns that involve ^ {{{2
" =========
if s:vim9script
- syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle contained
- syn match vim9LineComment +^[ \t:]*#.*$+ contains=@vimCommentGroup,vimCommentString,vim9CommentTitle
+ syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle
+ syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle contained
else
- syn match vimLineComment +^[ \t:]*".*$+ contains=@vimCommentGroup,vimCommentString,vimCommentTitle
- syn match vim9LineComment +^[ \t:]*#.*$+ contains=@vimCommentGroup,vimCommentString,vim9CommentTitle contained
+ syn region vimLineComment start=+^[ \t:]*\zs".*$+ skip=+\n\s*\\\|\n\s*"\\ + end="$" contains=@vimCommentGroup,vimCommentString,vimCommentTitle
+ syn region vim9LineComment start=+^[ \t:]*\zs#.*$+ skip=+\n\s*\\\|\n\s*#\\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle contained
endif
syn match vimCommentTitle '"\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vimCommentTitleLeader,vimTodo,@vimCommentGroup
syn match vim9CommentTitle '#\s*\%([sS]:\|\h\w*#\)\=\u\w*\(\s\+\u\w*\)*:'hs=s+1 contained contains=vim9CommentTitleLeader,vimTodo,@vimCommentGroup
+
+" allowed anywhere in the file
+if !s:vim9script
+ syn match vimShebangError "^\s*\zs#!.*" display
+endif
+syn match vimShebang "\%^#!.*" display
+
syn match vimContinue "^\s*\zs\\"
-syn match vimContinueComment '^\s*\zs["#]\\ .*' contained
+syn match vimContinueComment '^\s*\zs["#]\\ .*'
syn cluster vimContinue contains=vimContinue,vimContinueComment
syn region vimString start="^\s*\\\z(['"]\)" skip='\\\\\|\\\z1' end="\z1" oneline keepend contains=@vimStringGroup,vimContinue
syn match vimCommentTitleLeader '"\s\+'ms=s+1 contained
@@ -851,12 +874,12 @@ endif
" Allows users to specify the type of embedded script highlighting
" they want: (perl/python/ruby/tcl support)
" g:vimsyn_embed == 0 : don't embed any scripts
-" g:vimsyn_embed =~# 'l' : embed lua (but only if vim supports it)
-" g:vimsyn_embed =~# 'm' : embed mzscheme (but only if vim supports it)
-" g:vimsyn_embed =~# 'p' : embed perl (but only if vim supports it)
-" g:vimsyn_embed =~# 'P' : embed python (but only if vim supports it)
-" g:vimsyn_embed =~# 'r' : embed ruby (but only if vim supports it)
-" g:vimsyn_embed =~# 't' : embed tcl (but only if vim supports it)
+" g:vimsyn_embed =~# 'l' : embed Lua (but only if vim supports it)
+" g:vimsyn_embed =~# 'm' : embed MzScheme (but only if vim supports it)
+" g:vimsyn_embed =~# 'p' : embed Perl (but only if vim supports it)
+" g:vimsyn_embed =~# 'P' : embed Python (but only if vim supports it)
+" g:vimsyn_embed =~# 'r' : embed Ruby (but only if vim supports it)
+" g:vimsyn_embed =~# 't' : embed Tcl (but only if vim supports it)
if !exists("g:vimsyn_embed")
let g:vimsyn_embed= "lmpPr"
endif
@@ -1043,6 +1066,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimHiCtermError vimError
hi def link vimHiKeyError vimError
hi def link vimMapModErr vimError
+ hi def link vimShebangError vimError
hi def link vimSubstFlagErr vimError
hi def link vimSynCaseError vimError
hi def link vimSynFoldMethodError vimError
@@ -1063,6 +1087,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimBehaveModel vimBehave
hi def link vimBehave vimCommand
hi def link vimBracket Delimiter
+ hi def link vimCatch vimCommand
hi def link vimCmplxRepeat SpecialChar
hi def link vimCommand Statement
hi def link vimComment Comment
@@ -1180,6 +1205,10 @@ if !exists("skip_vim_syntax_inits")
hi def link vimSetSep Statement
hi def link vimSetString vimString
hi def link vim9Vim9Script vimCommand
+ hi def link vimShebang PreProc
+ hi def link vimSleep vimCommand
+ hi def link vimSleepArg Constant
+ hi def link vimSleepBang vimBang
hi def link vimSpecFile Identifier
hi def link vimSpecFileMod vimSpecFile
hi def link vimSpecial Type
@@ -1220,6 +1249,7 @@ if !exists("skip_vim_syntax_inits")
hi def link vimSynReg Type
hi def link vimSyntax vimCommand
hi def link vimSynType vimSpecial
+ hi def link vimThrow vimCommand
hi def link vimTodo Todo
hi def link vimType Type
hi def link vimUnlet vimCommand