diff options
Diffstat (limited to 'syntax')
| -rw-r--r-- | syntax/cabal.vim | 2 | ||||
| -rw-r--r-- | syntax/csv.vim | 4 | ||||
| -rw-r--r-- | syntax/gitcommit.vim | 7 | ||||
| -rw-r--r-- | syntax/gitsendemail.vim | 6 | ||||
| -rw-r--r-- | syntax/haskell.vim | 44 | ||||
| -rw-r--r-- | syntax/jade.vim | 21 | ||||
| -rw-r--r-- | syntax/markdown.vim | 21 | ||||
| -rw-r--r-- | syntax/mustache.vim | 4 | ||||
| -rw-r--r-- | syntax/perl.vim | 18 | ||||
| -rw-r--r-- | syntax/php.vim | 192 | ||||
| -rw-r--r-- | syntax/ruby.vim | 3 | ||||
| -rw-r--r-- | syntax/rust.vim | 93 | ||||
| -rw-r--r-- | syntax/sass.vim | 2 | ||||
| -rw-r--r-- | syntax/scala.vim | 2 | ||||
| -rw-r--r-- | syntax/slim.vim | 9 | 
15 files changed, 285 insertions, 143 deletions
| diff --git a/syntax/cabal.vim b/syntax/cabal.vim index d0510097..abe561a0 100644 --- a/syntax/cabal.vim +++ b/syntax/cabal.vim @@ -116,7 +116,7 @@ syn match cabalOperator '\W\@<=impl\((.\+)\)\@='  syn match cabalOperator '\W\@<=flag\((.\+)\)\@='  syn match cabalOperator '\(^\s*--.*\)\@<!\(<\|>\|=\|||\|&&\)' -syn match cabalComment '\s\@<=--.*$' +syn match cabalComment '--.*$' contains=@Spell  if version >= 508 || !exists('did_cabal_syntax_inits')    if version < 508 diff --git a/syntax/csv.vim b/syntax/csv.vim index 41a194d1..e2da7dbc 100644 --- a/syntax/csv.vim +++ b/syntax/csv.vim @@ -113,9 +113,9 @@ fu! <sid>DoHighlight() "{{{3  		    \. s:col . '/ contains=CSVDelimiter'      else  	for i in range(len(b:csv_fixed_width_cols)) -	    let pat = '/\%' . b:csv_fixed_width_cols[i] . 'c.*' . +	    let pat = '/\%' . b:csv_fixed_width_cols[i] . 'v.*' .  			\ ((i == len(b:csv_fixed_width_cols)-1) ? '/' :  -			\ '\%' . b:csv_fixed_width_cols[i+1] . 'c/') +			\ '\%' . b:csv_fixed_width_cols[i+1] . 'v/')  	    let group  = "CSVColumn" . (i%2 ? "Odd"  : "Even" )  	    let ngroup = "CSVColumn" . (i%2 ? "Even" : "Odd"  ) diff --git a/syntax/gitcommit.vim b/syntax/gitcommit.vim index 83cd4733..5fc541e6 100644 --- a/syntax/gitcommit.vim +++ b/syntax/gitcommit.vim @@ -39,9 +39,10 @@ syn region  gitcommitDiscarded	start=/^# Change\%(s not staged for commit\|d but  syn region  gitcommitSelected	start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold  syn region  gitcommitUnmerged	start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold -syn match   gitcommitDiscardedType	"\t\@<=[a-z][a-z ]*[a-z]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite -syn match   gitcommitSelectedType	"\t\@<=[a-z][a-z ]*[a-z]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite -syn match   gitcommitUnmergedType	"\t\@<=[a-z][a-z ]*[a-z]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite + +syn match   gitcommitDiscardedType	"\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite +syn match   gitcommitSelectedType	"\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite +syn match   gitcommitUnmergedType	"\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2	contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite  syn match   gitcommitDiscardedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow  syn match   gitcommitSelectedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow  syn match   gitcommitUnmergedFile	".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow diff --git a/syntax/gitsendemail.vim b/syntax/gitsendemail.vim index 8b938116..3d7f1065 100644 --- a/syntax/gitsendemail.vim +++ b/syntax/gitsendemail.vim @@ -1,7 +1,7 @@  " Vim syntax file  " Language:	git send-email message  " Maintainer:	Tim Pope -" Filenames:	*.msg.[0-9]* (first line is "From ... # This line is ignored.") +" Filenames:	.gitsendemail.*  " Last Change:	2010 May 21  if exists("b:current_syntax") @@ -9,6 +9,10 @@ if exists("b:current_syntax")  endif  runtime! syntax/mail.vim +unlet! b:current_syntax +syn include @gitsendemailDiff syntax/diff.vim +syn region gitsendemailDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^-- %/ fold contains=@gitsendemailDiff +  syn case match  syn match   gitsendemailComment "\%^From.*#.*" diff --git a/syntax/haskell.vim b/syntax/haskell.vim index 17f48178..8c890ee5 100644 --- a/syntax/haskell.vim +++ b/syntax/haskell.vim @@ -26,8 +26,8 @@ syn match  hsFloat            "\<[0-9]\+\.[0-9]\+\([eE][-+]\=[0-9]\+\)\=\>"  " This case matches the names of types and constructors: names beginning with  " a capital letter.  Note that this also handles the case of @M.lookup@ where  " M is a qualified import.  There is a big negative lookbehind assertion here -" so that we don't highlight import and module statements oddly.  -syn match hsTypeName "\(^import\s.*\|^module\s.*\)\@<!\([^a-zA-Z0-9]\)\@<=[A-Z][a-zA-Z0-9_]*" +" so that we don't highlight import and module statements oddly. +syn match hsTypeName "\(^import\s.*\|^module\s.*\)\@<!\(^\|[^a-zA-Z0-9]\)\@<=[A-Z][a-zA-Z0-9_]*"  " Also make unit and the empty list easy to spot - they are constructors too.  syn match hsTypeName "()"  syn match hsTypeName "\[\]" @@ -37,24 +37,26 @@ syn keyword hsFIXME contained FIXME TODO XXX BUG NOTE  " Comment stuff  syn region hsPragma start='{-#' end='#-}' -syn region hsBlockComment start='{-' end='-}' fold contains=hsFIXME,hsBlockComment +syn region hsBlockComment start='{-' end='-}' fold contains=hsFIXME,hsBlockComment,@Spell  " FIXME: haddock block comments should be able to contain hsBlockComments, but  " it doesn't seem to work at the moment. -syn region hsHaddockComment start='{-|' end='-}' contains=hsFIXME -syn match hsLineComment "--.*$" contains=hsFIXME +syn region hsHaddockComment start='{-|' end='-}' contains=hsFIXME,@Spell +syn match hsLineComment "--.*$" contains=hsFIXME,@Spell  " Line-based haddock comments are trickier - they continue until  " the next line that isn't part of the same block of comments. -syn region hsHaddockComment start='-- |' end='^\(\s*--\)\@!' contains=hsFIXME -syn region hsHaddockComment start='-- \$\w\+' end='^\(\s*--\)\@!' contains=hsFIXME -syn region hsHaddockComment start='-- ^' end='^\(\s*--\)\@!' contains=hsFIXME +syn region hsHaddockComment start='-- |' end='^\(\s*--\)\@!' contains=hsFIXME,@Spell +syn region hsHaddockComment start='-- \$\w\+' end='^\(\s*--\)\@!' contains=hsFIXME,@Spell +syn region hsHaddockComment start='-- ^' end='^\(\s*--\)\@!' contains=hsFIXME,@Spell  " Haddock sections for import lists  syn match hsHaddockSection '-- \*.*$'  " Named documentation chunks (also for import lists)  syn match hsHaddockSection '-- \$.*$' +" Treat a shebang line at the start of the file as a comment +syn match hsLineComment "\%^\#\!.*$"  " Keywords appearing in expressions, plus a few top-level keywords -syn keyword hsKeyword do let in _ where +syn keyword hsKeyword do mdo let in _ where  syn keyword hsKeyword infix infixl infixr  syn keyword hsKeyword forall foreign  syn match hsKeyword '\(^\(data\|type\)\s\+\)\@<=family\(\W\)\@=' @@ -68,21 +70,19 @@ syn keyword hsConditional case of if then else  " headers (-- *) can be highlighted specially only within this context.  syn region hsModuleHeader start="^module\s" end="where" contains=hsHaddockSection keepend fold transparent  " Treat Module imports as the #include category; it maps reasonably well -syn keyword hsImport import qualified as hiding module +syn keyword hsImport import module +" Treat 'qualified', 'as', and 'hiding' as keywords when following 'import' +syn match hsImport '\(\<import\>.*\)\@<=\<\(qualified\|as\|hiding\)\>'  syn keyword hsTypeDecls class instance data newtype type deriving default  " FIXME: Maybe we can do something fancy for data/type families?  'family' is  " only a keyword if it follows data/type... -" This is uglier than I'd like.  We want to let '-' participate in operators, -" but we can't let it match '--' because that interferes with comments.  Hacks -" for now - just include some common operators with '-'. -syn match hsOperator "<-\|->\|-->\|-\(-\)\@!\|[%\~\&\*/\$\^|@:+<!>=#!\?]\+" -" A bare . is an operator (but not surrounded by alnum chars) -syn match hsOperator "\s\@<=\.\s\@=" -" . is also an operator if adjacent to some other operator char -syn match hsOperator "[%\~\&\*\$\^|@:+<!>=#!\?]\+\.[%\~\&\*\$\^|@:+<\.!>=#!\?]*" -syn match hsOperator "[%\~\&\*\$\^|@:+<!>=#!\?]*\.[%\~\&\*\$\^|@:+\.<!>=#!\?]\+" +" We want to let '-' participate in operators, but we can't let it match +" '--', '---', etc. because it interferes with comments. The same goes for +" '#!' at the start of a file. Also, the dot (.) is an operator character, +" but not when it comes immediately after a module name. +syn match hsOperator "\(\%^\#\!\)\@!\(\(\<[A-Z]\w*\)\@64<=\.\)\@!\(--\+\([^.%\~\&\*/\$\^|@:+<!>=#!\?]\|$\)\)\@![-.%\~\&\*/\$\^|@:+<!>=#!\?]\+"  " Include support for infix functions as operators  syn match hsOperator "`[a-zA-Z0-9\.]\+`" @@ -90,11 +90,11 @@ syn match hsOperator "`[a-zA-Z0-9\.]\+`"  " after a name.  This allows whitespace before the name so that it can match  " in a 'where,' but it won't match local type annotations on random little  " things. -syn match hsFunctionList "^\s*\([a-z][a-zA-Z0-9']*[[:space:]\n,]\+\)*[a-z][a-zA-Z0-9']*[[:space:]\n]*::" contains=hsFunction -syn match hsFunction "\s*[a-z][a-zA-Z0-9']*[[:space:]\n]*\(::\|,\)\@=" contained +syn match hsFunctionList "^\s*\(\<\(where\>\|let\>\)\@![a-z][a-zA-Z0-9']*[[:space:]\n,]\+\)*[a-z][a-zA-Z0-9']*[[:space:]\n]*::" contains=hsFunction +syn match hsFunction "\s*[a-z][a-zA-Z0-9']*\([[:space:]\n]*\(::\|,\)\)\@=" contained  " Also support the style where the first where binding is on the same line as  " the where keyword. -syn match hsFunction "\(^\s\+where\s\+\)\@<=[a-z][a-zA-Z0-9']*\(\s*::\)\@=" +syn match hsFunction "\(\<\(where\|let\)\s\+\([a-z][a-zA-Z0-9']*\s*,\s*\)*\)\@<=[a-z][a-zA-Z0-9']*\(\s*\(,\s*[a-z][a-zA-Z0-9']*\s*\)*::\)\@="  " FIXME Ignoring proc for now, also mdo and rec diff --git a/syntax/jade.vim b/syntax/jade.vim index 108bc6b4..5c6e2199 100644 --- a/syntax/jade.vim +++ b/syntax/jade.vim @@ -27,15 +27,15 @@ syn cluster htmlJavascript add=javascriptParenthesisBlock  syn region  jadeJavascript matchgroup=jadeJavascriptOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend  syn region  jadeJavascript matchgroup=jadeJavascriptChar start="-" skip=",\s*$" end="$" contained contains=@htmlJavascript keepend  syn cluster jadeTop contains=jadeBegin,jadeComment,jadeHtmlComment,jadeJavascript -syn match   jadeBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=jadeTag,jadeClassChar,jadeIdChar,jadePlainChar,jadeJavascript,jadeScriptConditional,jadeScriptStatement +syn match   jadeBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=jadeTag,jadeClassChar,jadeIdChar,jadePlainChar,jadeJavascript,jadeScriptConditional,jadeScriptStatement,jadePipedText  syn match   jadeTag "+\?\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@jadeComponent -syn cluster jadeComponent contains=jadeAttributes,jadeIdChar,jadeBlockExpansionChar,jadeClassChar,jadePlainChar,jadeJavascript +syn cluster jadeComponent contains=jadeAttributes,jadeIdChar,jadeBlockExpansionChar,jadeClassChar,jadePlainChar,jadeJavascript,jadeTagBlockChar,jadeTagInlineText  syn match   jadeComment '\s*\/\/.*$'  syn region  jadeHtmlComment start="^\z(\s*\)/"  end="^\%(\z1\s\|\s*$\)\@!"  syn region  jadeAttributes matchgroup=jadeAttributesDelimiter start="(" end=")" contained contains=@htmlJavascript,jadeHtmlArg,htmlArg,htmlEvent,htmlCssDefinition nextgroup=@jadeComponent  syn match   jadeClassChar "\." contained nextgroup=jadeClass -syn match   jadeBlockExpansionChar ":\s" contained nextgroup=jadeTag -syn match   jadeIdChar "#{\@!" contained nextgroup=jadeId +syn match   jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag +syn match   jadeIdChar "#[[{]\@!" contained nextgroup=jadeId  syn match   jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent  syn match   jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent  syn region  jadeDocType start="^\s*\(!!!\|doctype\)" end="$" @@ -47,6 +47,12 @@ syn keyword jadeHtmlArg contained href title  syn match   jadePlainChar "\\" contained  syn region  jadeInterpolation matchgroup=jadeInterpolationDelimiter start="#{" end="}" contains=@htmlJavascript  syn match   jadeInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)" +syn match   jadeTagInlineText "\s.*$" contained contains=jadeInterpolation,jadeTextInlineJade +syn region  jadePipedText matchgroup=jadePipeChar start="|" end="$" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadePipedText skipnl +syn match   jadeTagBlockChar "\.$" contained nextgroup=jadeTagBlockText,jadeTagBlockEnd skipnl +syn region  jadeTagBlockText start="\%(\s*\)\S" end="\ze\n" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadeTagBlockText,jadeTagBlockEnd skipnl +syn region  jadeTagBlockEnd start="\s*\S" end="$" contained contains=jadeInterpolation,jadeTextInlineJade nextgroup=jadeBegin skipnl +syn region  jadeTextInlineJade matchgroup=jadeInlineDelimiter start="#\[" end="]" contained contains=jadeTag keepend  syn region  jadeJavascriptFilter matchgroup=jadeFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript  syn region  jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffeescript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript @@ -55,9 +61,9 @@ syn region  jadeStylusFilter matchgroup=jadeFilter start="^\z(\s*\):stylus\s*$"  syn region  jadePlainFilter matchgroup=jadeFilter start="^\z(\s*\):\%(sass\|less\|cdata\)\s*$" end="^\%(\z1\s\|\s*$\)\@!"  syn match  jadeScriptConditional "^\s*\<\%(if\|else\|unless\|while\|until\|case\|when\|default\)\>[?!]\@!" -syn region  jadeScriptLoopRegion start="^\s*\(for\)" end="$" contains=jadeScriptLoopKeywords +syn match  jadeScriptStatement "^\s*\<\%(each\|for\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!" +syn region  jadeScriptLoopRegion start="^\s*\(for \)" end="$" contains=jadeScriptLoopKeywords  syn keyword  jadeScriptLoopKeywords for in contained -syn match  jadeScriptStatement "^\s*\<\%(each\|block\|prepend\|append\|mixin\|extends\|include\)\>[?!]\@!"  syn region  jadeJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,jadeJavascriptTag keepend   syn region  jadeJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=jadeBegin,jadeTag @@ -75,9 +81,12 @@ hi def link jadeAttributesDelimiter    Identifier  hi def link jadeIdChar                 Special  hi def link jadeClassChar              Special  hi def link jadeBlockExpansionChar     Special +hi def link jadePipeChar               Special +hi def link jadeTagBlockChar           Special  hi def link jadeId                     Identifier  hi def link jadeClass                  Type  hi def link jadeInterpolationDelimiter Delimiter +hi def link jadeInlineDelimiter        Delimiter  hi def link jadeFilter                 PreProc  hi def link jadeDocType                PreProc  hi def link jadeComment                Comment diff --git a/syntax/markdown.vim b/syntax/markdown.vim index 8fc47278..8c981bbe 100644 --- a/syntax/markdown.vim +++ b/syntax/markdown.vim @@ -75,18 +75,20 @@ syn region markdownLink matchgroup=markdownLinkDelimiter start="(" end=")" conta  syn region markdownId matchgroup=markdownIdDelimiter start="\[" end="\]" keepend contained  syn region markdownAutomaticLink matchgroup=markdownUrlDelimiter start="<\%(\w\+:\|[[:alnum:]_+-]\+@\)\@=" end=">" keepend oneline -syn region markdownItalic start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart -syn region markdownItalic start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart -syn region markdownBold start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic -syn region markdownBold start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic -syn region markdownBoldItalic start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart -syn region markdownBoldItalic start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart +let s:concealends = has('conceal') ? ' concealends' : '' +exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=\*\|\*\S\@=" end="\S\@<=\*\|\*\S\@=" keepend contains=markdownLineStart' . s:concealends +exe 'syn region markdownItalic matchgroup=markdownItalicDelimiter start="\S\@<=_\|_\S\@=" end="\S\@<=_\|_\S\@=" keepend contains=markdownLineStart' . s:concealends +exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=\*\*\|\*\*\S\@=" end="\S\@<=\*\*\|\*\*\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends +exe 'syn region markdownBold matchgroup=markdownBoldDelimiter start="\S\@<=__\|__\S\@=" end="\S\@<=__\|__\S\@=" keepend contains=markdownLineStart,markdownItalic' . s:concealends +exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=\*\*\*\|\*\*\*\S\@=" end="\S\@<=\*\*\*\|\*\*\*\S\@=" keepend contains=markdownLineStart' . s:concealends +exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start="\S\@<=___\|___\S\@=" end="\S\@<=___\|___\S\@=" keepend contains=markdownLineStart' . s:concealends +  syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart  syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart  syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*```.*$" end="^\s*```\ze\s*$" keepend -syn match markdownFootnote "\[^[^\]]\]\s*$" -syn match markdownFootnoteDefinition "^\[^[^\]]\]:" +syn match markdownFootnote "\[^[^\]]\+\]" +syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"  if main_syntax ==# 'markdown'    for s:type in g:markdown_fenced_languages @@ -125,8 +127,11 @@ hi def link markdownUrlDelimiter          htmlTag  hi def link markdownUrlTitleDelimiter     Delimiter  hi def link markdownItalic                htmlItalic +hi def link markdownItalicDelimiter       markdownItalic  hi def link markdownBold                  htmlBold +hi def link markdownBoldDelimiter         markdownBold  hi def link markdownBoldItalic            htmlBoldItalic +hi def link markdownBoldItalicDelimiter   markdownBoldItalic  hi def link markdownCodeDelimiter         Delimiter  hi def link markdownEscape                Special diff --git a/syntax/mustache.vim b/syntax/mustache.vim index 3fc0bf3f..af1a8289 100644 --- a/syntax/mustache.vim +++ b/syntax/mustache.vim @@ -40,10 +40,10 @@ else  endif  syntax match mustacheError '}}}\?' -syntax match mustacheInsideError '{{[{#<>=!\/]\?' +syntax match mustacheInsideError '{{[{$#<>=!\/]\?'  syntax region mustacheInside start=/{{/ end=/}}}\?/ keepend containedin=TOP,@htmlMustacheContainer  syntax match mustacheOperators '=\|\.\|/' contained containedin=mustacheInside,@htmlMustacheContainer -syntax region mustacheSection start='{{[#^/]'lc=2 end=/}}/me=e-2 contained containedin=mustacheInside,@htmlMustacheContainer +syntax region mustacheSection start='{{[$#^/]'lc=2 end=/}}/me=e-2 contained containedin=mustacheInside,@htmlMustacheContainer  syntax region mustachePartial start=/{{[<>]/lc=2 end=/}}/me=e-2 contained containedin=mustacheInside,@htmlMustacheContainer  syntax region mustacheMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 contained containedin=mustacheInside,@htmlMustacheContainer  syntax match mustacheHandlebars '{{\|}}' contained containedin=mustacheInside,@htmlMustacheContainer diff --git a/syntax/perl.vim b/syntax/perl.vim index 76e54c6c..75c4d5e6 100644 --- a/syntax/perl.vim +++ b/syntax/perl.vim @@ -28,7 +28,7 @@  " unlet perl_fold  " unlet perl_fold_blocks  " unlet perl_nofold_packages -" let perl_nofold_subs = 1 +" unlet perl_nofold_subs  " unlet perl_fold_anonymous_subs  " unlet perl_no_subprototype_error @@ -145,11 +145,11 @@ syn match  perlPackageRef	 "[$@#%*&]\%(\%(::\|'\)\=\I\i*\%(\%(::\|'\)\I\i*\)*\)\  if !exists("perl_no_scope_in_variables")    syn match  perlVarPlain       "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref -  syn match  perlVarPlain2                   "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef +  syn match  perlVarPlain2                   "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref    syn match  perlFunctionName                "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref  else    syn match  perlVarPlain       "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref -  syn match  perlVarPlain2                   "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" +  syn match  perlVarPlain2                   "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref    syn match  perlFunctionName                "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref  endif @@ -172,7 +172,9 @@ if !exists("perl_no_extended_vars")    syn region perlVarMember	matchgroup=perlVarPlain start="\%(->\)\=\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod,perlPostDeref extend    syn match perlPackageConst	"__PACKAGE__" nextgroup=perlMethod,perlPostDeref    syn match  perlMethod		"->\$*\I\i*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref -  syn match  perlPostDeref	"->\%($#\|[$@%]\)\*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref +  syn match  perlPostDeref	"->\%($#\|[$@%&*]\)\*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref +  syn region  perlPostDeref	start="->\%($#\|[$@%&*]\)\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref +  syn region  perlPostDeref	matchgroup=perlPostDeref start="->\%($#\|[$@%&*]\){" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarSimpleMember,perlVarMember,perlMethod,perlPostDeref  endif  " File Descriptors @@ -369,9 +371,12 @@ else  endif  if !exists("perl_no_subprototype_error") " Set 1 if using signatures feature in perl5.19.9      syn match perlSubPrototypeError "(\%(\_s*\%(\%(\\\%([$@%&*]\|\[[$@%&*]\+\]\)\|[$&*]\|[@%]\%(\_s*)\)\@=\|;\%(\_s*[)$@%&*\\]\)\@=\|_\%(\_s*[);]\)\@=\)\_s*\)*\)\@>\zs\_[^)]\+" contained -    syn match perlSubPrototype +(\_[^)]*)\_s*\|+ nextgroup=perlSubAttributes,perlComment contained contains=perlSubPrototypeError +    syn match perlSubPrototype +(\_[^)]*)\_s*+ nextgroup=perlSubAttributes,perlComment contained contains=perlSubPrototypeError +else +    syntax match perlSignature "(.\{-})" nextgroup=perlSubAttributes,perlComment contained  endif -syn match perlSubName +\%(\h\|::\|'\w\)\%(\w\|::\|'\w\)*\_s*\|+ contained nextgroup=perlSubPrototype,perlComment + +syn match perlSubName +\%(\h\|::\|'\w\)\%(\w\|::\|'\w\)*\_s*\|+ contained nextgroup=perlSubPrototype,perlSignature,perlSubAttributes,perlComment  syn match perlFunction +\<sub\>\_s*+ nextgroup=perlSubName @@ -456,6 +461,7 @@ HiLink perlOperator		Operator  HiLink perlFunction		Keyword  HiLink perlSubName		Function  HiLink perlSubPrototype		Type +HiLink perlSignature		Type  HiLink perlSubAttributes	PreProc  HiLink perlSubAttributesCont	perlSubAttributes  HiLink perlComment		Comment diff --git a/syntax/php.vim b/syntax/php.vim index edb1530e..d5c28aea 100644 --- a/syntax/php.vim +++ b/syntax/php.vim @@ -3,7 +3,7 @@  "  " {{{ BLOCK: Last-modified -" Mon, 02 Jun 2014 07:13:11 +0000, PHP 5.6.0beta3 +" Thu, 10 Jul 2014 06:50:23 +0000, PHP 5.6.0RC2  " }}}  " @@ -33,11 +33,19 @@  "       (Statements) in your code.  "  " Options:  php_sql_query = 1  for SQL syntax highlighting inside strings (default: 0) +"           php_sql_heredoc = 1 for SQL syntax highlighting inside heredocs (default: 1) +"           b:sql_type_override = 'postgresql' for PostgreSQL syntax highlighting in current buffer (default: 'mysql') +"           g:sql_type_default = 'postgresql' to set global SQL syntax highlighting language default (default: 'mysql')"  "           php_html_in_strings = 1  for HTML syntax highlighting inside strings (default: 0) +"           php_html_in_heredoc = 1 for HTML syntax highlighting inside heredocs (default: 1) +"           php_html_load = 1 for loading the HTML syntax at all.  Overwrites php_html_in_strings and php_html_in_heredoc (default: 1) +"           php_ignore_phpdoc = 0 for not highlighting parts of phpDocs  "           php_parent_error_close = 1  for highlighting parent error ] or ) (default: 0)  "           php_parent_error_open = 1  for skipping an php end tag,  "                                      if there exists an open ( or [ without a closing one (default: 0) -"           php_folding = 1  for folding classes and functions +"           php_folding = 1  for folding loops, if/elseif/else, switch, try/catch, classes, and functions based on +"                            indent, finds a } with an indent matching the structure. +"                         2  for folding all { }, ( ), and [ ] pairs. (see known bugs ii)  "           php_sync_method = x  "                             x=-1 to sync by search ( default )  "                             x>0 to sync at least x lines backwards @@ -52,12 +60,6 @@  "           g:php_syntax_extensions_disabled  A list of extension names (lowercase) for which built-in functions,  "                                             constants, classes and interfaces is enabled / disabled.  " -" Note: -" Setting php_folding=1 will match a closing } by comparing the indent -" before the class or function keyword with the indent of a matching }. -" Setting php_folding=2 will match all of pairs of {,} ( see known -" bugs ii ) -"  " Known Bugs:  "  - setting  php_parent_error_close  on  and  php_parent_error_open  off  "    has these two leaks: @@ -83,10 +85,31 @@ if !exists("main_syntax")    let main_syntax = 'php'  endif -runtime! syntax/html.vim -unlet! b:current_syntax -" HTML syntax file turns on spelling for all top level words, we attempt to turn off -syntax spell default +if !exists("php_html_load") +  let php_html_load=1 +endif + +if (exists("php_html_load") && php_html_load) +  if !exists("php_html_in_heredoc") +    let php_html_in_heredoc=1 +  endif + +  runtime! syntax/html.vim +  unlet! b:current_syntax +  " HTML syntax file turns on spelling for all top level words, we attempt to turn off +  syntax spell default + +  syn cluster htmlPreproc add=phpRegion +else +  " If it is desired that the HTML syntax file not be loaded at all, set the options for highlighting it in string +  " and heredocs to false. +  let php_html_in_strings=0 +  let php_html_in_heredoc=0 +endif + +if (exists("php_html_in_strings") && php_html_in_strings) +  syn cluster phpAddStrings add=@htmlTop +endif  " Set sync method if none declared  if ( ! exists("php_sync_method") || php_sync_method == 1) @@ -97,27 +120,42 @@ if ( ! exists("php_sync_method") || php_sync_method == 1)    endif  endif -syn cluster htmlPreproc add=phpRegion - -" Use MySQL as the default SQL syntax file. -" See https://github.com/StanAngeloff/php.vim/pull/1 -if !exists('b:sql_type_override') && !exists('g:sql_type_default') -  let b:sql_type_override='mysql' +if !exists("php_sql_heredoc") +  let php_sql_heredoc=1  endif -syn include @sqlTop syntax/sql.vim -syn sync clear -unlet! b:current_syntax -syn cluster sqlTop remove=sqlString,sqlComment +if ((exists("php_sql_query") && php_sql_query) || (exists("php_sql_heredoc") && php_sql_heredoc)) +  " Use MySQL as the default SQL syntax file. +  " See https://github.com/StanAngeloff/php.vim/pull/1 +  if !exists('b:sql_type_override') && !exists('g:sql_type_default') +    let b:sql_type_override='mysql' +  endif +  syn include @sqlTop syntax/sql.vim + +  syn sync clear +  unlet! b:current_syntax +  syn cluster sqlTop remove=sqlString,sqlComment + +  if (exists("php_sql_query") && php_sql_query) +    syn cluster phpAddStrings contains=@sqlTop +  endif +endif -if (exists("php_sql_query") && php_sql_query) -  syn cluster phpAddStrings contains=@sqlTop +" set default for php_folding so we don't have to keep checking its existence. +if !exists("php_folding") +  let php_folding = 0  endif -if (exists("php_html_in_strings") && php_html_in_strings) -  syn cluster phpAddStrings add=@htmlTop +" Folding Support {{{ +" +if php_folding==1 && has("folding") +  command! -nargs=+ SynFold <args> fold +else +  command! -nargs=+ SynFold <args>  endif +" }}} +  syn case match  " Superglobals @@ -240,7 +278,7 @@ syn keyword phpConstants ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7  endif  if index(g:php_syntax_extensions_enabled, "tokenizer") >= 0 && index(g:php_syntax_extensions_disabled, "tokenizer") < 0 && ( ! exists("b:php_syntax_extensions_enabled") || index(b:php_syntax_extensions_enabled, "tokenizer") >= 0) && ( ! exists("b:php_syntax_extensions_disabled") || index(b:php_syntax_extensions_disabled, "tokenizer") < 0)  " tokenizer constants -syn keyword phpConstants T_ABSTRACT T_AND_EQUAL T_ARRAY T_ARRAY_CAST T_AS T_BAD_CHARACTER T_BOOLEAN_AND T_BOOLEAN_OR T_BOOL_CAST T_BREAK T_CALLABLE T_CASE T_CATCH T_CHARACTER T_CLASS T_CLASS_C T_CLONE T_CLOSE_TAG T_COMMENT T_CONCAT_EQUAL T_CONST T_CONSTANT_ENCAPSED_STRING T_CONTINUE T_CURLY_OPEN T_DEC T_DECLARE T_DEFAULT T_DIR T_DIV_EQUAL T_DNUMBER T_DO T_DOC_COMMENT T_DOLLAR_OPEN_CURLY_BRACES T_DOUBLE_ARROW T_DOUBLE_CAST T_DOUBLE_COLON T_ECHO T_ELLIPSIS T_ELSE T_ELSEIF T_EMPTY T_ENCAPSED_AND_WHITESPACE T_ENDDECLARE T_ENDFOR T_ENDFOREACH T_ENDIF T_ENDSWITCH T_ENDWHILE T_END_HEREDOC T_EVAL T_EXIT T_EXTENDS T_FILE T_FINAL T_FINALLY T_FOR T_FOREACH T_FUNCTION T_FUNC_C T_GLOBAL T_GOTO T_HALT_COMPILER T_IF T_IMPLEMENTS T_INC T_INCLUDE T_INCLUDE_ONCE T_INLINE_HTML T_INSTANCEOF T_INSTEADOF T_INTERFACE T_INT_CAST T_ISSET T_IS_EQUAL T_IS_GREATER_OR_EQUAL T_IS_IDENTICAL T_IS_NOT_EQUAL T_IS_NOT_IDENTICAL T_IS_SMALLER_OR_EQUAL T_LINE T_LIST T_LNUMBER T_LOGICAL_AND T_LOGICAL_OR T_LOGICAL_XOR T_METHOD_C T_MINUS_EQUAL T_MOD_EQUAL T_MUL_EQUAL T_NAMESPACE T_NEW T_NS_C T_NS_SEPARATOR T_NUM_STRING T_OBJECT_CAST T_OBJECT_OPERATOR T_OPEN_TAG T_OPEN_TAG_WITH_ECHO T_OR_EQUAL T_PAAMAYIM_NEKUDOTAYIM T_PLUS_EQUAL T_PRINT T_PRIVATE T_PROTECTED T_PUBLIC T_REQUIRE T_REQUIRE_ONCE T_RETURN T_SL T_SL_EQUAL T_SR T_SR_EQUAL T_START_HEREDOC T_STATIC T_STRING T_STRING_CAST T_STRING_VARNAME T_SWITCH T_THROW T_TRAIT T_TRAIT_C T_TRY T_UNSET T_UNSET_CAST T_USE T_VAR T_VARIABLE T_WHILE T_WHITESPACE T_XOR_EQUAL T_YIELD contained +syn keyword phpConstants T_ABSTRACT T_AND_EQUAL T_ARRAY T_ARRAY_CAST T_AS T_BAD_CHARACTER T_BOOLEAN_AND T_BOOLEAN_OR T_BOOL_CAST T_BREAK T_CALLABLE T_CASE T_CATCH T_CHARACTER T_CLASS T_CLASS_C T_CLONE T_CLOSE_TAG T_COMMENT T_CONCAT_EQUAL T_CONST T_CONSTANT_ENCAPSED_STRING T_CONTINUE T_CURLY_OPEN T_DEC T_DECLARE T_DEFAULT T_DIR T_DIV_EQUAL T_DNUMBER T_DO T_DOC_COMMENT T_DOLLAR_OPEN_CURLY_BRACES T_DOUBLE_ARROW T_DOUBLE_CAST T_DOUBLE_COLON T_ECHO T_ELLIPSIS T_ELSE T_ELSEIF T_EMPTY T_ENCAPSED_AND_WHITESPACE T_ENDDECLARE T_ENDFOR T_ENDFOREACH T_ENDIF T_ENDSWITCH T_ENDWHILE T_END_HEREDOC T_EVAL T_EXIT T_EXTENDS T_FILE T_FINAL T_FINALLY T_FOR T_FOREACH T_FUNCTION T_FUNC_C T_GLOBAL T_GOTO T_HALT_COMPILER T_IF T_IMPLEMENTS T_INC T_INCLUDE T_INCLUDE_ONCE T_INLINE_HTML T_INSTANCEOF T_INSTEADOF T_INTERFACE T_INT_CAST T_ISSET T_IS_EQUAL T_IS_GREATER_OR_EQUAL T_IS_IDENTICAL T_IS_NOT_EQUAL T_IS_NOT_IDENTICAL T_IS_SMALLER_OR_EQUAL T_LINE T_LIST T_LNUMBER T_LOGICAL_AND T_LOGICAL_OR T_LOGICAL_XOR T_METHOD_C T_MINUS_EQUAL T_MOD_EQUAL T_MUL_EQUAL T_NAMESPACE T_NEW T_NS_C T_NS_SEPARATOR T_NUM_STRING T_OBJECT_CAST T_OBJECT_OPERATOR T_OPEN_TAG T_OPEN_TAG_WITH_ECHO T_OR_EQUAL T_PAAMAYIM_NEKUDOTAYIM T_PLUS_EQUAL T_POW T_POW_EQUAL T_PRINT T_PRIVATE T_PROTECTED T_PUBLIC T_REQUIRE T_REQUIRE_ONCE T_RETURN T_SL T_SL_EQUAL T_SR T_SR_EQUAL T_START_HEREDOC T_STATIC T_STRING T_STRING_CAST T_STRING_VARNAME T_SWITCH T_THROW T_TRAIT T_TRAIT_C T_TRY T_UNSET T_UNSET_CAST T_USE T_VAR T_VARIABLE T_WHILE T_WHITESPACE T_XOR_EQUAL T_YIELD contained  endif  if index(g:php_syntax_extensions_enabled, "xml") >= 0 && index(g:php_syntax_extensions_disabled, "xml") < 0 && ( ! exists("b:php_syntax_extensions_enabled") || index(b:php_syntax_extensions_enabled, "xml") >= 0) && ( ! exists("b:php_syntax_extensions_disabled") || index(b:php_syntax_extensions_disabled, "xml") < 0)  " xml constants @@ -444,10 +482,15 @@ endif  syntax keyword phpClasses containedin=ALLBUT,phpComment,phpDocComment,phpStringDouble,phpStringSingle,phpIdentifier,phpMethodsVar  " Control Structures -syn keyword phpKeyword if echo else elseif while do for foreach function break switch case default continue return goto as endif endwhile endfor endforeach endswitch declare endeclare print new clone yield contained +syn keyword phpKeyword echo continue case default break return goto as endif endwhile endfor endforeach endswitch declare endeclare print new clone yield contained +" Only create keyword groupings for these if not doing folding, otherwise they take precedence over the regions +" used for folding. +if php_folding != 1 +  syn keyword phpKeyword if else elseif while do for foreach function switch contained -" Exception Keywords -syn keyword phpKeyword try catch finally throw contained +  " Exception Keywords +  syn keyword phpKeyword try catch finally throw contained +endif  " Class Keywords  syn keyword phpType class abstract extends interface implements static final var public private protected const trait contained @@ -532,16 +575,16 @@ endif  syn match phpCommentStar contained "^\s*\*[^/]"me=e-1  syn match phpCommentStar contained "^\s*\*$" -if !exists("php_ignore_phpdoc") +if !exists("php_ignore_phpdoc") || !php_ignore_phpdoc    syn case ignore    syn region phpDocComment   start="/\*\*" end="\*/" keepend contains=phpCommentTitle,phpDocTags,phpTodo,@Spell    syn region phpCommentTitle contained matchgroup=phpDocComment start="/\*\*" matchgroup=phpCommmentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=phpCommentStar,phpTodo,phpDocTags,@Spell containedin=phpDocComment    syn region phpDocTags  start="{@\(example\|id\|internal\|inheritdoc\|link\|source\|toc\|tutorial\)" end="}" containedin=phpDocComment -  syn match  phpDocTags  "@\(abstract\|access\|author\|category\|copyright\|deprecated\|example\|exception\|filesource\|final\|global\|id\|ignore\|inheritdoc\|internal\|license\|link\|magic\|method\|name\|package\|param\|property\|return\|see\|since\|source\|static\|staticvar\|subpackage\|throws\|toc\|todo\|tutorial\|uses\|var\|version\)\s\+\S\+.*" contains=phpDocParam containedin=phpDocComment -  syn match  phpDocParam "\s\S\+" contained contains=phpDocIdentifier -  syn match  phpDocIdentifier contained "$\h\w*" +  syn match phpDocTags "@\%(abstract\|access\|author\|category\|copyright\|deprecated\|example\|exception\|filesource\|final\|global\|id\|ignore\|inheritdoc\|internal\|license\|link\|magic\|method\|name\|package\|param\|property\|return\|see\|since\|source\|static\|staticvar\|subpackage\|throws\|toc\|todo\|tutorial\|uses\|var\|version\)" containedin=phpDocComment nextgroup=phpDocParam,phpDocIdentifier skipwhite +  syn match phpDocParam "\s\+\zs\%(\h\w*|\?\)\+" nextgroup=phpDocIdentifier skipwhite +  syn match phpDocIdentifier "\s\+\zs$\h\w*"    syn case match  endif @@ -568,23 +611,29 @@ else  endif  " HereDoc -  syn case match -  syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend -  syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend -" including HTML,JavaScript,SQL even if not enabled via options -  syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@="  contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend -  syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend -  syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@="  contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend -  syn case ignore +syn case match + +SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\I\i*\)$" end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend +SynFold syn region phpHereDoc matchgroup=Delimiter start=+\(<<<\)\@<="\z(\I\i*\)"$+ end="^\z1\(;\=$\)\@=" contained contains=@Spell,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend +" including HTML,JavaScript,SQL if enabled via options +if (exists("php_html_in_heredoc") && php_html_in_heredoc) +  SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(html\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@="  contained contains=@htmlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend +  SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(javascript\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@="  contained contains=@htmlJavascript,phpIdentifierSimply,phpIdentifier,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend +endif +if (exists("php_sql_heredoc") && php_sql_heredoc) +  SynFold syn region phpHereDoc matchgroup=Delimiter start="\(<<<\)\@<=\z(\(\I\i*\)\=\(sql\)\c\(\i*\)\)$" end="^\z1\(;\=$\)\@=" contained contains=@sqlTop,phpIdentifier,phpIdentifierSimply,phpIdentifierComplex,phpSpecialChar,phpMethodsVar,phpStrEsc keepend extend +endif  " NowDoc -  syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\I\i*\)'$+ end="^\z1\(;\=$\)\@=" contained keepend extend +SynFold syn region phpNowDoc matchgroup=Delimiter start=+\(<<<\)\@<='\z(\I\i*\)'$+ end="^\z1\(;\=$\)\@=" contained keepend extend + +syn case ignore  " Parent  if (exists("php_parent_error_close") && php_parent_error_close) || (exists("php_parent_error_open") && php_parent_error_open)    syn match  phpParent "[{}]"  contained -  syn region phpParent matchgroup=Delimiter start="(" end=")"  contained contains=@phpClFunction transparent -  syn region phpParent matchgroup=Delimiter start="\[" end="\]"  contained contains=@phpClInside transparent +  syn region phpParent matchgroup=Delimiter start="(" end=")"  contained contains=@phpClFunction,@phpClControl transparent +  syn region phpParent matchgroup=Delimiter start="\[" end="\]"  contained contains=@phpClFunction,@phpClControl transparent    if ! (exists("php_parent_error_close") && php_parent_error_close)      syn match phpParent "[\])]" contained    endif @@ -622,7 +671,8 @@ syn match phpFunction /\h\w*/  syn cluster phpClConst contains=phpFunctions,phpClasses,phpStaticClasses,phpIdentifier,phpStatement,phpKeyword,phpOperator,phpSplatOperator,phpStringSingle,phpStringDouble,phpBacktick,phpNumber,phpType,phpBoolean,phpStructure,phpMethodsVar,phpConstants,phpException,phpSuperglobals,phpMagicConstants,phpServerVars  syn cluster phpClInside contains=@phpClConst,phpComment,phpDocComment,phpParent,phpParentError,phpInclude,phpHereDoc,phpNowDoc  syn cluster phpClFunction contains=@phpClInside,phpDefine,phpParentError,phpStorageClass,phpKeyword -syn cluster phpClTop contains=@phpClFunction,phpFoldFunction,phpFoldClass,phpFoldInterface,phpFoldTry,phpFoldCatch +syn cluster phpClControl contains=phpFoldIfContainer,phpFoldWhile,phpFoldDoWhile,phpFoldFor,phpFoldForeach,phpFoldTryContainer,phpFoldSwitch +syn cluster phpClTop contains=@phpClFunction,@phpClControl,phpFoldFunction,phpFoldClass,phpFoldInterface,phpFoldHtmlInside  " Php Region  if (exists("php_parent_error_open") && php_parent_error_open) @@ -632,8 +682,8 @@ else  endif  " Fold -if exists("php_folding") && php_folding==1 -" match one line constructs here and skip them at folding +if php_folding==1 +  " match one line constructs here and skip them at folding    syn keyword phpSCKeyword  abstract final private protected public static  contained    syn keyword phpFCKeyword  function  contained    syn match phpDefine "\(\s\|^\)\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function\(\s\+.*[;}]\)\@="  contained contains=phpSCKeyword @@ -641,19 +691,46 @@ if exists("php_folding") && php_folding==1    syn match phpStructure "\(\s\|^\)interface\(\s\+.*}\)\@="  contained    syn match phpException "\(\s\|^\)try\(\s\+.*}\)\@="  contained    syn match phpException "\(\s\|^\)catch\(\s\+.*}\)\@="  contained +  syn match phpKeyword "^\s*\(if\|else\%[if]\)\s*\(.*{.*}$\|[^{}]*$\)\@=" contained +  syn match phpKeyword "^\s*while\s*\([^{}]*$\|.*{.*}$\)\@=" contained +  syn match phpKeyword "^\s*do\s*\([^{}]*$\|{.*}\s*while\s*.*;$\)\@=" contained +  syn match phpKeyword "while\s*\((.*);$\)\@=" contained +  syn match phpKeyword "^\s*for\s*\((.*)\s*{.*}$\|[^{}]*$\)\@=" contained +  syn match phpKeyword "^\s*foreach\s*\((.*)\s*{.*}$\|[^{}]*$\)\@=" contained    set foldmethod=syntax    syn region phpFoldHtmlInside matchgroup=Delimiter start="?>" end="<?\(php\)\=" contained transparent contains=@htmlTop -  syn region phpFoldFunction matchgroup=Storageclass start="^\z(\s*\)\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function\s\([^};]*$\)\@="rs=e-9 matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldHtmlInside,phpFCKeyword contained transparent fold extend -  syn region phpFoldFunction matchgroup=Define start="^function\s\([^};]*$\)\@=" matchgroup=Delimiter end="^}" contains=@phpClFunction,phpFoldHtmlInside contained transparent fold extend +  syn region phpFoldFunction matchgroup=Storageclass start="^\z(\s*\)\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function\s\([^};]*$\)\@="rs=e-9 matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,@phpClControl,phpFoldHtmlInside,phpFCKeyword contained transparent fold extend +  syn region phpFoldFunction matchgroup=Define start="^function\s\([^};]*$\)\@=" matchgroup=Delimiter end="^}" contains=@phpClFunction,@phpClControl,phpFoldHtmlInside contained transparent fold extend    syn region phpFoldClass matchgroup=Structure start="^\z(\s*\)\(abstract\s\+\|final\s\+\)*class\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction,phpSCKeyword contained transparent fold extend    syn region phpFoldInterface matchgroup=Structure start="^\z(\s*\)interface\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction contained transparent fold extend -  syn region phpFoldCatch matchgroup=Exception start="^\z(\s*\)catch\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction contained transparent fold extend -  syn region phpFoldTry matchgroup=Exception start="^\z(\s*\)try\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="^\z1}" contains=@phpClFunction,phpFoldFunction contained transparent fold extend -elseif exists("php_folding") && php_folding==2 + +  syn region phpFoldTryContainer start="^\z(\s*\)try\s\+\(.*{$\)\@=" skip="^\z1}\_s*\(catch\|finally\)" end="^\z1}$" keepend extend contained contains=@phpClFunction,@phpClControl,phpFoldFunction,phpFoldHtmlInside transparent +  syn region phpFoldTry matchgroup=phpException start="^\z(\s*\)try\s\+\(.*{$\)\@=" matchgroup=Delimiter end="^\z1}$" end="^\z1}\(\s\+\(catch\|finally\)\)\@="me=s-1 containedin=phpFoldTryContainer contained transparent keepend fold extend nextgroup=phpFoldCatch +  syn region phpFoldCatch matchgroup=phpException start="^\z(\s*\)\(}\s\+\)\=catch\s\+\(.*{$\)\@=" matchgroup=Delimiter end="^\z1}$" end="^\z1}\(\s\+\(catch\|finally\)\)\@="me=s-1 containedin=phpFoldTryContainer keepend contained transparent fold extend nextgroup=phpFoldCatch,phpFoldFinally +  syn region phpFoldFinally matchgroup=phpException start="^\z(\s*\)\(}\s\+\)\=finally\s\+\(.*{$\)\@=" matchgroup=Delimiter end="^\z1}$" contained containedin=phpFoldTryContainer transparent fold keepend + +  syn region phpFoldIfContainer start="^\z(\s*\)if\s\+\(.*{$\)\@=" skip="^\z1}\_s*else\%[if]" end="^\z1}$" keepend extend contained contains=@phpClFunction,@phpClControl,phpFCKeyword,phpFoldHtmlInside +  syn region phpFoldIf matchgroup=phpKeyword start="^\z(\s*\)if\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="\(^\z1\)\@=}\(\_s\+\%[elseif]\s\+[^}]*$\)\@="me=s-1 contained containedin=phpFoldIfContainer keepend nextgroup=phpFoldElseIf,phpFoldElse fold transparent +  syn region phpFoldElseIf matchgroup=phpKeyword start="^\z(\s*\)\(}\s\+\)\=elseif\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="\(^\z1\)\@=}\(\s*\%[elseif]\s*[^}]*$\)\@="me=s-1 contained containedin=phpFoldIfContainer keepend nextgroup=phpFoldElseIf,phpFoldElse fold transparent  +  syn region phpFoldElse matchgroup=phpKeyword start="^\z(\s*\)\(}\s\+\)\=else\s\+\([^}]*$\)\@=" matchgroup=Delimiter end="\(^\z1\)\@=}\(\s\+\%[elseif]\s\+[^}]*$\)\@="me=s-1 contained containedin=phpFoldIfContainer keepend fold transparent + +  syn region phpFoldSwitch matchgroup=phpKeyword start="^\z(\s*\)switch\s*\(.*{$\)\@=" matchgroup=Delimiter end="^\z1}$" keepend extend contained contains=@phpClFunction,@phpClControl,phpFCKeyword,phpFoldHtmlInside fold transparent +  syn region phpFoldCase matchgroup=phpKeyword start="^\z(\s*\)case\s*\(.*:$\)\@=" end="^\z1\(case\|default\)"me=s-1 contained containedin=phpFoldSwitch keepend contains=@phpClFunction,@phpClControl,phpFCKeyword,phpFoldHtmlInside nextgroup=phpFoldCase,phpFoldDefault fold transparent +  syn region phpFoldDefault matchgroup=phpKeyword start="^\z(\s*\)default\(:$\)\@=" matchgroup=Delimiter end="\s*}$" contained contains=@phpClFunction,@phpClControl,phpFCKeyword,phpFoldHtmlInside containedin=phpFoldSwitch keepend fold transparent + +  syn region phpFoldWhile matchgroup=phpKeyword start="^\z(\s*\)while\s\+\(.*{$\)\@=" matchgroup=Delimiter end="^\z1}$" contains=@phpClFunction,@phpClControl,phpFoldHtmlInside contained fold extend +  syn region phpFoldDoWhile matchgroup=phpkeyword start="^\z(\s*\)do\s\+\({$\)\@=" matchgroup=Delimiter end="\z1}\s\+\(while\s\+.*;$\)\@=" contains=@phpClFunction,@phpClControl,phpFoldHtmlInside contained fold extend keepend + +  syn region phpFoldFor matchgroup=phpKeyword start="^\z(\s*\)for\s\(.*{$\)\@=" matchgroup=Delimiter end="\z1}$" contains=@phpClFunction,@phpClControl,phpFCKeyword,phpFoldHtmlInside contained transparent fold extend +  syn region phpFoldForeach matchgroup=phpKeyword start="^\z(\s*\)foreach\s\(.*{$\)\@=" matchgroup=Delimiter end="\z1}$" contains=@phpClFunction,@phpClControl,phpFCKeyword,phpFoldHtmlInside contained transparent fold extend + +elseif php_folding==2    set foldmethod=syntax    syn region phpFoldHtmlInside matchgroup=Delimiter start="?>" end="<?\(php\)\=" contained transparent contains=@htmlTop    syn region phpParent matchgroup=Delimiter start="{" end="}"  contained contains=@phpClFunction,phpFoldHtmlInside transparent fold +  syn region phpParent matchgroup=Delimiter start="(" end=")"  contained contains=@phpClFunction,phpFoldHtmlInside transparent fold +  syn region phpParent matchgroup=Delimiter start="\[" end="]"  contained contains=@phpClFunction,phpFoldHtmlInside transparent fold  endif  " Sync @@ -687,7 +764,7 @@ if !exists("did_php_syn_inits")    hi def link phpFunctions        Function    hi def link phpMethods          Function    hi def link phpClasses          StorageClass -  hi def link phpException        StorageClass +  hi def link phpException        Exception    hi def link phpIdentifier       Identifier    hi def link phpIdentifierSimply Identifier    hi def link phpStatement        Statement @@ -734,10 +811,15 @@ if !exists("did_php_syn_inits")  endif +" Cleanup: {{{ + +delcommand SynFold  let b:current_syntax = "php"  if main_syntax == 'php'    unlet main_syntax  endif -" vim: ts=8 sts=2 sw=2 expandtab +" }}} + +" vim: ts=8 sts=2 sw=2 fdm=marker expandtab diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 3ad8dca3..7d46a55b 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -103,6 +103,8 @@ syn match  rubySymbol		"[]})\"':]\@<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)  syn region rubySymbol		start="[]})\"':]\@<!:'"  end="'"  skip="\\\\\|\\'"  contains=rubyQuoteEscape fold  syn region rubySymbol		start="[]})\"':]\@<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold +syn match  rubyCapitalizedMethod	"\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@=" +  syn match  rubyBlockParameter	  "\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" contained  syn region rubyBlockParameterList start="\%(\%(\<do\>\|{\)\s*\)\@<=|" end="|" oneline display contains=rubyBlockParameter @@ -336,6 +338,7 @@ hi def link rubyAccess			Statement  hi def link rubyAttribute		Statement  hi def link rubyEval			Statement  hi def link rubyPseudoVariable		Constant +hi def link rubyCapitalizedMethod	rubyLocalVariableOrMethod  hi def link rubyComment			Comment  hi def link rubyData			Comment diff --git a/syntax/rust.vim b/syntax/rust.vim index 77348335..0204d42a 100644 --- a/syntax/rust.vim +++ b/syntax/rust.vim @@ -3,7 +3,7 @@  " Maintainer:   Patrick Walton <pcwalton@mozilla.com>  " Maintainer:   Ben Blum <bblum@cs.cmu.edu>  " Maintainer:   Chris Morgan <me@chrismorgan.info> -" Last Change:  2014 Feb 27 +" Last Change:  July 18, 2014  if version < 600    syntax clear @@ -11,6 +11,17 @@ elseif exists("b:current_syntax")    finish  endif +" Fold settings {{{1 + +if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 +  setlocal foldmethod=syntax +  if g:rust_fold == 2 +    setlocal foldlevel< +  else +    setlocal foldlevel=99 +  endif +endif +  " Syntax definitions {{{1  " Basic keywords {{{2  syn keyword   rustConditional match if else @@ -27,11 +38,10 @@ syn keyword   rustKeyword     for in if impl let  syn keyword   rustKeyword     loop once proc pub  syn keyword   rustKeyword     return super  syn keyword   rustKeyword     unsafe virtual while -syn keyword   rustKeyword     use nextgroup=rustModPath skipwhite skipempty +syn keyword   rustKeyword     use nextgroup=rustModPath,rustModPathInUse skipwhite skipempty  " FIXME: Scoped impl's name is also fallen in this category  syn keyword   rustKeyword     mod trait struct enum type nextgroup=rustIdentifier skipwhite skipempty -syn keyword   rustStorage     mut ref static -syn keyword   rustObsoleteStorage const +syn keyword   rustStorage     mut ref static const  syn keyword   rustInvalidBareKeyword crate @@ -50,6 +60,10 @@ syn region    rustBoxPlacementBalance start="(" end=")" containedin=rustBoxPlace  syn region    rustBoxPlacementBalance start="\[" end="\]" containedin=rustBoxPlacement transparent  " {} are handled by rustFoldBraces +syn region rustMacroRepeat matchgroup=rustMacroRepeatDelimiters start="$(" end=")" contains=TOP nextgroup=rustMacroRepeatCount +syn match rustMacroRepeatCount ".\?[*+]" contained +syn match rustMacroVariable "$\w\+" +  " Reserved (but not yet used) keywords {{{2  syn keyword   rustReservedKeyword alignof be do offsetof priv pure sizeof typeof unsized yield @@ -66,7 +80,7 @@ syn keyword   rustTrait       Copy Send Sized Share  syn keyword   rustTrait       Add Sub Mul Div Rem Neg Not  syn keyword   rustTrait       BitAnd BitOr BitXor  syn keyword   rustTrait       Drop Deref DerefMut -syn keyword   rustTrait       Shl Shr Index +syn keyword   rustTrait       Shl Shr Index IndexMut  syn keyword   rustEnum        Option  syn keyword   rustEnumVariant Some None  syn keyword   rustEnum        Result @@ -78,34 +92,39 @@ syn keyword   rustEnumVariant Ok Err  "syn keyword rustFunction drop  " Types and traits {{{3 -syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr IntoBytes +syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr +syn keyword rustTrait IntoBytes  syn keyword rustTrait ToCStr  syn keyword rustTrait Char  syn keyword rustTrait Clone -syn keyword rustTrait Eq Ord TotalEq TotalOrd Ordering Equiv +syn keyword rustTrait PartialEq PartialOrd Eq Ord Equiv +syn keyword rustEnum Ordering  syn keyword rustEnumVariant Less Equal Greater -syn keyword rustTrait Container Mutable Map MutableMap Set MutableSet -syn keyword rustTrait FromIterator Extendable -syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator CloneableIterator -syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize -syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul -syn keyword rustTrait Signed Unsigned -syn keyword rustTrait Primitive Int Float FloatMath ToPrimitive FromPrimitive -"syn keyword rustTrait Expect +syn keyword rustTrait Collection Mutable Map MutableMap MutableSeq +syn keyword rustTrait Set MutableSet +syn keyword rustTrait FromIterator Extendable ExactSize +syn keyword rustTrait Iterator DoubleEndedIterator +syn keyword rustTrait RandomAccessIterator CloneableIterator +syn keyword rustTrait OrdIterator MutableDoubleEndedIterator +syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul CheckedDiv +syn keyword rustTrait Signed Unsigned Primitive Int Float +syn keyword rustTrait FloatMath ToPrimitive FromPrimitive  syn keyword rustTrait Box  syn keyword rustTrait GenericPath Path PosixPath WindowsPath  syn keyword rustTrait RawPtr  syn keyword rustTrait Buffer Writer Reader Seek -syn keyword rustTrait Str StrVector StrSlice OwnedStr IntoMaybeOwned -syn keyword rustTrait StrAllocating -syn keyword rustTrait ToStr IntoStr +syn keyword rustTrait Str StrVector StrSlice OwnedStr +syn keyword rustTrait IntoMaybeOwned StrAllocating +syn keyword rustTrait ToString IntoStr  syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4  syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8  syn keyword rustTrait Tuple9 Tuple10 Tuple11 Tuple12 -syn keyword rustTrait CloneableVector ImmutableCloneableVector MutableCloneableVector +syn keyword rustTrait CloneableVector ImmutableCloneableVector +syn keyword rustTrait MutableCloneableVector MutableOrdVector  syn keyword rustTrait ImmutableVector MutableVector -syn keyword rustTrait ImmutableEqVector ImmutableTotalOrdVector MutableTotalOrdVector -syn keyword rustTrait Vector VectorVector OwnedVector MutableVectorAllocating +syn keyword rustTrait ImmutableEqVector ImmutableOrdVector +syn keyword rustTrait Vector VectorVector +syn keyword rustTrait MutableVectorAllocating  syn keyword rustTrait String  syn keyword rustTrait Vec @@ -123,8 +142,9 @@ syn keyword   rustBoolean     true false  " If foo::bar changes to foo.bar, change this ("::" to "\.").  " If foo::bar changes to Foo::bar, change this (first "\w" to "\u").  syn match     rustModPath     "\w\(\w\)*::[^<]"he=e-3,me=e-3 -syn match     rustModPath     "\w\(\w\)*" contained " only for 'use path;' +syn match     rustModPathInUse "\w\(\w\)*" contained " only for 'use path;'  syn match     rustModPathSep  "::" +" rustModPathInUse is split out from rustModPath so that :syn-include can get the group list right.  syn match     rustFuncCall    "\w\(\w\)*("he=e-1,me=e-1  syn match     rustFuncCall    "\w\(\w\)*::<"he=e-3,me=e-3 " foo::<T>(); @@ -145,11 +165,13 @@ syn match     rustOperator     display "&&\|||"  syn match     rustMacro       '\w\(\w\)*!' contains=rustAssert,rustFail  syn match     rustMacro       '#\w\(\w\)*' contains=rustAssert,rustFail -syn match     rustSpecialError display contained /\\./ -syn match     rustSpecial     display contained /\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/ +syn match     rustEscapeError   display contained /\\./ +syn match     rustEscape        display contained /\\\([nrt0\\'"]\|x\x\{2}\)/ +syn match     rustEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{8}\)/  syn match     rustStringContinuation display contained /\\\n\s*/ -syn region    rustString      start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustSpecial,rustSpecialError,rustStringContinuation,@Spell -syn region    rustString      start='r\z(#*\)"' end='"\z1' contains=@Spell +syn region    rustString      start=+b"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeError,rustStringContinuation +syn region    rustString      start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustStringContinuation,@Spell +syn region    rustString      start='b\?r\z(#*\)"' end='"\z1' contains=@Spell  syn region    rustAttribute   start="#!\?\[" end="\]" contains=rustString,rustDeriving  syn region    rustDeriving    start="deriving(" end=")" contained contains=rustTrait @@ -177,7 +199,11 @@ syn region rustGenericLifetimeCandidate display start=/\%(<\|,\s*\)\@<='/ end=/[  "rustLifetime must appear before rustCharacter, or chars will get the lifetime highlighting  syn match     rustLifetime    display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" -syn match   rustCharacter   /'\([^'\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial,rustSpecialError +syn match   rustCharacterInvalid   display contained /b\?'\zs[\n\r\t']\ze'/ +" The groups negated here add up to 0-255 but nothing else (they do not seem to go beyond ASCII). +syn match   rustCharacterInvalidUnicode   display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/ +syn match   rustCharacter   /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode +syn match   rustCharacter   /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid  syn region rustCommentLine                                        start="//"                      end="$"   contains=rustTodo,@Spell  syn region rustCommentLineDoc                                     start="//\%(//\@!\|!\)"         end="$"   contains=rustTodo,@Spell @@ -203,8 +229,6 @@ syn keyword rustTodo contained TODO FIXME XXX NB NOTE  " Trivial folding rules to begin with.  " TODO: use the AST to make really good folding  syn region rustFoldBraces start="{" end="}" transparent fold -" If you wish to enable this, setlocal foldmethod=syntax -" It's not enabled by default as it would drive some people mad.  " Default highlighting {{{1  hi def link rustDecNumber       rustNumber @@ -214,11 +238,17 @@ hi def link rustBinNumber       rustNumber  hi def link rustIdentifierPrime rustIdentifier  hi def link rustTrait           rustType +hi def link rustMacroRepeatCount   rustMacroRepeatDelimiters +hi def link rustMacroRepeatDelimiters   Macro +hi def link rustMacroVariable Define  hi def link rustSigil         StorageClass -hi def link rustSpecial       Special -hi def link rustSpecialError  Error +hi def link rustEscape        Special +hi def link rustEscapeUnicode rustEscape +hi def link rustEscapeError   Error  hi def link rustStringContinuation Special  hi def link rustString        String +hi def link rustCharacterInvalid Error +hi def link rustCharacterInvalidUnicode rustCharacterInvalid  hi def link rustCharacter     Character  hi def link rustNumber        Number  hi def link rustBoolean       Boolean @@ -233,6 +263,7 @@ hi def link rustReservedKeyword Error  hi def link rustConditional   Conditional  hi def link rustIdentifier    Identifier  hi def link rustCapsIdent     rustIdentifier +hi def link rustModPathInUse  rustModPath  hi def link rustModPath       Include  hi def link rustModPathSep    Delimiter  hi def link rustFunction      Function diff --git a/syntax/sass.vim b/syntax/sass.vim index 0212c628..8fec5d03 100644 --- a/syntax/sass.vim +++ b/syntax/sass.vim @@ -58,7 +58,7 @@ syn match sassAmpersand  "&"  " TODO: Attribute namespaces  " TODO: Arithmetic (including strings and concatenation) -syn region sassMediaQuery matchgroup=sassMedia start="@media" end="$" contains=sassMediaOperators +syn region sassMediaQuery matchgroup=sassMedia start="@media" end="[{};]\@=\|$" contains=sassMediaOperators  syn keyword sassMediaOperators and not only contained  syn region sassCharset start="@charset" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType  syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType diff --git a/syntax/scala.vim b/syntax/scala.vim index b9df50f3..97189aed 100644 --- a/syntax/scala.vim +++ b/syntax/scala.vim @@ -37,7 +37,7 @@ syn match scalaSymbol /'[_A-Za-z0-9$]\+/  hi link scalaSymbol Number  syn match scalaChar /'.'/ -syn match scalaEscapedChar /\\[\\ntbrf]/ +syn match scalaEscapedChar /\\[\\"ntbrf]/  syn match scalaUnicodeChar /\\u[A-Fa-f0-9]\{4}/  hi link scalaChar Character  hi link scalaEscapedChar Function diff --git a/syntax/slim.vim b/syntax/slim.vim index 71d1e2af..b8d7b6a8 100644 --- a/syntax/slim.vim +++ b/syntax/slim.vim @@ -48,9 +48,10 @@ syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*{\s*"  syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*\[\s*" end="\s*\]\s*" contained contains=slimAttr nextgroup=slimRuby  syn region slimWrappedAttrs matchgroup=slimWrappedAttrsDelimiter start="\s*(\s*"  end="\s*)\s*"  contained contains=slimAttr nextgroup=slimRuby -syn match slimAttr "\s*\%(\w\|-\)\+\s*" contained contains=htmlArg nextgroup=slimAttrAssignment +syn match slimAttr /\s*\%(\w\|-\)\+\s*=/me=e-1 contained contains=htmlArg nextgroup=slimAttrAssignment  syn match slimAttrAssignment "\s*=\s*" contained nextgroup=slimWrappedAttrValue,slimAttrString +syn region slimWrappedAttrValue start="[^"']" end="\s\|$" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar  syn region slimWrappedAttrValue matchgroup=slimWrappedAttrValueDelimiter start="{" end="}" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar  syn region slimWrappedAttrValue matchgroup=slimWrappedAttrValueDelimiter start="\[" end="\]" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar  syn region slimWrappedAttrValue matchgroup=slimWrappedAttrValueDelimiter start="(" end=")" contained contains=slimAttrString,@slimRubyTop nextgroup=slimAttr,slimRuby,slimInlineTagChar @@ -65,11 +66,11 @@ syn region slimInterpolation matchgroup=slimInterpolationDelimiter start="#{" en  syn region slimInterpolation matchgroup=slimInterpolationDelimiter start="#{{" end="}}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD,slimWrappedAttrs  syn match  slimInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)" -syn region slimRuby matchgroup=slimRubyOutputChar start="\s*[=]\==[']\=" skip=",\s*$" end="$" contained contains=@slimRubyTop keepend -syn region slimRuby matchgroup=slimRubyChar       start="\s*-"           skip=",\s*$" end="$" contained contains=@slimRubyTop keepend +syn region slimRuby matchgroup=slimRubyOutputChar start="\s*[=]\==[']\=" skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend +syn region slimRuby matchgroup=slimRubyChar       start="\s*-"           skip="\%\(,\s*\|\\\)$" end="$" contained contains=@slimRubyTop keepend  syn match slimComment /^\(\s*\)[/].*\(\n\1\s.*\)*/ contains=slimTodo -syn match slimText    /^\(\s*\)[`|'].*\(\n\1\s.*\)*/ +syn match slimText    /^\(\s*\)[`|'].*\(\n\1\s.*\)*/ contains=slimInterpolation  syn match slimFilter /\s*\w\+:\s*/                            contained  syn match slimHaml   /^\(\s*\)\<haml:\>.*\(\n\1\s.*\)*/       contains=@slimHaml,slimFilter | 
