diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2015-02-11 11:27:11 -0800 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2015-02-11 11:27:11 -0800 |
commit | 6cd2d5417d728ea96c5c52b34629c944a89eec60 (patch) | |
tree | f6d49573e7a22b1ede56055d3952707eab085c18 /syntax/scala.vim | |
parent | b7a30b1f1a963902d9743ae229a1f9d18b887e17 (diff) | |
download | vim-polyglot-1.11.4.tar.gz vim-polyglot-1.11.4.zip |
Updatev1.11.4
Diffstat (limited to 'syntax/scala.vim')
-rw-r--r-- | syntax/scala.vim | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/syntax/scala.vim b/syntax/scala.vim index 97189aed..9ac17a96 100644 --- a/syntax/scala.vim +++ b/syntax/scala.vim @@ -1,22 +1,40 @@ -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish +" Vim syntax file +" Language: Scala +" Maintainer: Derek Wyatt +" URL: https://github.com/derekwyatt/vim-scala +" License: Apache 2 +" ---------------------------------------------------------------------------- + +if !exists('main_syntax') + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + let main_syntax = 'scala' endif scriptencoding utf-8 let b:current_syntax = "scala" +" Allows for embedding, see #59; main_syntax convention instead? Refactor TOP +" +" The @Spell here is a weird hack, it means *exclude* if the first group is +" TOP. Otherwise we get spelling errors highlighted on code elements that +" match scalaBlock, even with `syn spell notoplevel`. function! s:ContainedGroup() try silent syn list @scala - return '@scala' + return '@scala,@NoSpell' catch /E392/ - return 'TOP' + return 'TOP,@Spell' endtry endfunction +syn include @scalaHtml syntax/html.vim " Doc comment HTML +unlet! b:current_syntax + syn case match syn sync minlines=200 maxlines=1000 @@ -58,6 +76,9 @@ syn match scalaInstanceHash /#/ contained nextgroup=scalaInstanceDeclaration hi link scalaInstanceDeclaration Special hi link scalaInstanceHash Type +syn match scalaUnimplemented /???/ +hi link scalaUnimplemented ERROR + syn match scalaCapitalWord /\<[A-Z][A-Za-z0-9$]*\>/ hi link scalaCapitalWord Special @@ -97,12 +118,15 @@ hi link scalaCaseFollowing Special 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 ne eq +syn keyword scalaSpecial this true false ne eq syn keyword scalaSpecial new nextgroup=scalaInstanceDeclaration skipwhite syn match scalaSpecial "\%(=>\|⇒\|<-\|←\|->\|→\)" syn match scalaSpecial /`[^`]*`/ " Backtick literals hi link scalaSpecial PreProc +syn keyword scalaExternal package import +hi link scalaExternal Include + syn match scalaStringEmbeddedQuote /\\"/ contained syn region scalaString start=/"/ end=/"/ contains=scalaStringEmbeddedQuote,scalaEscapedChar,scalaUnicodeChar hi link scalaString String @@ -146,7 +170,7 @@ syn match scalaTypeAnnotationParameter /@\<[`_A-Za-z0-9$]\+\>/ contained hi link scalaTypeOperator Keyword hi link scalaTypeAnnotationParameter Function -syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaCommentCodeBlock,@scalaHtml keepend +syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaCommentCodeBlock,@scalaHtml,@Spell 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 @@ -162,7 +186,7 @@ hi link scalaCommentCodeBlock String syn match scalaAnnotation /@\<[`_A-Za-z0-9$]\+\>/ hi link scalaAnnotation PreProc -syn match scalaTrailingComment "//.*$" +syn match scalaTrailingComment "//.*$" contains=@Spell hi link scalaTrailingComment Comment syn match scalaAkkaFSM /goto([^)]*)\_s\+\<using\>/ contains=scalaAkkaFSMGotoUsing @@ -178,3 +202,11 @@ syn match scalaAkkaFSMGotoUsing /\<using\>/ syn match scalaAkkaFSMGotoUsing /\<goto\>/ hi link scalaAkkaFSM PreProc hi link scalaAkkaFSMGotoUsing PreProc + +let b:current_syntax = 'scala' + +if main_syntax ==# 'scala' + unlet main_syntax +endif + +" vim:set sw=2 sts=2 ts=8 et: |