diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2014-01-09 11:59:09 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2014-01-09 11:59:09 +0100 |
commit | f211f02d1e53dbb4eada17e999eba81bccaf1fb2 (patch) | |
tree | 0c26fd0f916643af27e56fab71d3fe8dc58e4231 /syntax/scala.vim | |
parent | e45b23b6ee6e3b00ba4c7111f0c703f93fea9123 (diff) | |
download | vim-polyglot-f211f02d1e53dbb4eada17e999eba81bccaf1fb2.tar.gz vim-polyglot-f211f02d1e53dbb4eada17e999eba81bccaf1fb2.zip |
Update
Diffstat (limited to 'syntax/scala.vim')
-rw-r--r-- | syntax/scala.vim | 70 |
1 files changed, 49 insertions, 21 deletions
diff --git a/syntax/scala.vim b/syntax/scala.vim index a3f567a1..1ee87478 100644 --- a/syntax/scala.vim +++ b/syntax/scala.vim @@ -12,12 +12,14 @@ 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 nextgroup=scalaInstanceDeclaration skipwhite -syn keyword scalaKeyword type nextgroup=scalaTypeTypeDeclaration skipwhite syn keyword scalaKeyword case nextgroup=scalaKeyword,scalaCaseFollowing skipwhite syn keyword scalaKeyword val nextgroup=scalaNameDefinition,scalaQuasiQuotes skipwhite syn keyword scalaKeyword def var nextgroup=scalaNameDefinition skipwhite hi link scalaKeyword Keyword +syn keyword scalaAkkaSpecialWord when goto using startWith initialize onTransition stay become unbecome +hi link scalaAkkaSpecialWord PreProc + syn match scalaSymbol /'[_A-Za-z0-9$]\+/ hi link scalaSymbol Number @@ -28,14 +30,26 @@ hi link scalaChar Character hi link scalaEscapedChar Function hi link scalaUnicodeChar Special +syn match scalaOperator "||" +syn match scalaOperator "&&" +hi link scalaOperator Special + syn match scalaNameDefinition /\<[_A-Za-z0-9$]\+\>/ contained nextgroup=scalaPostNameDefinition syn match scalaNameDefinition /`[^`]\+`/ contained nextgroup=scalaPostNameDefinition syn match scalaPostNameDefinition /\_s*:\_s*/ contained nextgroup=scalaTypeDeclaration hi link scalaNameDefinition Function -syn match scalaInstanceDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained +syn match scalaInstanceDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaInstanceHash syn match scalaInstanceDeclaration /`[^`]\+`/ contained +syn match scalaInstanceHash /#/ contained nextgroup=scalaInstanceDeclaration hi link scalaInstanceDeclaration Special +hi link scalaInstanceHash Type + +syn match scalaCapitalWord /\<[A-Z][A-Za-z0-9$]*\>/ +hi link scalaCapitalWord Special + +" Handle type declarations specially +syn region scalaTypeStatement matchgroup=Keyword start=/\<type\_s\+\ze/ end=/$/ contains=scalaTypeTypeDeclaration,scalaSquareBrackets,scalaTypeTypeEquals,scalaTypeStatement " Ugh... duplication of all the scalaType* stuff to handle special highlighting " of `type X =` declarations @@ -43,18 +57,18 @@ syn match scalaTypeTypeDeclaration /(/ contained nextgroup=scalaTypeTypeExtensio syn match scalaTypeTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeTypeDeclaration contains=scalaTypeTypeExtension skipwhite syn match scalaTypeTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypeExtension,scalaTypeTypeEquals skipwhite syn match scalaTypeTypeEquals /=\ze[^>]/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite -syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained nextgroup=scalaTypeTypeDeclaration skipwhite -syn match scalaTypeTypePostDeclaration /\<[_A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypePostExtension contains=ALLBUT,scalaParamAnnotationValue skipwhite +syn match scalaTypeTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeTypeDeclaration skipwhite +syn match scalaTypeTypePostDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeTypePostExtension skipwhite syn match scalaTypeTypePostExtension /\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained nextgroup=scalaTypeTypePostDeclaration skipwhite hi link scalaTypeTypeDeclaration Type hi link scalaTypeTypeExtension Keyword hi link scalaTypeTypePostDeclaration Special hi link scalaTypeTypePostExtension Keyword -syn match scalaTypeDeclaration /(/ contained nextgroup=scalaTypeExtension,scalaTypeEquals contains=scalaRoundBrackets skipwhite +syn match scalaTypeDeclaration /(/ contained nextgroup=scalaTypeExtension contains=scalaRoundBrackets skipwhite syn match scalaTypeDeclaration /\%(⇒\|=>\)\ze/ contained nextgroup=scalaTypeDeclaration contains=scalaTypeExtension skipwhite -syn match scalaTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeExtension,scalaTypeEquals skipwhite -syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\)/ contained nextgroup=scalaTypeDeclaration skipwhite +syn match scalaTypeDeclaration /\<[_\.A-Za-z0-9$]\+\>/ contained nextgroup=scalaTypeExtension skipwhite +syn match scalaTypeExtension /)\?\_s*\zs\%(⇒\|=>\|<:\|:>\|=:=\|::\|#\)/ contained nextgroup=scalaTypeDeclaration skipwhite hi link scalaTypeDeclaration Type hi link scalaTypeExtension Keyword hi link scalaTypePostExtension Keyword @@ -63,14 +77,14 @@ syn match scalaTypeAnnotation /\%([_a-zA-Z0-9$\s]:\_s*\)\ze[_=(\.A-Za-z0-9$]\+/ syn match scalaTypeAnnotation /)\_s*:\_s*\ze[_=(\.A-Za-z0-9$]\+/ skipwhite nextgroup=scalaTypeDeclaration hi link scalaTypeAnnotation Normal -syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]*\>/ contained +syn match scalaCaseFollowing /\<[_\.A-Za-z0-9$]\+\>/ contained syn match scalaCaseFollowing /`[^`]\+`/ contained hi link scalaCaseFollowing Special -syn keyword scalaKeywordModifier abstract override final lazy implicit private protected sealed null require super +syn keyword scalaKeywordModifier abstract override final lazy implicit implicitly private protected sealed null require super hi link scalaKeywordModifier Function -syn keyword scalaSpecial this true false package import +syn keyword scalaSpecial this true false package import ne eq syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)" syn match scalaSpecial /`[^`]*`/ " Backtick literals @@ -97,23 +111,23 @@ syn region scalaQuasiQuotes matchgroup=Type start=/\<q"/ skip=/\\"/ end=/"/ cont 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 +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=/"""/ contains=scalaEscapedChar,scalaUnicodeChar -syn region scalaTripleSString matchgroup=Special start=/s"""/ end=/"""/ contains=scalaInterpolation,scalaEscapedChar,scalaUnicodeChar -syn region scalaTripleFString matchgroup=Special start=/f"""/ end=/"""/ contains=scalaInterpolation,scalaFInterpolation,scalaEscapedChar,scalaUnicodeChar +syn region scalaTripleString start=/"""/ end=/"""\%([^"]\|$\)/ contains=scalaEscapedChar,scalaUnicodeChar +syn region scalaTripleSString matchgroup=Special start=/s"""/ end=/"""\%([^"]\|$\)/ contains=scalaInterpolation,scalaEscapedChar,scalaUnicodeChar +syn region scalaTripleFString matchgroup=Special start=/f"""/ end=/"""\%([^"]\|$\)/ contains=scalaInterpolation,scalaFInterpolation,scalaEscapedChar,scalaUnicodeChar 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]\>" +syn match scalaNumber /\<0[dDfFlL]\?\>/ " Just a bare 0 +syn match scalaNumber /\<[1-9]\d*[dDfFlL]\?\>/ " A multi-digit number - octal numbers with leading 0's are deprecated in Scala +syn match scalaNumber /\<0[xX][0-9a-fA-F]\+[dDfFlL]\?\>/ " Hex number +syn match scalaNumber /\%(\<\d\+\.\d*\|\.\d\+\)\%([eE][-+]\=\d\+\)\=[fFdD]\=/ " exponential notation 1 +syn match scalaNumber /\<\d\+[eE][-+]\=\d\+[fFdD]\=\>/ " exponential notation 2 +syn match scalaNumber /\<\d\+\%([eE][-+]\=\d\+\)\=[fFdD]\>/ " exponential notation 3 hi link scalaNumber Number syn region scalaRoundBrackets start="(" end=")" skipwhite contained contains=scalaTypeDeclaration,scalaSquareBrackets,scalaRoundBrackets @@ -142,3 +156,17 @@ hi link scalaAnnotation PreProc syn match scalaTrailingComment "//.*$" hi link scalaTrailingComment Comment + +syn match scalaAkkaFSM /goto([^)]*)\_s\+\<using\>/ contains=scalaAkkaFSMGotoUsing +syn match scalaAkkaFSM /stay\_s\+using/ +syn match scalaAkkaFSM /^\s*stay\s*$/ +syn match scalaAkkaFSM /when\ze([^)]*)/ +syn match scalaAkkaFSM /startWith\ze([^)]*)/ +syn match scalaAkkaFSM /initialize\ze()/ +syn match scalaAkkaFSM /onTransition/ +syn match scalaAkkaFSM /onTermination/ +syn match scalaAkkaFSM /whenUnhandled/ +syn match scalaAkkaFSMGotoUsing /\<using\>/ +syn match scalaAkkaFSMGotoUsing /\<goto\>/ +hi link scalaAkkaFSM PreProc +hi link scalaAkkaFSMGotoUsing PreProc |