syntax highlighting: fix context highlighting

This commit is contained in:
Stanislav Seletskiy 2016-03-29 21:15:17 +06:00
parent 3a3e56a987
commit 61df32722b

View File

@ -73,12 +73,16 @@ syn match snipSnippetTrigger "\S\+" contained nextgroup=snipSnippetDocString,sni
" So we have to define this twice, once in the general case that matches a
" trailing " as the doc comment, and once for the case of the multiword
" delimiter using " that has more constraints
syn match snipSnippetTrigger ,\([^"[:space:]]\).\{-}\1\%(\s*$\)\@!\ze\%(\s\+"[^"]*\%("\s\+[^"[:space:]]\+\|"\)\=\)\=\s*$, contained nextgroup=snipSnippetDocString skipwhite
syn match snipSnippetTrigger ,".\{-}"\ze\%(\s\+"\%(\s*\S\)\@=[^"]*\%("\s\+[^"[:space:]]\+\|"\)\=\)\=\s*$, contained nextgroup=snipSnippetDocString skipwhite
syn match snipSnippetTrigger ,\%(\(\S\).\{-}\1\|\S\+\)\ze\%(\s\+"[^"]*\%("\s\+\%("[^"]\+"\s\+[^"[:space:]]*e[^"[:space:]]*\)\|"\)\=\)\=\s*$, contained nextgroup=snipSnippetDocContextString skipwhite
syn match snipSnippetTrigger ,\([^"[:space:]]\).\{-}\1\%(\s*$\)\@!\ze\%(\s\+"[^"]*\%("\s\+\%("[^"]\+"\s\+[^"[:space:]]*e[^"[:space:]]*\|[^"[:space:]]\+\)\|"\)\=\)\=\s*$, contained nextgroup=snipSnippetDocString skipwhite
syn match snipSnippetTriggerInvalid ,\S\@=.\{-}\S\ze\%(\s\+"[^"]*\%("\s\+[^"[:space:]]\+\s*\|"\s*\)\=\|\s*\)$, contained nextgroup=snipSnippetDocString skipwhite
syn match snipSnippetDocString ,"[^"]*\%("\ze\s*\%(\s[^"[:space:]]\+\s*\)\=\)\=$, contained nextgroup=snipSnippetOptions skipwhite
syn match snipSnippetDocString ,"[^"]*", contained nextgroup=snipSnippetOptions skipwhite
syn match snipSnippetDocContextString ,"[^"]*", contained nextgroup=snipSnippetContext skipwhite
syn match snipSnippetContext ,"[^"]\+", contained skipwhite contains=snipSnippetContextP
syn region snipSnippetContextP start=,"\@<=., end=,\ze", contained contains=@Python nextgroup=snipSnippetOptions skipwhite keepend
syn match snipSnippetOptions ,\S\+, contained contains=snipSnippetOptionFlag
syn match snipSnippetOptionFlag ,[biwrtsmx], contained
syn match snipSnippetOptionFlag ,[biwrtsmxAe], contained
" Command substitution {{{4
@ -153,9 +157,10 @@ syn match snipPriorityValue "-\?\d\+" contained display
" Actions {{{3
syn match snipAction "^\(pre_expand\|post_expand\|post_jump\)\%(\s.*\|$\)" contains=snipActionKeyword display
syn match snipActionKeyword "^\(pre_expand\|post_expand\|post_jump\)" contained nextgroup=snipActionValue skipwhite display
syn match snipActionValue '".*"' contained display
syn match snipAction "^\%(pre_expand\|post_expand\|post_jump\).*$" contains=snipActionKeyword display skipwhite
syn match snipActionKeyword "\%(pre_expand\|post_expand\|post_jump\)" contained nextgroup=snipActionValue skipwhite display
syn match snipActionValue '"[^"]*"' contained contains=snipActionValueP
syn region snipActionValueP start=,"\@<=., end=,\ze", contained contains=@Python skipwhite keepend
" Snippt Clearing {{{2
@ -178,6 +183,7 @@ hi def link snipSnippetFooterKeyword snipKeyword
hi def link snipSnippetTrigger Identifier
hi def link snipSnippetTriggerInvalid Error
hi def link snipSnippetDocString String
hi def link snipSnippetDocContextString String
hi def link snipSnippetOptionFlag Special
hi def link snipGlobalHeaderKeyword snipKeyword
@ -208,7 +214,6 @@ hi def link snipPriorityKeyword Keyword
hi def link snipPriorityValue Number
hi def link snipActionKeyword Keyword
hi def link snipActionValue String
hi def link snipClearKeyword Keyword