2019-03-04 03:28:35 -05:00
|
|
|
if exists('g:polyglot_disabled') && index(g:polyglot_disabled, 'kotlin') != -1
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
2015-10-10 11:15:29 -04:00
|
|
|
" Vim syntax file
|
|
|
|
" Language: Kotlin
|
|
|
|
" Maintainer: Alexander Udalov
|
2019-06-08 06:44:15 -04:00
|
|
|
" Latest Revision: 26 May 2019
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
if exists('b:current_syntax')
|
2015-10-10 11:15:29 -04:00
|
|
|
finish
|
|
|
|
endif
|
|
|
|
|
|
|
|
syn keyword ktStatement break continue return
|
|
|
|
syn keyword ktConditional if else when
|
|
|
|
syn keyword ktRepeat do for while
|
2019-06-08 06:44:15 -04:00
|
|
|
syn keyword ktOperator 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
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
syn match ktOperator "\v\?:|::|\<\=? | \>\=?|[!=]\=\=?|<as>\??|[-!%&*+/|]"
|
|
|
|
|
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
|
|
|
|
|
2019-03-04 03:15:44 -05:00
|
|
|
syn region ktDocComment start="/\*\*" end="\*/" contains=ktDocTag,ktTodo,@Spell
|
|
|
|
syn match ktDocTag "\v\@(author|constructor|receiver|return|since|suppress)>" contained
|
|
|
|
syn match ktDocTag "\v\@(exception|param|property|throws|see|sample)>\s*\S+" contains=ktDocTagParam contained
|
|
|
|
syn match ktDocTagParam "\v(\s|\[)\S+" contained
|
|
|
|
syn match ktComment "/\*\*/"
|
|
|
|
|
2015-10-10 11:15:29 -04:00
|
|
|
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
|
2019-03-04 03:15:44 -05:00
|
|
|
syn region ktComplexInterpolation matchgroup=ktComplexInterpolationBrace start="\v\$\{" end="\v\}" contains=ALLBUT,ktSimpleInterpolation,ktTodo,ktSpecialCharError,ktSpecialChar,ktDocTag,ktDocTagParam
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-03-04 03:15:44 -05:00
|
|
|
syn match ktNumber "\v<\d+[_[:digit:]]*(uL?|UL?|[LFf])?"
|
|
|
|
syn match ktNumber "\v<0[Xx]\x+[_[:xdigit:]]*(uL?|UL?|L)?"
|
|
|
|
syn match ktNumber "\v<0[Bb][01]+[_01]*(uL?|UL?|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 "->"
|
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktStatement Statement
|
|
|
|
hi def link ktConditional Conditional
|
|
|
|
hi def link ktRepeat Repeat
|
|
|
|
hi def link ktOperator Operator
|
|
|
|
hi def link ktKeyword Keyword
|
|
|
|
hi def link ktException Exception
|
|
|
|
hi def link ktReservedKeyword Error
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktInclude Include
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktType Type
|
|
|
|
hi def link ktModifier StorageClass
|
|
|
|
hi def link ktStructure Structure
|
|
|
|
hi def link ktTypedef Typedef
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktBoolean Boolean
|
|
|
|
hi def link ktConstant Constant
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktTodo Todo
|
|
|
|
hi def link ktShebang Comment
|
|
|
|
hi def link ktLineComment Comment
|
|
|
|
hi def link ktComment Comment
|
|
|
|
hi def link ktCommentMatchGroup Comment
|
|
|
|
hi def link ktDocComment Comment
|
|
|
|
hi def link ktDocTag Special
|
|
|
|
hi def link ktDocTagParam Identifier
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktSpecialChar SpecialChar
|
|
|
|
hi def link ktSpecialCharError Error
|
|
|
|
hi def link ktString String
|
|
|
|
hi def link ktCharacter Character
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktAnnotation Identifier
|
|
|
|
hi def link ktLabel Identifier
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktSimpleInterpolation Identifier
|
|
|
|
hi def link ktComplexInterpolationBrace Identifier
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktNumber Number
|
|
|
|
hi def link ktFloat Float
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
hi def link ktExclExcl Special
|
|
|
|
hi def link ktArrow Structure
|
2015-10-10 11:15:29 -04:00
|
|
|
|
2019-06-08 06:44:15 -04:00
|
|
|
let b:current_syntax = 'kotlin'
|