diff options
Diffstat (limited to '')
| -rw-r--r-- | syntax/cpp.vim | 7 | ||||
| -rw-r--r-- | syntax/elixir.vim | 2 | ||||
| -rw-r--r-- | syntax/gitrebase.vim | 3 | ||||
| -rw-r--r-- | syntax/go.vim | 97 | ||||
| -rw-r--r-- | syntax/gotexttmpl.vim | 4 | ||||
| -rw-r--r-- | syntax/jade.vim | 6 | ||||
| -rw-r--r-- | syntax/perl.vim | 2 | ||||
| -rw-r--r-- | syntax/php.vim | 12 | ||||
| -rw-r--r-- | syntax/python.vim | 3 | ||||
| -rw-r--r-- | syntax/ruby.vim | 40 | ||||
| -rw-r--r-- | syntax/rust.vim | 57 | ||||
| -rw-r--r-- | syntax/swift.vim | 267 | ||||
| -rw-r--r-- | syntax/toml.vim | 4 | 
13 files changed, 354 insertions, 150 deletions
| diff --git a/syntax/cpp.vim b/syntax/cpp.vim index aa242e42..8f440aaf 100644 --- a/syntax/cpp.vim +++ b/syntax/cpp.vim @@ -25,7 +25,8 @@ endif  " C++ extensions  syn keyword cppStatement	new delete this friend using  syn keyword cppAccess		public protected private -syn keyword cppType		inline virtual explicit export bool wchar_t +syn keyword cppModifier		inline virtual explicit export +syn keyword cppType		bool wchar_t  syn keyword cppExceptions	throw try catch  syn keyword cppOperator		operator typeid  syn keyword cppOperator		and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq @@ -38,7 +39,8 @@ syn keyword cppConstant		__cplusplus  " C++ 11 extensions  if !exists("cpp_no_cpp11") -  syn keyword cppType		override final +  syn keyword cppModifier	override final +  syn keyword cppType		nullptr_t    syn keyword cppExceptions	noexcept    syn keyword cppStorageClass	constexpr decltype thread_local    syn keyword cppConstant	nullptr @@ -72,6 +74,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")    HiLink cppExceptions		Exception    HiLink cppOperator		Operator    HiLink cppStatement		Statement +  HiLink cppModifier		Type    HiLink cppType		Type    HiLink cppStorageClass	StorageClass    HiLink cppStructure		Structure diff --git a/syntax/elixir.vim b/syntax/elixir.vim index 26374cf3..f2c5829b 100644 --- a/syntax/elixir.vim +++ b/syntax/elixir.vim @@ -17,7 +17,7 @@ syn cluster elixirNotTop contains=@elixirRegexSpecial,@elixirStringContained,@el  syn match elixirComment '#.*' contains=elixirTodo  syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained -syn keyword elixirKeyword case when cond for if unless try receive send +syn keyword elixirKeyword case when cond for if unless try receive spawn send  syn keyword elixirKeyword exit raise throw after rescue catch else do end  syn keyword elixirKeyword quote unquote super diff --git a/syntax/gitrebase.vim b/syntax/gitrebase.vim index 4fe38e88..025c9a3b 100644 --- a/syntax/gitrebase.vim +++ b/syntax/gitrebase.vim @@ -4,7 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1  " Language:	git rebase --interactive  " Maintainer:	Tim Pope <vimNOSPAM@tpope.org>  " Filenames:	git-rebase-todo -" Last Change:	2012 April 7 +" Last Change:	2015 November 21  if exists("b:current_syntax")    finish @@ -20,6 +20,7 @@ syn match   gitrebaseEdit   "\v^e%(dit)=>"   nextgroup=gitrebaseCommit skipwhite  syn match   gitrebaseSquash "\v^s%(quash)=>" nextgroup=gitrebaseCommit skipwhite  syn match   gitrebaseFixup  "\v^f%(ixup)=>"  nextgroup=gitrebaseCommit skipwhite  syn match   gitrebaseExec   "\v^%(x|exec)>" nextgroup=gitrebaseCommand skipwhite +syn match   gitrebaseDrop   "\v^d%(rop)=>"   nextgroup=gitrebaseCommit skipwhite  syn match   gitrebaseSummary ".*"               contains=gitrebaseHash contained  syn match   gitrebaseCommand ".*"                                      contained  syn match   gitrebaseComment "^#.*"             contains=gitrebaseHash diff --git a/syntax/go.vim b/syntax/go.vim index 804608b5..4cd53c45 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -56,23 +56,23 @@ if !exists("g:go_highlight_trailing_whitespace_error")  endif  if !exists("g:go_highlight_operators") -	let g:go_highlight_operators = 0 +  let g:go_highlight_operators = 0  endif  if !exists("g:go_highlight_functions") -	let g:go_highlight_functions = 0 +  let g:go_highlight_functions = 0  endif  if !exists("g:go_highlight_methods") -	let g:go_highlight_methods = 0 +  let g:go_highlight_methods = 0  endif  if !exists("g:go_highlight_structs") -	let g:go_highlight_structs = 0 +  let g:go_highlight_structs = 0  endif  if !exists("g:go_highlight_build_constraints") -    let g:go_highlight_build_constraints = 0 +  let g:go_highlight_build_constraints = 0  endif  if !exists("g:go_highlight_string_spellcheck") @@ -119,8 +119,8 @@ syn match       goDeclaration       /\<func\>/  " Predefined functions and values -syn keyword     goBuiltins          append cap close complex copy delete imag len -syn keyword     goBuiltins          make new panic print println real recover +syn match       goBuiltins          /\<\v(append|cap|close|complex|copy|delete|imag|len)\ze\(/ +syn match       goBuiltins          /\<\v(make|new|panic|print|println|real|recover)\ze\(/  syn keyword     goBoolean           iota true false nil  hi def link     goBuiltins          Keyword @@ -164,7 +164,7 @@ syn match       goFormatSpecifier   /%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\  hi def link     goString            String  hi def link     goRawString         String -hi def link 	goFormatSpecifier   goSpecialString +hi def link     goFormatSpecifier   goSpecialString  " Characters; their contents  syn cluster     goCharacterGroup    contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU @@ -249,56 +249,75 @@ hi def link     goTodo              Todo  " Operators;  if g:go_highlight_operators != 0 -	" match single-char operators:          - + % < > ! & | ^ * = -	" and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= == -	syn match goOperator /[-+%<>!&|^*=]=\?/ -	" match / and /= -	syn match goOperator /\/\%(=\|\ze[^/*]\)/ -	" match two-char operators:               << >> &^ -	" and corresponding three-char operators: <<= >>= &^= -	syn match goOperator /\%(<<\|>>\|&^\)=\?/ -	" match remaining two-char operators: := && || <- ++ -- -	syn match goOperator /:=\|||\|<-\|++\|--/ -	" match ... -	syn match goOperator /\.\.\./ +  " match single-char operators:          - + % < > ! & | ^ * = +  " and corresponding two-char operators: -= += %= <= >= != &= |= ^= *= == +  syn match goOperator /[-+%<>!&|^*=]=\?/ +  " match / and /= +  syn match goOperator /\/\%(=\|\ze[^/*]\)/ +  " match two-char operators:               << >> &^ +  " and corresponding three-char operators: <<= >>= &^= +  syn match goOperator /\%(<<\|>>\|&^\)=\?/ +  " match remaining two-char operators: := && || <- ++ -- +  syn match goOperator /:=\|||\|<-\|++\|--/ +  " match ... +  syn match goOperator /\.\.\./  endif -hi def link     goOperator					Operator +hi def link     goOperator          Operator  " Functions;  if g:go_highlight_functions != 0 -	syn match goFunction							/\(func\s\+\)\@<=\w\+\((\)\@=/ -	syn match goFunction							/\()\s\+\)\@<=\w\+\((\)\@=/ +  syn match goFunction              /\(func\s\+\)\@<=\w\+\((\)\@=/ +  syn match goFunction              /\()\s\+\)\@<=\w\+\((\)\@=/  endif -hi def link     goFunction					Function +hi def link     goFunction          Function  " Methods;  if g:go_highlight_methods != 0 -	syn match goMethod								/\(\.\)\@<=\w\+\((\)\@=/ +  syn match goMethod                /\(\.\)\@<=\w\+\((\)\@=/  endif -hi def link     goMethod						Type +hi def link     goMethod            Type  " Structs;  if g:go_highlight_structs != 0 -	syn match goStruct								/\(.\)\@<=\w\+\({\)\@=/ -	syn match goStructDef							/\(type\s\+\)\@<=\w\+\(\s\+struct\s\+{\)\@=/ +  syn match goStruct                /\(.\)\@<=\w\+\({\)\@=/ +  syn match goStructDef             /\(type\s\+\)\@<=\w\+\(\s\+struct\s\+{\)\@=/  endif -hi def link     goStruct						Function +hi def link     goStruct            Function  hi def link     goStructDef         Function  " Build Constraints  if g:go_highlight_build_constraints != 0 -    syn keyword goBuildOs           contained ignore cgo android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows -    syn keyword goBuildArch         contained 386 amd64 amd64p32 arm -    syn match   goBuildDirective    display contained "+build" -    syn region  goBuildComment      start="//\s*+build" end="$" contains=goBuildDirective,goBuildOs,goBuildArch -    syn region  goBuildComment      start="/\*\s*+build" end="\*/" contains=goBuildDirective,goBuildOs,goBuildArch +    syn match   goBuildKeyword      display contained "+build" +    " Highlight the known values of GOOS, GOARCH, and other +build options. +    syn keyword goBuildDirectives   contained +      \ android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 +      \ solaris windows 386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 +      \ ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc +      \ s390 s390x sparc sparc64 cgo ignore race + +    " Other words in the build directive are build tags not listed above, so +    " avoid highlighting them as comments by using a matchgroup just for the +    " start of the comment. +    " The rs=s+2 option lets the \s*+build portion be part of the inner region +    " instead of the matchgroup so it will be highlighted as a goBuildKeyword. +    syn region  goBuildComment      matchgroup=goBuildCommentStart +      \ start="//\s*+build\s"rs=s+2 end="$" +      \ contains=goBuildKeyword,goBuildDirectives +    hi def link goBuildCommentStart Comment +    hi def link goBuildDirectives   Type +    hi def link goBuildKeyword      PreProc + +    " One or more line comments that are followed immediately by a "package" +    " declaration are treated like package documentation, so these must be +    " matched as comments to avoid looking like working build constraints. +    " The he, me, and re options let the "package" itself be highlighted by +    " the usual rules. +    syn region  goPackageComment    start=/\v(\/\/.*\n)+\s*package/ +      \ end=/\v\n\s*package/he=e-7,me=e-7,re=e-7 +      \ contains=@goCommentGroup,@Spell +    hi def link goPackageComment    Comment  endif -hi def link     goBuildComment      Comment -hi def link     goBuildOs           Type -hi def link     goBuildArch         Type -hi def link     goBuildDirective    PreProc -  " Search backwards for a global declaration to start processing the syntax.  "syn sync match goSync grouphere NONE /^\(const\|var\|type\|func\)\>/ diff --git a/syntax/gotexttmpl.vim b/syntax/gotexttmpl.vim index 77b26e4e..14b8bf83 100644 --- a/syntax/gotexttmpl.vim +++ b/syntax/gotexttmpl.vim @@ -39,7 +39,7 @@ hi def link     goRawString         String  " Characters; their contents  syn cluster     goCharacterGroup    contains=goEscapeOctal,goEscapeC,goEscapeX,goEscapeU,goEscapeBigU -syn region      goCharacter         start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup +syn region      goCharacter         contained start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=@goCharacterGroup  hi def link     goCharacter         Character @@ -67,7 +67,7 @@ hi def link     goImaginary  Number  syn cluster     gotplLiteral     contains=goString,goRawString,goCharacter,@goInt,goFloat,goImaginary  syn keyword     gotplControl     contained   if else end range with template  syn keyword     gotplFunctions   contained   and html index js len not or print printf println urlquery eq ne lt le gt ge -syn match       gotplVariable    contained   /\$[^ ]*\>/ +syn match       gotplVariable    contained   /\$[a-zA-Z0-9_]*\>/  syn match       goTplIdentifier  contained   /\.[^\s}]*\>/  hi def link     gotplControl        Keyword diff --git a/syntax/jade.vim b/syntax/jade.vim index c14ee69a..27f2da85 100644 --- a/syntax/jade.vim +++ b/syntax/jade.vim @@ -18,6 +18,8 @@ silent! syntax include @htmlCoffeescript syntax/coffee.vim  unlet! b:current_syntax  silent! syntax include @htmlStylus syntax/stylus.vim  unlet! b:current_syntax +silent! syntax include @htmlCss syntax/css.vim +unlet! b:current_syntax  silent! syntax include @htmlMarkdown syntax/markdown.vim  unlet! b:current_syntax @@ -37,7 +39,7 @@ syn region  jadeCommentBlock start="\z(\s*\)\/\/.*$" end="^\%(\z1\s\|\s*$\)\@!"  syn region  jadeHtmlConditionalComment start="<!--\%(.*\)>" end="<!\%(.*\)-->"  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   jadeBlockExpansionChar ":\s\+" contained nextgroup=jadeTag,jadeClassChar,jadeIdChar  syn match   jadeIdChar "#[[{]\@!" contained nextgroup=jadeId  syn match   jadeClass "\%(\w\|-\)\+" contained nextgroup=@jadeComponent  syn match   jadeId "\%(\w\|-\)\+" contained nextgroup=@jadeComponent @@ -69,7 +71,7 @@ syn keyword  jadeScriptLoopKeywords for in contained  syn region  jadeJavascript start="^\z(\s*\)script\%(:\w\+\)\=" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlJavascript,jadeJavascriptTag,jadeCoffeescriptFilter keepend  -syn region  jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffeescript\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained +syn region  jadeCoffeescriptFilter matchgroup=jadeFilter start="^\z(\s*\):coffee-\?script\s*$" end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCoffeescript contained  syn region  jadeJavascriptTag contained start="^\z(\s*\)script\%(:\w\+\)\=" end="$" contains=jadeBegin,jadeTag  syn region  jadeCssBlock        start="^\z(\s*\)style" nextgroup=@jadeComponent,jadeError  end="^\%(\z1\s\|\s*$\)\@!" contains=@htmlCss keepend diff --git a/syntax/perl.vim b/syntax/perl.vim index e272d978..6e6e6efe 100644 --- a/syntax/perl.vim +++ b/syntax/perl.vim @@ -424,7 +424,7 @@ if exists("perl_fold")    endif    if exists("perl_fold_blocks") -    syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)foreach\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend +    syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)for\%(each\)\=\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend      syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend    endif diff --git a/syntax/php.vim b/syntax/php.vim index 42724028..ba396037 100644 --- a/syntax/php.vim +++ b/syntax/php.vim @@ -521,7 +521,7 @@ syn keyword phpStatement __construct __destruct __call __callStatic __get __set  syn keyword phpKeyword die exit eval empty isset unset list instanceof insteadof contained  " Include & friends -syn keyword phpInclude include include_once require require_once namespace use contained +syn keyword phpInclude include include_once require require_once namespace contained  " Types  syn keyword phpType bool[ean] int[eger] real double float string array object null self parent global this stdClass callable contained @@ -681,6 +681,16 @@ syntax match phpClassImplements contained  syntax match phpClassDelimiter contained        \ nextgroup=phpClassImplements skipwhite skipempty /,/ +" use statement +syn keyword phpInclude use contained +      \ nextgroup=phpUseFunction,phpUseClass skipwhite skipempty +syn match phpUseFunction /function\_s\+\(\\\|\h\w*\)*\h\w*/ contained contains=phpUseKeyword +      \ nextgroup=phpUseAlias skipwhite skipempty +syn match phpUseClass /\(function\_s\+\)\@!\(\\\|\h\w*\)*\h\w*/ contained +      \ nextgroup=phpUseAlias skipwhite skipempty +syn match phpUseAlias /as\_s\+\h\w*/ contained contains=phpUseKeyword +syn match phpUseKeyword /\(function\|as\)\_s\+/ contained contains=phpKeyword +  " Function name  syn keyword phpKeyword function contained        \ nextgroup=phpFunction skipwhite skipempty diff --git a/syntax/python.vim b/syntax/python.vim index 09912922..b55dc658 100644 --- a/syntax/python.vim +++ b/syntax/python.vim @@ -88,6 +88,7 @@ syn keyword pythonStatement	exec return  syn keyword pythonStatement	pass raise  syn keyword pythonStatement	global assert  syn keyword pythonStatement	lambda yield +syn keyword pythonStatement	async await  syn keyword pythonStatement	with nonlocal True False None  syn keyword pythonStatement	def class nextgroup=pythonFunction skipwhite  syn match   pythonFunction	"[a-zA-Z_][a-zA-Z0-9_]*" display contained @@ -210,7 +211,7 @@ if exists("python_highlight_builtins") && python_highlight_builtins != 0    syn keyword pythonBuiltinObj	Ellipsis NotImplemented    syn keyword pythonBuiltinFunc	__import__ abs all any apply -  syn keyword pythonBuiltinFunc	basestring bool buffer callable +  syn keyword pythonBuiltinFunc	basestring bool buffer bytearray bytes callable    syn keyword pythonBuiltinFunc	chr classmethod cmp coerce compile complex    syn keyword pythonBuiltinFunc	delattr dict dir divmod enumerate eval    syn keyword pythonBuiltinFunc	execfile file filter float frozenset getattr diff --git a/syntax/ruby.vim b/syntax/ruby.vim index 79d2e1b5..43dd3d36 100644 --- a/syntax/ruby.vim +++ b/syntax/ruby.vim @@ -32,7 +32,7 @@ endif  " Operators  if exists("ruby_operators") -  syn match  rubyOperator "[~!^&|*/%+-]\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::" +  syn match  rubyOperator "[~!^|*/%+-]\|&\.\@!\|\%(class\s*\)\@<!<<\|<=>\|<=\|\%(<\|\<class\s\+\u\w*\s*\)\@<!<[^<]\@=\|===\|==\|=\~\|>>\|>=\|=\@<!>\|\*\*\|\.\.\.\|\.\.\|::"    syn match  rubyOperator "->\|-=\|/=\|\*\*=\|\*=\|&&=\|&=\|&&\|||=\||=\|||\|%=\|+=\|!\~\|!="    syn region rubyBracketOperator matchgroup=rubyOperator start="\%(\w[?!]\=\|[]})]\)\@<=\[\s*" end="\s*]" contains=ALLBUT,@rubyNotTop  endif @@ -82,13 +82,13 @@ syn cluster rubyExtendedStringSpecial contains=@rubyStringSpecial,rubyNestedPare  syn cluster rubyRegexpSpecial	      contains=rubyInterpolation,rubyNoInterpolation,rubyStringEscape,rubyRegexpSpecial,rubyRegexpEscape,rubyRegexpBrackets,rubyRegexpCharClass,rubyRegexpDot,rubyRegexpQuantifier,rubyRegexpAnchor,rubyRegexpParens,rubyRegexpComment  " Numbers and ASCII Codes -syn match rubyASCIICode	"\%(\w\|[]})\"'/\.]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)" -syn match rubyInteger	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*\>"								display -syn match rubyInteger	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)\>"						display -syn match rubyInteger	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*\>"								display -syn match rubyInteger	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*\>"								display -syn match rubyFloat	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*\>"					display -syn match rubyFloat	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>"	display +syn match rubyASCIICode "\%(\w\|[]})\"'/]\)\@<!\%(?\%(\\M-\\C-\|\\C-\\M-\|\\M-\\c\|\\c\\M-\|\\c\|\\C-\|\\M-\)\=\%(\\\o\{1,3}\|\\x\x\{1,2}\|\\\=\S\)\)" +syn match rubyInteger	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[xX]\x\+\%(_\x\+\)*r\=i\=\>"								display +syn match rubyInteger	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0[dD]\)\=\%(0\|[1-9]\d*\%(_\d\+\)*\)r\=i\=\>"						display +syn match rubyInteger	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[oO]\=\o\+\%(_\o\+\)*r\=i\=\>"								display +syn match rubyInteger	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<0[bB][01]\+\%(_[01]\+\)*r\=i\=\>"								display +syn match rubyFloat	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\.\d\+\%(_\d\+\)*r\=i\=\>"					display +syn match rubyFloat	"\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)*\)\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)r\=i\=\>"	display  " Identifiers  syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent @@ -98,7 +98,7 @@ syn match  rubyConstant		"\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>  syn match  rubyClassVariable	"@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display  syn match  rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"  display  syn match  rubyGlobalVariable	"$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)" -syn match  rubySymbol		"[]})\"':]\@<!:\%(\^\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" +syn match  rubySymbol		"[]})\"':]\@<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)"  syn match  rubySymbol		"[]})\"':]\@<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)"  syn match  rubySymbol		"[]})\"':]\@<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*"  syn match  rubySymbol		"[]})\"':]\@<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" @@ -125,11 +125,12 @@ syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|o  syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold  " Generalized Regular Expression -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{"				 end="}[iomxneus]*"   skip="\\\\\|\\}"	 contains=@rubyRegexpSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<"				 end=">[iomxneus]*"   skip="\\\\\|\\>"	 contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\["				 end="\][iomxneus]*"  skip="\\\\\|\\\]"	 contains=@rubyRegexpSpecial fold -syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r("				 end=")[iomxneus]*"   skip="\\\\\|\\)"	 contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r{"				end="}[iomxneus]*"   skip="\\\\\|\\}"	 contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r<"				end=">[iomxneus]*"   skip="\\\\\|\\>"	 contains=@rubyRegexpSpecial,rubyNestedAngleBrackets,rubyDelimEscape fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\["				end="\][iomxneus]*"  skip="\\\\\|\\\]"	 contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r("				end=")[iomxneus]*"   skip="\\\\\|\\)"	 contains=@rubyRegexpSpecial fold +syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="%r\z(\s\)"				end="\z1[iomxneus]*" skip="\\\\\|\\\z1" contains=@rubyRegexpSpecial fold  " Normal String  let s:spell_cluster = exists('ruby_spellcheck_strings') ? ',@Spell' : '' @@ -145,12 +146,13 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]{"				   end="}  syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]<"				   end=">"   skip="\\\\\|\\>"	fold contains=rubyNestedAngleBrackets,rubyDelimEscape  syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]\["				   end="\]"  skip="\\\\\|\\\]"	fold contains=rubyNestedSquareBrackets,rubyDelimEscape  syn region rubyString matchgroup=rubyStringDelimiter start="%[qw]("				   end=")"   skip="\\\\\|\\)"	fold contains=rubyNestedParentheses,rubyDelimEscape -syn region rubyString matchgroup=rubyStringDelimiter start="%q "				   end=" "   skip="\\\\\|\\)"	fold -syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.? /]\)"   end="\z1" skip="\\\\\|\\\z1" fold +syn region rubyString matchgroup=rubyStringDelimiter start="%q\z(\s\)"				   end="\z1" skip="\\\\\|\\\z1" fold +syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)"    end="\z1" skip="\\\\\|\\\z1" fold  syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s{"				   end="}"   skip="\\\\\|\\}"	fold contains=rubyNestedCurlyBraces,rubyDelimEscape  syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s<"				   end=">"   skip="\\\\\|\\>"	fold contains=rubyNestedAngleBrackets,rubyDelimEscape  syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s\["				   end="\]"  skip="\\\\\|\\\]"	fold contains=rubyNestedSquareBrackets,rubyDelimEscape  syn region rubySymbol matchgroup=rubySymbolDelimiter start="%s("				   end=")"   skip="\\\\\|\\)"	fold contains=rubyNestedParentheses,rubyDelimEscape +syn region rubyString matchgroup=rubyStringDelimiter start="%s\z(\s\)"				   end="\z1" skip="\\\\\|\\\z1" fold  " Generalized Double Quoted String and Array of Strings and Shell Command Output  " Note: %= is not matched here as the beginning of a double quoted string @@ -160,7 +162,7 @@ syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\={"				    en  syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=<"				    end=">"   skip="\\\\\|\\>"	 contains=@rubyStringSpecial,rubyNestedAngleBrackets,rubyDelimEscape  fold  syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=\["				    end="\]"  skip="\\\\\|\\\]"	 contains=@rubyStringSpecial,rubyNestedSquareBrackets,rubyDelimEscape fold  syn region rubyString matchgroup=rubyStringDelimiter start="%[QWx]\=("				    end=")"   skip="\\\\\|\\)"	 contains=@rubyStringSpecial,rubyNestedParentheses,rubyDelimEscape    fold -syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx] "				    end=" "   skip="\\\\\|\\)"   contains=@rubyStringSpecial fold +syn region rubyString matchgroup=rubyStringDelimiter start="%[Qx]\z(\s\)"			    end="\z1" skip="\\\\\|\\\z1" contains=@rubyStringSpecial fold  " Array of Symbols  syn region rubySymbol matchgroup=rubySymbolDelimiter start="%i\z([~`!@#$%^&*_\-+=|\:;"',.?/]\)" end="\z1" skip="\\\\\|\\\z1" fold @@ -203,7 +205,7 @@ syn match  rubyClassDeclaration    "[^[:space:];#<]\+"	 contained contains=rubyC  syn match  rubyModuleDeclaration   "[^[:space:];#<]\+"	 contained contains=rubyConstant,rubyOperator  syn match  rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration  syn match  rubyFunction "\%(\s\|^\)\@<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 -syn match  rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[+-]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration +syn match  rubyFunction "\%([[:space:].]\|^\)\@<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration  syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter @@ -287,7 +289,7 @@ syn match   rubySharpBang "\%^#!.*" display  syn keyword rubyTodo	  FIXME NOTE TODO OPTIMIZE HACK REVIEW XXX todo contained  syn match   rubyComment   "#.*" contains=rubySharpBang,rubySpaceError,rubyTodo,@Spell  if !exists("ruby_no_comment_fold") -  syn region rubyMultilineComment start="\%(\%(^\s*#.*\n\)\@<!\%(^\s*#.*\n\)\)\%(\(^\s*#.*\n\)\{1,}\)\@=" end="\%(^\s*#.*\n\)\@<=\%(^\s*#.*\n\)\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend +  syn region rubyMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=rubyComment transparent fold keepend    syn region rubyDocumentation	  start="^=begin\ze\%(\s.*\)\=$" end="^=end\%(\s.*\)\=$" contains=rubySpaceError,rubyTodo,@Spell fold  else    syn region rubyDocumentation	  start="^=begin\s*$" end="^=end\s*$" contains=rubySpaceError,rubyTodo,@Spell diff --git a/syntax/rust.vim b/syntax/rust.vim index 47cb0154..b01c0465 100644 --- a/syntax/rust.vim +++ b/syntax/rust.vim @@ -5,7 +5,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1  " Maintainer:   Patrick Walton <pcwalton@mozilla.com>  " Maintainer:   Ben Blum <bblum@cs.cmu.edu>  " Maintainer:   Chris Morgan <me@chrismorgan.info> -" Last Change:  January 5, 2015 +" Last Change:  January 29, 2015  if version < 600    syntax clear @@ -26,9 +26,9 @@ syn keyword   rustKeyword     continue  syn keyword   rustKeyword     extern nextgroup=rustExternCrate,rustObsoleteExternMod skipwhite skipempty  syn keyword   rustKeyword     fn nextgroup=rustFuncName skipwhite skipempty  syn keyword   rustKeyword     for in if impl let -syn keyword   rustKeyword     loop once pub +syn keyword   rustKeyword     loop pub  syn keyword   rustKeyword     return super -syn keyword   rustKeyword     unsafe virtual where while +syn keyword   rustKeyword     unsafe where while  syn keyword   rustKeyword     use nextgroup=rustModPath 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 @@ -45,7 +45,6 @@ syn match     rustIdentifier  contains=rustIdentifierPrime "\%([^[:cntrl:][:spac  syn match     rustFuncName    "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained  syn region    rustBoxPlacement matchgroup=rustBoxPlacementParens start="(" end=")" contains=TOP contained -syn keyword   rustBoxPlacementExpr GC containedin=rustBoxPlacement  " Ideally we'd have syntax rules set up to match arbitrary expressions. Since  " we don't, we'll just define temporary contained rules to handle balancing  " delimiters. @@ -58,13 +57,13 @@ 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 abstract final override macro +syn keyword   rustReservedKeyword alignof become do offsetof priv pure sizeof typeof unsized yield abstract virtual final override macro  " Built-in types {{{2 -syn keyword   rustType        isize usize float char bool u8 u16 u32 u64 f32 +syn keyword   rustType        isize usize char bool u8 u16 u32 u64 f32  syn keyword   rustType        f64 i8 i16 i32 i64 str Self -" Things from the prelude (src/libstd/prelude.rs) {{{2 +" Things from the libstd v1 prelude (src/libstd/prelude/v1.rs) {{{2  " This section is just straight transformation of the contents of the prelude,  " to make it easy to update. @@ -73,30 +72,27 @@ syn keyword   rustTrait       Copy Send Sized Sync  syn keyword   rustTrait       Drop Fn FnMut FnOnce  " Reexported functions {{{3 -syn keyword rustFunction drop +" There’s no point in highlighting these; when one writes drop( or drop::< it +" gets the same highlighting anyway, and if someone writes `let drop = …;` we +" don’t really want *that* drop to be highlighted. +"syn keyword rustFunction drop  " Reexported types and traits {{{3  syn keyword rustTrait Box -syn keyword rustTrait CharExt +syn keyword rustTrait ToOwned  syn keyword rustTrait Clone  syn keyword rustTrait PartialEq PartialOrd Eq Ord -syn keyword rustTrait DoubleEndedIterator -syn keyword rustTrait ExactSizeIterator -syn keyword rustTrait Iterator IteratorExt Extend +syn keyword rustTrait AsRef AsMut Into From +syn keyword rustTrait Default +syn keyword rustTrait Iterator Extend IntoIterator +syn keyword rustTrait DoubleEndedIterator ExactSizeIterator  syn keyword rustEnum Option  syn keyword rustEnumVariant Some None -syn keyword rustTrait PtrExt MutPtrExt  syn keyword rustEnum Result  syn keyword rustEnumVariant Ok Err -syn keyword rustTrait AsSlice -syn keyword rustTrait SliceExt SliceConcatExt -syn keyword rustTrait Str StrExt +syn keyword rustTrait SliceConcatExt  syn keyword rustTrait String ToString  syn keyword rustTrait Vec -" FIXME: remove when path reform lands -syn keyword rustTrait Path GenericPath -" FIXME: remove when I/O reform lands -syn keyword rustTrait Buffer Writer Reader Seek BufferPrelude  " Other syntax {{{2  syn keyword   rustSelf        self @@ -122,6 +118,9 @@ syn match     rustSigil        display /[&~@*][^)= \t\r\n]/he=e-1,me=e-1  " This isn't actually correct; a closure with no arguments can be `|| { }`.  " Last, because the & in && isn't a sigil  syn match     rustOperator     display "&&\|||" +" This is rustArrowCharacter rather than rustArrow for the sake of matchparen, +" so it skips the ->; see http://stackoverflow.com/a/30309949 for details. +syn match     rustArrowCharacter display "->"  syn match     rustMacro       '\w\(\w\)*!' contains=rustAssert,rustPanic  syn match     rustMacro       '#\w\(\w\)*' contains=rustAssert,rustPanic @@ -136,13 +135,16 @@ syn region    rustString      start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustEs  syn region    rustString      start='b\?r\z(#*\)"' end='"\z1' contains=@Spell  syn region    rustAttribute   start="#!\?\[" end="\]" contains=rustString,rustDerive -syn region    rustDerive      start="derive(" end=")" contained contains=rustTrait +syn region    rustDerive      start="derive(" end=")" contained contains=rustDeriveTrait +" This list comes from src/libsyntax/ext/deriving/mod.rs +" Some are deprecated (Encodable, Decodable) or to be removed after a new snapshot (Show). +syn keyword   rustDeriveTrait contained Clone Hash RustcEncodable RustcDecodable Encodable Decodable PartialEq Eq PartialOrd Ord Rand Show Debug Default FromPrimitive Send Sync Copy  " Number literals -syn match     rustDecNumber   display "\<[0-9][0-9_]*\%([iu]\%(s\|8\|16\|32\|64\)\)\=" -syn match     rustHexNumber   display "\<0x[a-fA-F0-9_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\=" -syn match     rustOctNumber   display "\<0o[0-7_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\=" -syn match     rustBinNumber   display "\<0b[01_]\+\%([iu]\%(s\|8\|16\|32\|64\)\)\=" +syn match     rustDecNumber   display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\)\)\=" +syn match     rustHexNumber   display "\<0x[a-fA-F0-9_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\=" +syn match     rustOctNumber   display "\<0o[0-7_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\=" +syn match     rustBinNumber   display "\<0b[01_]\+\%([iu]\%(size\|8\|16\|32\|64\)\)\="  " Special case for numbers of the form "1." which are float literals, unless followed by  " an identifier, which makes them integer literals with a method call or field access, @@ -168,6 +170,7 @@ syn match   rustCharacterInvalidUnicode   display contained /b'\zs[^[:cntrl:][:g  syn match   rustCharacter   /b'\([^\\]\|\\\(.\|x\x\{2}\)\)'/ contains=rustEscape,rustEscapeError,rustCharacterInvalid,rustCharacterInvalidUnicode  syn match   rustCharacter   /'\([^\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\|u{\x\{1,6}}\)\)'/ contains=rustEscape,rustEscapeUnicode,rustEscapeError,rustCharacterInvalid +syn match rustShebang /\%^#![^[].*/  syn region rustCommentLine                                        start="//"                      end="$"   contains=rustTodo,@Spell  syn region rustCommentLineDoc                                     start="//\%(//\@!\|!\)"         end="$"   contains=rustTodo,@Spell  syn region rustCommentBlock    matchgroup=rustCommentBlock        start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,rustCommentBlockNest,@Spell @@ -200,6 +203,7 @@ hi def link rustOctNumber       rustNumber  hi def link rustBinNumber       rustNumber  hi def link rustIdentifierPrime rustIdentifier  hi def link rustTrait           rustType +hi def link rustDeriveTrait     rustTrait  hi def link rustMacroRepeatCount   rustMacroRepeatDelimiters  hi def link rustMacroRepeatDelimiters   Macro @@ -220,6 +224,7 @@ hi def link rustEnumVariant   rustConstant  hi def link rustConstant      Constant  hi def link rustSelf          Constant  hi def link rustFloat         Float +hi def link rustArrowCharacter rustOperator  hi def link rustOperator      Operator  hi def link rustKeyword       Keyword  hi def link rustReservedKeyword Error @@ -231,6 +236,7 @@ hi def link rustModPathSep    Delimiter  hi def link rustFunction      Function  hi def link rustFuncName      Function  hi def link rustFuncCall      Function +hi def link rustShebang       Comment  hi def link rustCommentLine   Comment  hi def link rustCommentLineDoc SpecialComment  hi def link rustCommentBlock  rustCommentLine @@ -249,7 +255,6 @@ hi def link rustInvalidBareKeyword Error  hi def link rustExternCrate   rustKeyword  hi def link rustObsoleteExternMod Error  hi def link rustBoxPlacementParens Delimiter -hi def link rustBoxPlacementExpr rustKeyword  " Other Suggestions:  " hi rustAttribute ctermfg=cyan diff --git a/syntax/swift.vim b/syntax/swift.vim index cbe46d35..4f5230ae 100644 --- a/syntax/swift.vim +++ b/syntax/swift.vim @@ -1,68 +1,229 @@  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'swift') == -1 -" Language:    Swift<https://developer.apple.com/swift/> -" Maintainer:  toyama satoshi <toyamarinyon@gmail.com> -" URL:         http://github.com/toyamarinyon/vim-swift -" License:     GPL +" File: swift.vim +" Author: Keith Smiley +" Description: Runtime files for Swift +" Last Modified: June 15, 2014 -" Bail if our syntax is already loaded. -if exists('b:current_syntax') && b:current_syntax == 'swift' +if exists("b:current_syntax")    finish  endif -" {{{ Whitespace and Comments -syntax region swiftComment start=#\/\*# end=#\*\/# -syntax match swiftComment /\/\/.*/ -highlight default link swiftComment Comment -" }}} +" Comments +" Shebang +syntax match swiftShebang "\v#!.*$" -" {{{ Identifiers -syntax match swiftIdentifier /[[:alpha:]_][[:alnum:]_]*/ -highlight default link swiftIdentifier Identifier -" }}} +" Comment contained keywords +syntax keyword swiftTodos contained TODO XXX FIXME NOTE +syntax keyword swiftMarker contained MARK +syntax match swiftDocString "\v^\s*-\s*parameter"hs=s+1 contained +syntax match swiftDocString "\v^\s*-\s*returns"hs=s+1 contained -" {{{ Keywords -" Keywords used in declarations: -syntax keyword swiftDeclarationKeywords class deinit enum extension func import init let protocol static struct subscript typealias var -highlight default link swiftDeclarationKeywords Keyword -" Keywords used in statements: -syntax keyword swiftStatementKeywords break case continue default do else fallthrough if in for return switch where while -highlight default link swiftStatementKeywords Keyword -" Keywords used in expressions and types: -syntax keyword swiftExpressionTypeKeywords as dynamicType is new super self Self Type __COLUMN__ __FILE__ __FUNCTION__ __LINE__ -highlight default link swiftExpressionTypeKeywords Keyword -" Keywords reserved in particular contexts: -syntax keyword swiftReserveKeywords associativity didSet get infix inout left mutating none nonmutating operator override postfix precedence prefix right set unowned unowned(safe) unowned(unsafe) weak willSet -highlight default link swiftReserveKeywords Keyword -" }}} +" Literals +" Strings +syntax region swiftString start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=swiftInterpolatedWrapper +syntax region swiftInterpolatedWrapper start="\v[^\\]\\\(\s*" end="\v\s*\)" contained containedin=swiftString contains=swiftInterpolatedString +syntax match swiftInterpolatedString "\v\w+(\(\))?" contained containedin=swiftInterpolatedWrapper -" {{{ Literals -" Integer literal -syntax match swiftIntegerLiteral /\<\d\+\%(_\d\+\)*\%(\.\d\+\%(_\d\+\)*\)\=\>/ -syntax match swiftIntegerLiteral /\<\d\+\%(_\d\+\)*\%(\.\d\+\%(_\d\+\)*\)\=\%([eE][-+]\=\d\+\%(_\d\+\)*\)\>/ -syntax match swiftIntegerLiteral /\<0x\x\+\%(_\x\+\)*\>/ -syntax match swiftIntegerLiteral /\<0o\o\+\%(_\o\+\)*\>/ -syntax match swiftIntegerLiteral /\<0b[01]\+\%(_[01]\+\)*\>/ -highlight default link swiftIntegerLiteral Number -" String literal -syntax region swiftStringLiteral start=/"/ skip=/\\"/ end=/"/ -highlight default link swiftStringLiteral String -" }}} +" Numbers +syntax match swiftNumber "\v<\d+>" +syntax match swiftNumber "\v<(\d+_+)+\d+(\.\d+(_+\d+)*)?>" +syntax match swiftNumber "\v<\d+\.\d+>" +syntax match swiftNumber "\v<\d*\.?\d+([Ee]-?)?\d+>" +syntax match swiftNumber "\v<0x\x+([Pp]-?)?\x+>" +syntax match swiftNumber "\v<0b[01]+>" +syntax match swiftNumber "\v<0o\o+>" -" {{{ Operators -syntax keyword swiftOperatorKeywords / = - + ! * % < > & \| ^ ~ . -highlight default link swiftOperatorKeywords Operator -" }}} +" BOOLs +syntax keyword swiftBoolean +      \ true +      \ false + + +" Operators +syntax match swiftOperator "\v\~" +syntax match swiftOperator "\v\s+!" +syntax match swiftOperator "\v\%" +syntax match swiftOperator "\v\^" +syntax match swiftOperator "\v\&" +syntax match swiftOperator "\v\*" +syntax match swiftOperator "\v-" +syntax match swiftOperator "\v\+" +syntax match swiftOperator "\v\=" +syntax match swiftOperator "\v\|" +syntax match swiftOperator "\v\/" +syntax match swiftOperator "\v\." +syntax match swiftOperator "\v\<" +syntax match swiftOperator "\v\>" +syntax match swiftOperator "\v\?\?" -" {{{ Type -syntax match swiftTypeIdentifier /\<[[:alpha:]_][[:alnum:]_.]*/ contained -syntax match swiftType /: .*/ contains=swiftTypeIdentifier -highlight default link swiftType Operator -highlight default link swiftTypeIdentifier Type +" Methods/Functions +syntax match swiftMethod "\(\.\)\@<=\w\+\((\)\@=" + +" Swift closure arguments +syntax match swiftClosureArgument "\$\d\+\(\.\d\+\)\?" + +syntax match swiftAvailability "\v((\*(\s*,\s*[a-zA-Z="0-9.]+)*)|(\w+\s+\d+(\.\d+(.\d+)?)?\s*,\s*)+\*)" contains=swiftString +syntax keyword swiftPlatforms OSX iOS watchOS OSXApplicationExtension iOSApplicationExtension contained containedin=swiftAvailability +syntax keyword swiftAvailabilityArg renamed unavailable introduced deprecated obsoleted message contained containedin=swiftAvailability + +" Keywords {{{ +syntax keyword swiftKeywords +      \ as +      \ atexit +      \ break +      \ case +      \ catch +      \ class +      \ continue +      \ convenience +      \ default +      \ defer +      \ deinit +      \ didSet +      \ do +      \ dynamic +      \ else +      \ extension +      \ fallthrough +      \ final +      \ for +      \ func +      \ get +      \ guard +      \ if +      \ import +      \ in +      \ indirect +      \ infix +      \ init +      \ inout +      \ internal +      \ is +      \ lazy +      \ let +      \ mutating +      \ nil +      \ nonmutating +      \ operator +      \ optional +      \ override +      \ postfix +      \ prefix +      \ private +      \ protocol +      \ public +      \ repeat +      \ required +      \ rethrows +      \ return +      \ self +      \ set +      \ static +      \ subscript +      \ super +      \ switch +      \ throw +      \ throws +      \ try +      \ typealias +      \ unowned +      \ var +      \ weak +      \ where +      \ while +      \ willSet  " }}} -if !exists('b:current_syntax') -  let b:current_syntax = 'swift' -endif +" Names surrounded by backticks. This aren't limited to keywords because 1) +" Swift doesn't limit them to keywords and 2) I couldn't make the keywords not +" highlight at the same time +syntax region swiftEscapedReservedWord start="`" end="`" oneline + +syntax keyword swiftAttributes +      \ @assignment +      \ @autoclosure +      \ @available +      \ @convention +      \ @exported +      \ @IBAction +      \ @IBDesignable +      \ @IBInspectable +      \ @IBOutlet +      \ @noescape +      \ @nonobjc +      \ @noreturn +      \ @NSApplicationMain +      \ @NSCopying +      \ @NSManaged +      \ @objc +      \ @testable +      \ @UIApplicationMain +      \ @warn_unused_result + +syntax keyword swiftConditionStatement #available + +syntax keyword swiftStructure +      \ struct +      \ enum + +syntax region swiftTypeWrapper start="\v:\s*" skip="\s*,\s*$*\s*" end="$" contains=swiftString,swiftBoolean,swiftNumber,swiftType,swiftGenericsWrapper transparent +syntax region swiftGenericsWrapper start="\v\<" end="\v\>" contains=swiftType transparent oneline +syntax region swiftLiteralWrapper start="\v\=\s*" skip="\v[^\[\]]\(\)" end="\v(\[\]|\(\))" contains=swiftType,swiftString transparent oneline +syntax region swiftReturnWrapper start="\v-\>\s*" end="\v(\{|$)" contains=swiftType transparent oneline +syntax match swiftType "\v<\u\w*" contained containedin=swiftGenericsWrapper,swiftTypeWrapper,swiftLiteralWrapper,swiftGenericsWrapper + +syntax keyword swiftImports import + + +" 'preprocesor' stuff +syntax keyword swiftPreprocessor +      \ #if +      \ #elseif +      \ #else +      \ #endif + + +" Comment patterns +syntax match swiftComment "\v\/\/.*$" +      \ contains=swiftTodos,swiftDocString,swiftMarker,@Spell oneline +syntax region swiftComment start="/\*" end="\*/" +      \ contains=swiftTodos,swiftDocString,swiftMarker,swiftComment,@Spell fold + + +" Set highlights +highlight default link swiftTodos Todo +highlight default link swiftDocString String +highlight default link swiftShebang Comment +highlight default link swiftComment Comment +highlight default link swiftMarker Comment + +highlight default link swiftString String +highlight default link swiftInterpolatedWrapper Delimiter +highlight default link swiftNumber Number +highlight default link swiftBoolean Boolean + +highlight default link swiftOperator Operator +highlight default link swiftKeywords Keyword +highlight default link swiftEscapedReservedWord Normal +highlight default link swiftClosureArgument Operator +highlight default link swiftAttributes PreProc +highlight default link swiftConditionStatement PreProc +highlight default link swiftStructure Structure +highlight default link swiftType Type +highlight default link swiftImports Include +highlight default link swiftPreprocessor PreProc +highlight default link swiftMethod Function + +highlight default link swiftConditionStatement PreProc +highlight default link swiftAvailability Normal +highlight default link swiftAvailabilityArg Normal +highlight default link swiftPlatforms Keyword + +" Force vim to sync at least x lines. This solves the multiline comment not +" being highlighted issue +syn sync minlines=100 + +let b:current_syntax = "swift"  endif diff --git a/syntax/toml.vim b/syntax/toml.vim index 4ead2034..694a9af6 100644 --- a/syntax/toml.vim +++ b/syntax/toml.vim @@ -2,7 +2,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'toml') == -1  " Language:   TOML  " Maintainer: Caleb Spare <cespare@gmail.com> -" URL:        http://github.com/cespare/vim-toml +" URL:        https://github.com/cespare/vim-toml  " LICENSE:    MIT  if exists("b:current_syntax") @@ -37,7 +37,7 @@ hi def link tomlFloat Float  syn match tomlBoolean /\<\%(true\|false\)\>/ display  hi def link tomlBoolean Boolean -" http://tools.ietf.org/html/rfc3339 +" https://tools.ietf.org/html/rfc3339  syn match tomlDate /\d\{4\}-\d\{2\}-\d\{2\}T\d\{2\}:\d\{2\}:\d\{2\}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2\}:\d\{2\}\)/ display  hi def link tomlDate Constant | 
