2015-10-10 11:15:29 -04:00
|
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'kotlin') == -1
|
|
|
|
|
|
|
|
" Vim syntax file
|
|
|
|
" Language: Kotlin
|
|
|
|
" Maintainer: Alexander Udalov
|
2017-12-06 06:56:27 -05:00
|
|
|
" Latest Revision: 23 November 2017
|
2015-10-10 11:15:29 -04:00
|
|
|
|
|
|
|
if exists("b:current_syntax")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
|
|
|
let b:current_syntax = "kotlin"
|
|
|
|
|
|
|
|
syn keyword ktStatement break continue return
|
|
|
|
syn keyword ktConditional if else when
|
|
|
|
syn keyword ktRepeat do for while
|
|
|
|
syn keyword ktOperator as in is by
|
2015-12-17 04:44:58 -05:00
|
|
|
syn keyword ktKeyword get set out super this where
|
2015-10-10 11:15:29 -04:00
|
|
|
syn keyword ktException try catch finally throw
|
|
|
|
|
|
|
|
syn keyword ktInclude import package
|
|
|
|
|
|
|
|
syn keyword ktType Any Boolean Byte Char Double Float Int Long Nothing Short Unit
|
2018-12-26 04:41:57 -05:00
|
|
|
syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic expect actual
|
2016-07-05 03:53:49 -04:00
|
|
|
syn keyword ktStructure class object interface typealias fun val var constructor init
|
2015-12-28 08:48:04 -05:00
|
|
|
|
2016-07-05 03:53:49 -04:00
|
|
|
syn keyword ktReservedKeyword typeof
|
2015-10-10 11:15:29 -04:00
|
|
|
|
|
|
|
syn keyword ktBoolean true false
|
|
|
|
syn keyword ktConstant null
|
|
|
|
|
2017-02-02 15:16:29 -05:00
|
|
|
syn keyword ktModifier data tailrec lateinit reified external inline noinline crossinline const operator infix suspend
|
2015-10-10 11:15:29 -04:00
|
|
|
|
|
|
|
syn keyword ktTodo TODO FIXME XXX contained
|
2016-05-02 04:42:37 -04:00
|
|
|
syn match ktShebang "\v^#!.*$"
|
|
|
|
syn match ktLineComment "\v//.*$" contains=ktTodo,@Spell
|
2015-10-10 11:15:29 -04:00
|
|
|
syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contains=ktComment,ktTodo,@Spell
|
|
|
|
|
|
|
|
syn match ktSpecialCharError "\v\\." contained
|
|
|
|
syn match ktSpecialChar "\v\\([tbnr'"$\\]|u\x{4})" contained
|
|
|
|
syn region ktString start='"' skip='\\"' end='"' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
|
2017-12-06 06:56:27 -05:00
|
|
|
syn region ktString start='"""' end='""""*' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError
|
2015-10-10 11:15:29 -04:00
|
|
|
syn match ktCharacter "\v'[^']*'" contains=ktSpecialChar,ktSpecialCharError
|
|
|
|
syn match ktCharacter "\v'\\''" contains=ktSpecialChar
|
|
|
|
syn match ktCharacter "\v'[^\\]'"
|
|
|
|
|
|
|
|
" TODO: highlight label in 'this@Foo'
|
|
|
|
syn match ktAnnotation "\v(\w)@<!\@[[:alnum:]_.]*(:[[:alnum:]_.]*)?"
|
|
|
|
syn match ktLabel "\v\w+\@"
|
|
|
|
|
|
|
|
syn match ktSimpleInterpolation "\v\$\h\w*" contained
|
|
|
|
syn region ktComplexInterpolation matchgroup=ktComplexInterpolationBrace start="\v\$\{" end="\v\}" contains=ALLBUT,ktSimpleInterpolation
|
|
|
|
|
2017-09-27 13:57:29 -04:00
|
|
|
syn match ktNumber "\v<\d+[_[:digit:]]*[LFf]?"
|
|
|
|
syn match ktNumber "\v<0[Xx]\x+[_[:xdigit:]]*L?"
|
|
|
|
syn match ktNumber "\v<0[Bb][01]+[_01]*L?"
|
2015-10-10 11:15:29 -04:00
|
|
|
syn match ktFloat "\v<\d*(\d[eE][-+]?\d+|\.\d+([eE][-+]?\d+)?)[Ff]?"
|
|
|
|
|
|
|
|
syn match ktEscapedName "\v`.*`"
|
|
|
|
|
|
|
|
syn match ktExclExcl "!!"
|
|
|
|
syn match ktArrow "->"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hi link ktStatement Statement
|
|
|
|
hi link ktConditional Conditional
|
|
|
|
hi link ktRepeat Repeat
|
|
|
|
hi link ktOperator Operator
|
|
|
|
hi link ktKeyword Keyword
|
|
|
|
hi link ktException Exception
|
2015-12-28 08:48:04 -05:00
|
|
|
hi link ktReservedKeyword Error
|
2015-10-10 11:15:29 -04:00
|
|
|
|
|
|
|
hi link ktInclude Include
|
|
|
|
|
|
|
|
hi link ktType Type
|
|
|
|
hi link ktModifier StorageClass
|
|
|
|
hi link ktStructure Structure
|
|
|
|
hi link ktTypedef Typedef
|
|
|
|
|
|
|
|
hi link ktBoolean Boolean
|
|
|
|
hi link ktConstant Constant
|
|
|
|
|
|
|
|
hi link ktTodo Todo
|
2016-05-02 04:42:37 -04:00
|
|
|
hi link ktShebang Comment
|
2015-10-10 11:15:29 -04:00
|
|
|
hi link ktLineComment Comment
|
|
|
|
hi link ktComment Comment
|
|
|
|
hi link ktCommentMatchGroup Comment
|
|
|
|
|
|
|
|
hi link ktSpecialChar SpecialChar
|
|
|
|
hi link ktSpecialCharError Error
|
|
|
|
hi link ktString String
|
|
|
|
hi link ktCharacter Character
|
|
|
|
|
|
|
|
hi link ktAnnotation Identifier
|
|
|
|
hi link ktLabel Identifier
|
|
|
|
|
|
|
|
hi link ktSimpleInterpolation Identifier
|
|
|
|
hi link ktComplexInterpolationBrace Identifier
|
|
|
|
|
|
|
|
hi link ktNumber Number
|
|
|
|
hi link ktFloat Float
|
|
|
|
|
|
|
|
hi link ktExclExcl Special
|
|
|
|
hi link ktArrow Structure
|
|
|
|
|
|
|
|
endif
|