diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2013-12-13 01:37:01 +0100 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2013-12-13 01:37:01 +0100 | 
| commit | edd5ee63e66d9ef166034d9ac5bed132f501ecb9 (patch) | |
| tree | fba293d90821eea5e067c7b5eea3526df0f26254 /syntax | |
| parent | 8a255002df1f6d02ef7ca9503be1a7d7234acef8 (diff) | |
| download | vim-polyglot-edd5ee63e66d9ef166034d9ac5bed132f501ecb9.tar.gz vim-polyglot-edd5ee63e66d9ef166034d9ac5bed132f501ecb9.zip | |
Updatev1.4.2
Diffstat (limited to 'syntax')
| -rw-r--r-- | syntax/elixir.vim | 4 | ||||
| -rw-r--r-- | syntax/html.vim | 9 | ||||
| -rw-r--r-- | syntax/less.vim | 2 | ||||
| -rw-r--r-- | syntax/mason.vim | 16 | ||||
| -rw-r--r-- | syntax/perl.vim | 12 | ||||
| -rw-r--r-- | syntax/rust.vim | 91 | ||||
| -rw-r--r-- | syntax/scala.vim | 264 | 
7 files changed, 163 insertions, 235 deletions
| diff --git a/syntax/elixir.vim b/syntax/elixir.vim index 7dc428ef..2e3a0e0e 100644 --- a/syntax/elixir.vim +++ b/syntax/elixir.vim @@ -18,10 +18,10 @@ syn keyword elixirTodo FIXME NOTE TODO OPTIMIZE XXX HACK contained  syn keyword elixirKeyword is_atom is_binary is_bitstring is_boolean is_float is_function is_integer is_list is_number is_pid is_port is_record is_reference is_tuple is_exception  syn keyword elixirKeyword case cond bc lc inlist inbits if unless try receive function  syn keyword elixirKeyword exit raise throw after rescue catch else -syn keyword elixirKeyword use quote unquote super alias +syn keyword elixirKeyword quote unquote super  syn match   elixirKeyword '\<\%(->\)\>\s*' -syn keyword elixirInclude import require +syn keyword elixirInclude import require alias use  syn keyword elixirOperator and not or when xor in  syn match elixirOperator '%=\|\*=\|\*\*=\|+=\|-=\|\^=\|||=' diff --git a/syntax/html.vim b/syntax/html.vim index 1cd86010..b9b4d86f 100644 --- a/syntax/html.vim +++ b/syntax/html.vim @@ -21,7 +21,8 @@  syn keyword htmlTagName contained article aside audio canvas command  syn keyword htmlTagName contained datalist details dialog embed figcaption figure footer  syn keyword htmlTagName contained header hgroup keygen main mark meter menu nav output -syn keyword htmlTagName contained progress ruby rt rp section source summary template time track video data +syn keyword htmlTagName contained progress ruby rt rp section source summary time track video data +syn keyword htmlTagName contained template content shadow  syn keyword htmlTagName contained wbr bdi  " SVG tags @@ -40,10 +41,12 @@ syn keyword htmlTagName contained linearGradient marker mask pattern radialGradi  syn keyword htmlTagName contained missing-glyph mpath   syn keyword htmlTagName contained text textPath tref tspan vkern +syn match htmlTagName contained "\<[a-z_]\+\(\-[a-z_]\+\)\+\>" +  " HTML 5 arguments  " Core Attributes  syn keyword htmlArg contained accesskey class contenteditable contextmenu dir  -syn keyword htmlArg contained draggable hidden id lang spellcheck style tabindex title translate +syn keyword htmlArg contained draggable hidden id is lang spellcheck style tabindex title translate  " Event-handler Attributes  syn keyword htmlArg contained onabort onblur oncanplay oncanplaythrough onchange  syn keyword htmlArg contained onclick oncontextmenu ondblclick ondrag ondragend ondragenter ondragleave ondragover  @@ -69,6 +72,8 @@ syn keyword htmlArg contained required placeholder  syn keyword htmlArg contained label icon open datetime pubdate  " <script>  syn keyword htmlArg contained async +" <content> +syn keyword htmlArg contained select  " Custom Data Attributes  " http://dev.w3.org/html5/spec/elements.html#embedding-custom-non-visible-data diff --git a/syntax/less.vim b/syntax/less.vim index fa5a247e..44bf470e 100644 --- a/syntax/less.vim +++ b/syntax/less.vim @@ -35,7 +35,7 @@ syn match lessClass "[[:alnum:]_-]\+" contained  " string functions  syn keyword lessFunction escape e % containedin=cssDefinition contained  " misc functions -syn keyword lessFunction color unit containedin=cssDefinition contained +syn keyword lessFunction unit containedin=cssDefinition contained  " math functions  syn keyword lessFunction ceil floor percentage round containedin=cssDefinition contained  " color definition diff --git a/syntax/mason.vim b/syntax/mason.vim index c94f8e8e..b4c03ae2 100644 --- a/syntax/mason.vim +++ b/syntax/mason.vim @@ -54,12 +54,13 @@ endif  " them. If you have any suggestions, please let me know.  "  syn region masonPod start="^=[a-z]" end="^=cut" keepend contained contains=@podTop -syn region masonPerlBraces start="{" end="}" contained -syn region masonLine matchgroup=Delimiter start="^%" end="$" keepend contains=@perlTop,masonPerlBraces -syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop +syn cluster perlTop remove=perlBraces +syn region masonLine matchgroup=Delimiter start="^%" end="$" keepend contains=@perlTop +syn region masonPerlComment start="#" end="\%(%>\)\@=\|$" contained contains=perlTodo,@Spell +syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop,masonPerlComment  syn region masonPerl matchgroup=Delimiter start="<%perl>" end="</%perl>" contains=masonPod,@perlTop -syn region masonComp keepend matchgroup=Delimiter start="<&\s*\%(\a\+:\)\?[._/[:alnum:]]*" end="&>" contains=@perlTop -syn region masonComp keepend matchgroup=Delimiter skipnl start="<&|\s*\%(\a\+:\)\?[._/[:alnum:]]*" end="&>" contains=@perlTop nextgroup=masonCompContent +syn region masonComp keepend matchgroup=Delimiter start="<&\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop +syn region masonComp keepend matchgroup=Delimiter skipnl start="<&|\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop nextgroup=masonCompContent  syn region masonCompContent matchgroup=Delimiter start="" end="</&>" contained contains=@masonTop  syn region masonArgs matchgroup=Delimiter start="<%args>" end="</%args>" contains=masonPod,@perlTop @@ -70,8 +71,8 @@ syn region masonOnce matchgroup=Delimiter start="<%once>" end="</%once>" contain  syn region masonClass matchgroup=Delimiter start="<%class>" end="</%class>" contains=masonPod,@perlTop  syn region masonShared matchgroup=Delimiter start="<%shared>" end="</%shared>" contains=masonPod,@perlTop -syn region masonDef matchgroup=Delimiter start="<%def\s*[._/[:alnum:]]\+\s*>" end="</%def>" contains=@htmlTop -syn region masonMethod matchgroup=Delimiter start="<%method\s*[._/[:alnum:]]\+\s*>" end="</%method>" contains=@htmlTop +syn region masonDef matchgroup=Delimiter start="<%def\s*[-._/[:alnum:]]\+\s*>" end="</%def>" contains=@htmlTop +syn region masonMethod matchgroup=Delimiter start="<%method\s*[-._/[:alnum:]]\+\s*>" end="</%method>" contains=@htmlTop  syn region masonFlags matchgroup=Delimiter start="<%flags>" end="</%flags>" contains=masonPod,@perlTop  syn region masonAttr matchgroup=Delimiter start="<%attr>" end="</%attr>" contains=masonPod,@perlTop @@ -96,6 +97,7 @@ if version >= 508 || !exists("did_mason_syn_inits")  	HiLink masonDoc Comment  	HiLink masonPod Comment +	HiLink masonPerlComment perlComment  	delc HiLink  endif diff --git a/syntax/perl.vim b/syntax/perl.vim index fc8f4472..e847da11 100644 --- a/syntax/perl.vim +++ b/syntax/perl.vim @@ -108,7 +108,7 @@ syn match perlStatementMisc		"\<\%(warn\|format\|formline\|reset\|scalar\|protot  syn keyword perlTodo			TODO TODO: TBD TBD: FIXME FIXME: XXX XXX: NOTE NOTE: contained -syn region perlStatementIndirObjWrap   matchgroup=perlStatementIndirObj start="\<\%(map\|grep\|sort\|printf\=\|say\|system\|exec\)\>\s*{" end="}" contains=@perlTop,perlBraces extend +syn region perlStatementIndirObjWrap   matchgroup=perlStatementIndirObj start="\%(\<\%(map\|grep\|sort\|printf\=\|say\|system\|exec\)\>\s*\)\@<={" end="}" transparent extend  syn match perlLabel      "^\s*\h\w*\s*::\@!\%(\<v\d\+\s*:\)\@<!" @@ -125,7 +125,7 @@ syn match perlLabel      "^\s*\h\w*\s*::\@!\%(\<v\d\+\s*:\)\@<!"  " Special variables first ($^A, ...) and ($|, $', ...)  syn match  perlVarPlain		 "$^[ACDEFHILMNOPRSTVWX]\="  syn match  perlVarPlain		 "$[\\\"\[\]'&`+*.,;=%~!?@#$<>(-]" -syn match  perlVarPlain		 "%+" +syn match  perlVarPlain		 "@[-+]"  syn match  perlVarPlain		 "$\%(0\|[1-9]\d*\)"  " Same as above, but avoids confusion in $::foo (equivalent to $main::foo)  syn match  perlVarPlain		 "$::\@!" @@ -152,6 +152,8 @@ else    syn match  perlFunctionName                "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod  endif +syn match  perlVarPlain2	 "%[-+]" +  if !exists("perl_no_extended_vars")    syn cluster perlExpr		contains=perlStatementIndirObjWrap,perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlVarBlock2,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQQ,perlArrow,perlBraces    syn region perlArrow		matchgroup=perlArrow start="->\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained @@ -246,11 +248,9 @@ syn region perlMatch	matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+  syn region perlMatch	matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'[msixpodualgc]*+ contains=@perlInterpSQ keepend extend  syn region perlMatch	matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/[msixpodualgc]*+ contains=@perlInterpSlash keepend extend  syn region perlMatch	matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)[msixpodualgc]*+ contains=@perlInterpMatch,perlParensDQ keepend extend - -" A special case for m{}, m<> and m[] which allows for comments and extra whitespace in the pattern -syn region perlMatch	matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgc]*+ contains=@perlInterpMatch,perlComment,perlBracesDQ extend +syn region perlMatch	matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[msixpodualgc]*+ contains=@perlInterpMatch,perlBracesDQ extend  syn region perlMatch	matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>[msixpodualgc]*+ contains=@perlInterpMatch,perlAnglesDQ keepend extend -syn region perlMatch	matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgc]*+ contains=@perlInterpMatch,perlComment,perlBracketsDQ keepend extend +syn region perlMatch	matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][msixpodualgc]*+ contains=@perlInterpMatch,perlBracketsDQ keepend extend  " Below some hacks to recognise the // variant. This is virtually impossible to catch in all  " cases as the / is used in so many other ways, but these should be the most obvious ones. diff --git a/syntax/rust.vim b/syntax/rust.vim index e5ff089e..9131c4fa 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:  2013 Oct 29 +" Last Change:  2013 Dec 10  if version < 600    syntax clear @@ -19,22 +19,23 @@ syn keyword   rustOperator    as  syn match     rustAssert      "\<assert\(\w\)*!" contained  syn match     rustFail        "\<fail\(\w\)*!" contained  syn keyword   rustKeyword     break continue do extern -syn keyword   rustKeyword     in if impl let log -syn keyword   rustKeyword     for impl let log -syn keyword   rustKeyword     loop mod once priv pub +syn keyword   rustKeyword     for in if impl let +syn keyword   rustKeyword     loop once priv pub  syn keyword   rustKeyword     return  syn keyword   rustKeyword     unsafe while  syn keyword   rustKeyword     use nextgroup=rustModPath skipwhite  " FIXME: Scoped impl's name is also fallen in this category  syn keyword   rustKeyword     mod trait struct enum type nextgroup=rustIdentifier skipwhite  syn keyword   rustKeyword     fn nextgroup=rustFuncName skipwhite -syn keyword   rustStorage     const mut ref static +syn keyword   rustKeyword     proc +syn keyword   rustStorage     mut ref static +syn keyword   rustObsoleteStorage const  syn match     rustIdentifier  contains=rustIdentifierPrime "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained  syn match     rustFuncName    "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained  " Reserved (but not yet used) keywords {{{2 -syn keyword   rustKeyword     alignof be offsetof pure sizeof typeof yield +syn keyword   rustReservedKeyword alignof be offsetof pure sizeof typeof yield  " Built-in types {{{2  syn keyword   rustType        int uint float char bool u8 u16 u32 u64 f32 @@ -89,6 +90,7 @@ syn keyword rustTrait Orderable Signed Unsigned Round  syn keyword rustTrait Primitive Int Float ToStrRadix ToPrimitive FromPrimitive  syn keyword rustTrait GenericPath Path PosixPath WindowsPath  syn keyword rustTrait RawPtr +syn keyword rustTrait Buffer Writer Reader Seek  syn keyword rustTrait SendStr SendStrOwned SendStrStatic IntoSendStr  syn keyword rustTrait Str StrVector StrSlice OwnedStr  syn keyword rustTrait IterBytes @@ -143,38 +145,30 @@ syn match     rustOperator     display "&&\|||"  syn match     rustMacro       '\w\(\w\)*!' contains=rustAssert,rustFail  syn match     rustMacro       '#\w\(\w\)*' contains=rustAssert,rustFail -syn match     rustFormat      display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn?]\|\[\^\=.[^]]*\]\)" contained -syn match     rustFormat      display "%%" contained +syn match     rustSpecialError display contained /\\./  syn match     rustSpecial     display contained /\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/  syn match     rustStringContinuation display contained /\\\n\s*/ -syn region    rustString      start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation +syn region    rustString      start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustSpecial,rustSpecialError,rustStringContinuation  syn region    rustString      start='r\z(#*\)"' end='"\z1'  syn region    rustAttribute   start="#\[" end="\]" contains=rustString,rustDeriving  syn region    rustDeriving    start="deriving(" end=")" contained contains=rustTrait  " Number literals -syn match     rustNumber      display "\<[0-9][0-9_]*\>" -syn match     rustNumber      display "\<[0-9][0-9_]*\(u\|u8\|u16\|u32\|u64\)\>" -syn match     rustNumber      display "\<[0-9][0-9_]*\(i\|i8\|i16\|i32\|i64\)\>" - -syn match     rustHexNumber   display "\<0x[a-fA-F0-9_]\+\>" -syn match     rustHexNumber   display "\<0x[a-fA-F0-9_]\+\(u\|u8\|u16\|u32\|u64\)\>" -syn match     rustHexNumber   display "\<0x[a-fA-F0-9_]\+\(i8\|i16\|i32\|i64\)\>" -syn match     rustOctNumber   display "\<0o[0-7_]\+\>" -syn match     rustOctNumber   display "\<0o[0-7_]\+\(u\|u8\|u16\|u32\|u64\)\>" -syn match     rustOctNumber   display "\<0o[0-7_]\+\(i8\|i16\|i32\|i64\)\>" -syn match     rustBinNumber   display "\<0b[01_]\+\>" -syn match     rustBinNumber   display "\<0b[01_]\+\(u\|u8\|u16\|u32\|u64\)\>" -syn match     rustBinNumber   display "\<0b[01_]\+\(i8\|i16\|i32\|i64\)\>" - -syn match     rustFloat       display "\<[0-9][0-9_]*\(f\|f32\|f64\)\>" -syn match     rustFloat       display "\<[0-9][0-9_]*\([eE][+-]\=[0-9_]\+\)\>" -syn match     rustFloat       display "\<[0-9][0-9_]*\([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>" -syn match     rustFloat       display "\<[0-9][0-9_]*\.[0-9_]\+\>" -syn match     rustFloat       display "\<[0-9][0-9_]*\.[0-9_]\+\(f\|f32\|f64\)\>" -syn match     rustFloat       display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\>" -syn match     rustFloat       display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9_]\+\)\(f\|f32\|f64\)\>" +syn match     rustDecNumber   display "\<[0-9][0-9_]*\%([iu]\%(8\|16\|32\|64\)\=\)\=" +syn match     rustHexNumber   display "\<0x[a-fA-F0-9_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\=" +syn match     rustOctNumber   display "\<0o[0-7_]\+\%([iu]\%(8\|16\|32\|64\)\=\)\=" +syn match     rustBinNumber   display "\<0b[01_]\+\%([iu]\%(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. +" (This must go first so the others take precedence.) +syn match     rustFloat       display "\<[0-9][0-9_]*\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\@!" +" To mark a number as a normal float, it must have at least one of the three things integral values don't have: +" a decimal point and more numbers; an exponent; and a type suffix. +syn match     rustFloat       display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)\=" +syn match     rustFloat       display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\(f32\|f64\)\=" +syn match     rustFloat       display "\<[0-9][0-9_]*\%(\.[0-9][0-9_]*\)\=\%([eE][+-]\=[0-9_]\+\)\=\(f32\|f64\)"  " For the benefit of delimitMate  syn region rustLifetimeCandidate display start=/&'\%(\([^'\\]\|\\\(['nrt0\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'\)\@!/ end=/[[:cntrl:][:space:][:punct:]]\@=\|$/ contains=rustSigil,rustLifetime @@ -183,12 +177,24 @@ 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   /'\([^'\\]\|\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial - -syn region    rustCommentML   start="/\*" end="\*/" contains=rustTodo -syn region    rustComment     start="//" end="$" contains=rustTodo keepend -syn region    rustCommentMLDoc start="/\*\%(!\|\*/\@!\)" end="\*/" contains=rustTodo -syn region    rustCommentDoc  start="//[/!]" end="$" contains=rustTodo keepend +syn match   rustCharacter   /'\([^'\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial,rustSpecialError + +syn cluster rustComment contains=rustCommentLine,rustCommentLineDoc,rustCommentBlock,rustCommentBlockDoc +syn region rustCommentLine                                    start="//"                      end="$"   contains=rustTodo +syn region rustCommentLineDoc                                 start="//\%(//\@!\|!\)"         end="$"   contains=rustTodo +syn region rustCommentBlock    matchgroup=rustCommentBlock    start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment keepend extend +syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)"    end="\*/" contains=rustTodo,@rustComment keepend extend +" FIXME: this is a really ugly and not fully correct implementation. Most +" importantly, a case like ``/* */*`` should have the final ``*`` not being in +" a comment, but in practice at present it leaves comments open two levels +" deep. But as long as you stay away from that particular case, I *believe* +" the highlighting is correct. Due to the way Vim's syntax engine works +" (greedy for start matches, unlike Rust's tokeniser which is searching for +" the earliest-starting match, start or end), I believe this cannot be solved. +" Oh you who would fix it, don't bother with things like duplicating the Block +" rules and putting ``\*\@<!`` at the start of them; it makes it worse, as +" then you must deal with cases like ``/*/**/*/``. And don't try making it +" worse with ``\%(/\@<!\*\)\@<!``, either...  syn keyword rustTodo contained TODO FIXME XXX NB NOTE @@ -200,6 +206,7 @@ syn region rustFoldBraces start="{" end="}" transparent fold  " It's not enabled by default as it would drive some people mad.  " Default highlighting {{{1 +hi def link rustDecNumber       rustNumber  hi def link rustHexNumber       rustNumber  hi def link rustOctNumber       rustNumber  hi def link rustBinNumber       rustNumber @@ -207,8 +214,8 @@ hi def link rustIdentifierPrime rustIdentifier  hi def link rustTrait           rustType  hi def link rustSigil         StorageClass -hi def link rustFormat        Special  hi def link rustSpecial       Special +hi def link rustSpecialError  Error  hi def link rustStringContinuation Special  hi def link rustString        String  hi def link rustCharacter     Character @@ -221,6 +228,7 @@ hi def link rustSelf          Constant  hi def link rustFloat         Float  hi def link rustOperator      Operator  hi def link rustKeyword       Keyword +hi def link rustReservedKeyword Error  hi def link rustConditional   Conditional  hi def link rustIdentifier    Identifier  hi def link rustCapsIdent     rustIdentifier @@ -229,10 +237,10 @@ hi def link rustModPathSep    Delimiter  hi def link rustFunction      Function  hi def link rustFuncName      Function  hi def link rustFuncCall      Function -hi def link rustCommentMLDoc  rustCommentDoc -hi def link rustCommentDoc    SpecialComment -hi def link rustCommentML     rustComment -hi def link rustComment       Comment +hi def link rustCommentLine   Comment +hi def link rustCommentLineDoc SpecialComment +hi def link rustCommentBlock  rustCommentLine +hi def link rustCommentBlockDoc rustCommentLineDoc  hi def link rustAssert        PreCondit  hi def link rustFail          PreCondit  hi def link rustMacro         Macro @@ -241,6 +249,7 @@ hi def link rustTodo          Todo  hi def link rustAttribute     PreProc  hi def link rustDeriving      PreProc  hi def link rustStorage       StorageClass +hi def link rustObsoleteStorage Error  hi def link rustLifetime      Special  " Other Suggestions: diff --git a/syntax/scala.vim b/syntax/scala.vim index a6191148..3c43a894 100644 --- a/syntax/scala.vim +++ b/syntax/scala.vim @@ -1,192 +1,104 @@ -" Vim syntax file -" Language   : Scala (http://scala-lang.org/) -" Maintainers: Stefan Matthias Aust, Julien Wetterwald -" Last Change: 2007 June 13 -  if version < 600    syntax clear  elseif exists("b:current_syntax")    finish  endif -syn case match -syn sync minlines=50 maxlines=100 - -" most Scala keywords -syn keyword scalaKeyword case -syn keyword scalaKeyword catch -syn keyword scalaKeyword do -syn keyword scalaKeyword else -syn keyword scalaKeyword extends -syn keyword scalaKeyword final -syn keyword scalaKeyword finally -syn keyword scalaKeyword for -syn keyword scalaKeyword forSome -syn keyword scalaKeyword if -syn keyword scalaKeyword match -syn keyword scalaKeyword new -syn keyword scalaKeyword null -syn keyword scalaKeyword require -syn keyword scalaKeyword return -syn keyword scalaKeyword super -syn keyword scalaKeyword this -syn keyword scalaKeyword throw -syn keyword scalaKeyword try -syn keyword scalaKeyword type -syn keyword scalaKeyword while -syn keyword scalaKeyword with -syn keyword scalaKeyword yield -syn keyword scalaKeywordModifier abstract -syn keyword scalaKeywordModifier override -syn keyword scalaKeywordModifier final -syn keyword scalaKeywordModifier implicit -syn keyword scalaKeywordModifier lazy -syn keyword scalaKeywordModifier private -syn keyword scalaKeywordModifier protected -syn keyword scalaKeywordModifier sealed -syn match scalaKeyword "=>" -syn match scalaKeyword "<-" -syn match scalaKeyword "\<_\>" - -syn match scalaOperator ":\{2,\}" "this is not a type - -" package and import statements -syn keyword scalaPackage package nextgroup=scalaFqn skipwhite -syn keyword scalaImport import nextgroup=scalaFqn skipwhite -syn match scalaFqn "\<[._$a-zA-Z0-9,]*" contained nextgroup=scalaFqnSet -syn region scalaFqnSet start="{" end="}" contained - -" boolean literals -syn keyword scalaBoolean true false - -" definitions -syn keyword scalaDef def nextgroup=scalaDefName skipwhite -syn keyword scalaVal val nextgroup=scalaValName skipwhite -syn keyword scalaVar var nextgroup=scalaVarName skipwhite -syn keyword scalaClass class nextgroup=scalaClassName skipwhite -syn keyword scalaObject object nextgroup=scalaClassName skipwhite -syn keyword scalaTrait trait nextgroup=scalaClassName skipwhite -syn match scalaDefName "[^ =:;([]\+" contained nextgroup=scalaDefSpecializer skipwhite -syn match scalaValName "[^ =:;([]\+" contained -syn match scalaVarName "[^ =:;([]\+" contained -syn match scalaClassName "[^ =:;(\[]\+" contained nextgroup=scalaClassSpecializer skipwhite -syn region scalaDefSpecializer start="\[" end="\]" contained contains=scalaDefSpecializer -syn region scalaClassSpecializer start="\[" end="\]" contained contains=scalaClassSpecializer -syn match scalaBackTick "`[^`]\+`" - -" type constructor (actually anything with an uppercase letter) -syn match scalaConstructor "\<[A-Z][_$a-zA-Z0-9]*\>" nextgroup=scalaConstructorSpecializer -syn region scalaConstructorSpecializer start="\[" end="\]" contained contains=scalaConstructorSpecializer - -" method call -syn match scalaRoot "\<[a-zA-Z][_$a-zA-Z0-9]*\."me=e-1 -syn match scalaMethodCall "\.[a-z][_$a-zA-Z0-9]*"ms=s+1 - -" type declarations in val/var/def -syn match scalaType ":\s*\%(=>\s*\)\?\%([\._$a-zA-Z0-9]\+\|([^)]\{-1,})\)\%(\[[^\]]\{-1,}\]\+\%([^)]*)\]\+\)\?\)\?\%(\s*\%(<:\|>:\|#\|=>\|⇒\)\s*\%([\._$a-zA-Z0-9]\+\|([^)]\{-1,})\)\%(\[[^\]]\{-1,}\]\+\%([^)]*)\]\+\)\?\)*\)*"ms=s+1 -" type declarations in case statements -syn match scalaCaseType "\(case\s\+[_a-zA-Z0-9]\+\)\@<=:\s*[\._$a-zA-Z0-9]\+\(\[[^:]\{-1,}\]\+\)\?"ms=s+1 - -" comments -syn match scalaTodo "[tT][oO][dD][oO]" contained -syn match scalaLineComment "//.*" contains=scalaTodo -syn region scalaComment start="/\*" end="\*/" contains=scalaTodo -syn case ignore -syn include @scalaHtml syntax/html.vim -syn case match -syn region scalaDocComment start="/\*\*" end="\*/" contains=scalaDocTags,scalaTodo,@scalaHtml keepend -syn region scalaDocTags start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" contained -syn match scalaDocTags "@[a-z]\+" contained - -" annotations -syn match scalaAnnotation "@[a-zA-Z]\+" - -syn match scalaEmptyString "\"\"" +let b:current_syntax = "scala" -" multi-line string literals -syn region scalaMultiLineString start="\"\"\"" end="\"\"\"\"\@!" contains=scalaUnicode -syn match scalaUnicode "\\u[0-9a-fA-F]\{4}" contained +syn case match +syn sync minlines=200 maxlines=1000 + +syn keyword scalaKeyword catch do else final finally for forSome if +syn keyword scalaKeyword match return throw try while yield +syn keyword scalaKeyword class trait object extends with type nextgroup=scalaInstanceDeclaration skipwhite +syn keyword scalaKeyword case nextgroup=scalaCaseFollowing skipwhite +syn keyword scalaKeyword val nextgroup=scalaNameDefinition,scalaQuasiQuotes skipwhite +syn keyword scalaKeyword def var nextgroup=scalaNameDefinition skipwhite +hi link scalaKeyword Keyword -" string literals with escapes -syn region scalaString start="\"[^"]" skip="\\\"" end="\"" contains=scalaStringEscape " TODO end \n or not? -syn match scalaStringEscape "\\u[0-9a-fA-F]\{4}" contained -syn match scalaStringEscape "\\[nrfvb\\\"]" contained +syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained +syn match scalaNameDefinition /`[^`]\+`/ contained +hi link scalaNameDefinition Function -" symbol and character literals -syn match scalaSymbol "'[_a-zA-Z0-9][_a-zA-Z0-9]*\>" -syn match scalaChar "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'" +syn match scalaInstanceDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained +syn match scalaInstanceDeclaration /`[^`]\+`/ contained +hi link scalaInstanceDeclaration Special -" number literals -syn match scalaNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>" -syn match scalaNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\=" -syn match scalaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" -syn match scalaNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" +syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]*\>/ contained +syn match scalaCaseFollowing /`[^`]\+`/ contained +hi link scalaCaseFollowing Special -" xml literals -syn match scalaXmlTag "<[a-zA-Z]\_[^>]*/>" contains=scalaXmlQuote,scalaXmlEscape,scalaXmlString -syn region scalaXmlString start="\"" end="\"" contained -syn match scalaXmlStart "<[a-zA-Z]\_[^>]*>" contained contains=scalaXmlQuote,scalaXmlEscape,scalaXmlString -syn region scalaXml start="<\([a-zA-Z]\_[^>]*\_[^/]\|[a-zA-Z]\)>" matchgroup=scalaXmlStart end="</\_[^>]\+>" contains=scalaXmlEscape,scalaXmlQuote,scalaXml,scalaXmlStart,scalaXmlComment -syn region scalaXmlEscape matchgroup=scalaXmlEscapeSpecial start="{" matchgroup=scalaXmlEscapeSpecial end="}" contained contains=TOP -syn match scalaXmlQuote "&[^;]\+;" contained -syn match scalaXmlComment "<!--\_[^>]*-->" contained +syn keyword scalaKeywordModifier abstract override final implicit lazy private protected sealed null require super +hi link scalaKeywordModifier Function -" REPL -syn match scalaREPLCmdLine "\<scala>\>" +syn keyword scalaSpecial this true false package import +syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite +syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)" +syn match scalaSpecial /`[^`]*`/  " Backtick literals +hi link scalaSpecial PreProc -" map Scala groups to standard groups -hi link scalaKeyword Keyword -hi link scalaKeywordModifier Function -hi link scalaAnnotation Include -hi link scalaPackage Include -hi link scalaImport Include -hi link scalaREPLCmdLine Include -hi link scalaDocTags Include -hi link scalaBackTick Include -hi link scalaBoolean Boolean -hi link scalaOperator Normal -hi link scalaNumber Number -hi link scalaEmptyString String +syn region scalaString start=/"/ skip=/\\"/ end=/"/  hi link scalaString String -hi link scalaChar String -hi link scalaMultiLineString String -hi link scalaStringEscape Special -hi link scalaSymbol Special -hi link scalaUnicode Special -hi link scalaComment Comment -hi link scalaLineComment Comment -hi link scalaDocComment Comment -hi link scalaTodo Todo -hi link scalaType Type -hi link scalaCaseType Type -hi link scalaTypeSpecializer scalaType -hi link scalaXml String -hi link scalaXmlTag Include -hi link scalaXmlString String -hi link scalaXmlStart Include -hi link scalaXmlEscape Normal -hi link scalaXmlEscapeSpecial Special -hi link scalaXmlQuote Special -hi link scalaXmlComment Comment -hi link scalaDef Keyword -hi link scalaVar Keyword -hi link scalaVal Keyword -hi link scalaClass Keyword -hi link scalaObject Keyword -hi link scalaTrait Keyword -hi link scalaDefName Function -hi link scalaDefSpecializer Function -hi link scalaClassName Special -hi link scalaClassSpecializer Special -hi link scalaConstructor Special -hi link scalaConstructorSpecializer scalaConstructor -let b:current_syntax = "scala" +syn region scalaSString matchgroup=Special start=/s"/ skip=/\\"/ end=/"/ contains=scalaInterpolation +syn match scalaInterpolation /\$[a-zA-Z0-9_$]\+/ contained +syn match scalaInterpolation /\${[^}]\+}/ contained +hi link scalaSString String +hi link scalaInterpolation Function + +syn region scalaFString matchgroup=Special start=/f"/ skip=/\\"/ end=/"/ contains=scalaInterpolation,scalaFInterpolation +syn match scalaFInterpolation /\$[a-zA-Z0-9_$]\+%[-A-Za-z0-9\.]\+/ contained +syn match scalaFInterpolation /\${[^}]\+}%[-A-Za-z0-9\.]\+/ contained +hi link scalaFString String +hi link scalaFInterpolation Function + +syn region scalaQuasiQuotes matchgroup=Type start=/\<q"/ skip=/\\"/ end=/"/ contains=scalaInterpolation +syn region scalaQuasiQuotes matchgroup=Type start=/\<[tcp]q"/ skip=/\\"/ end=/"/ contains=scalaInterpolation +hi link scalaQuasiQuotes String + +syn region scalaTripleQuasiQuotes matchgroup=Type start=/\<q"""/ end=/"""/ contains=scalaInterpolation +syn region scalaTripleQuasiQuotes matchgroup=Type start=/\<[tcp]q"""/ end=/"""/ contains=scalaInterpolation +hi link scalaTripleQuasiQuotes String + +syn region scalaTripleString start=/"""/ end=/"""/ +syn region scalaTripleSString matchgroup=PreProc start=/s"""/ end=/"""/ +syn region scalaTripleFString matchgroup=PreProc start=/f"""/ end=/"""/ +hi link scalaTripleString String +hi link scalaTripleSString String +hi link scalaTripleFString String + +syn match scalaNumber /\<0[dDfFlL]\?\>/ +syn match scalaNumber /\<[1-9]\d*[dDfFlL]\?\>/ +syn match scalaNumber /\<0[xX][0-9a-fA-F]\+[dDfFlL]\?\>/ +syn match scalaNumber "\%(\<\d\+\.\d*\|\.\d\+\)\%([eE][-+]\=\d\+\)\=[fFdD]\=" +syn match scalaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" +syn match scalaNumber "\<\d\+\%([eE][-+]\=\d\+\)\=[fFdD]\>" +hi link scalaNumber Number -" you might like to put these lines in your .vimrc -" -" customize colors a little bit (should be a different file) -" hi scalaNew gui=underline -" hi scalaMethodCall gui=italic -" hi scalaValName gui=underline -" hi scalaVarName gui=underline +syn region scalaSquareBrackets matchgroup=Type start="\[" end="\]" contains=scalaSpecial,scalaTypeParameter,scalaSquareBrackets,scalaTypeOperator +syn match scalaTypeAnnotation /\%(:\s*\)\@<=[_\.A-Za-z0-9$]\+/ +syn match scalaTypeParameter /[_\.A-Za-z0-9$]\+/ contained +syn match scalaTypeOperator /[=:<>]\+/ contained +hi link scalaTypeAnnotation Type +hi link scalaTypeParameter Type +hi link scalaTypeOperator Type + +syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaCommentCodeBlock,@scalaHtml keepend +syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained +syn match scalaParameterAnnotation "@param" nextgroup=scalaParamAnnotationValue skipwhite contained +syn match scalaParamAnnotationValue /[`_A-Za-z0-9$]\+/ contained +syn region scalaDocLinks start="\[\[" end="\]\]" contained +syn region scalaCommentCodeBlock matchgroup=Keyword start="{{{" end="}}}" contained +hi link scalaMultilineComment Comment +hi link scalaDocLinks Function +hi link scalaParameterAnnotation Function +hi link scalaParamAnnotationValue Keyword +hi link scalaCommentAnnotation Function +hi link scalaCommentCodeBlock String + +syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/ +hi link scalaAnnotation PreProc + +syn match scalaTrailingComment "//.*$" +hi link scalaTrailingComment Comment | 
