2015-12-06 05:38:02 -05:00
|
|
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'dart') == -1
|
|
|
|
|
|
|
|
" Vim syntax file " Language: Dart
|
|
|
|
" Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
|
|
" for details. All rights reserved. Use of this source code is governed by a
|
|
|
|
" BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
if !exists("g:main_syntax")
|
|
|
|
if version < 600
|
|
|
|
syntax clear
|
|
|
|
elseif exists("b:current_syntax")
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let g:main_syntax = 'dart'
|
|
|
|
syntax region dartFold start="{" end="}" transparent fold
|
|
|
|
endif
|
|
|
|
|
|
|
|
" Ensure long multiline strings are highlighted.
|
|
|
|
syntax sync fromstart
|
|
|
|
|
2017-09-27 13:57:29 -04:00
|
|
|
syntax case match
|
|
|
|
|
2015-12-06 05:38:02 -05:00
|
|
|
" keyword definitions
|
|
|
|
syntax keyword dartConditional if else switch
|
|
|
|
syntax keyword dartRepeat do while for
|
|
|
|
syntax keyword dartBoolean true false
|
|
|
|
syntax keyword dartConstant null
|
2016-07-26 07:43:53 -04:00
|
|
|
syntax keyword dartTypedef this super class typedef enum
|
|
|
|
syntax keyword dartOperator new is as in
|
2015-12-06 05:38:02 -05:00
|
|
|
syntax match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:"
|
2017-09-27 13:57:29 -04:00
|
|
|
syntax keyword dartType void var bool int double num dynamic covariant
|
2015-12-06 05:38:02 -05:00
|
|
|
syntax keyword dartStatement return
|
2016-07-26 07:43:53 -04:00
|
|
|
syntax keyword dartStorageClass static abstract final const factory
|
2015-12-06 05:38:02 -05:00
|
|
|
syntax keyword dartExceptions throw rethrow try on catch finally
|
|
|
|
syntax keyword dartAssert assert
|
|
|
|
syntax keyword dartClassDecl extends with implements
|
|
|
|
syntax keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhite
|
2017-09-27 13:57:29 -04:00
|
|
|
syntax keyword dartKeyword get set operator call external async await yield sync native
|
2015-12-06 05:38:02 -05:00
|
|
|
syntax match dartUserLabelRef "\k\+" contained
|
|
|
|
|
|
|
|
syntax region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":"
|
|
|
|
syntax keyword dartLabel default
|
|
|
|
|
2016-07-26 07:43:53 -04:00
|
|
|
syntax match dartLibrary "^\(import\|export\)\>" nextgroup=dartUri skipwhite
|
|
|
|
syntax region dartUri contained start=+r\=\z(["']\)+ end=+\z1+ nextgroup=dartCombinators skipwhite
|
|
|
|
syntax region dartCombinators contained start="" end=";" contains=dartCombinator
|
|
|
|
syntax keyword dartCombinator contained show hide deferred as
|
|
|
|
syntax match dartLibrary "^\(library\|part of\|part\)\>"
|
|
|
|
|
|
|
|
syntax match dartMetadata "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>"
|
2015-12-06 05:38:02 -05:00
|
|
|
|
2017-09-27 13:57:29 -04:00
|
|
|
" Numbers
|
|
|
|
syntax match dartNumber "\<\d\+\(\.\d\+\)\=\>"
|
|
|
|
|
|
|
|
" Core libraries
|
|
|
|
if !exists('dart_corelib_highlight') || dart_corelib_highlight
|
|
|
|
syntax keyword dartCoreClasses BidirectionalIterator Comparable DateTime
|
|
|
|
\ Duration Expando Function Invocation Iterable Iterator List Map Match
|
|
|
|
\ Object Pattern RegExp RuneIterator Runes Set StackTrace Stopwatch String
|
|
|
|
\ StringBuffer StringSink Symbol Type
|
|
|
|
syntax keyword dartCoreTypedefs Comparator
|
|
|
|
syntax keyword dartCoreExceptions AbstractClassInstantiationError
|
|
|
|
\ ArgumentError AssertionError CastError ConcurrentModificationError
|
|
|
|
\ Error Exception FallThroughError FormatException
|
|
|
|
\ IntegerDivisionByZeroException NoSuchMethodError NullThrownError
|
|
|
|
\ OutOfMemoryError RangeError RuntimeError StackOverflowError StateError
|
|
|
|
\ TypeError UnimplementedError UnsupportedError
|
|
|
|
endif
|
|
|
|
|
2015-12-06 05:38:02 -05:00
|
|
|
" Comments
|
|
|
|
syntax keyword dartTodo contained TODO FIXME XXX
|
2016-07-26 07:43:53 -04:00
|
|
|
syntax region dartComment start="/\*" end="\*/" contains=dartComment,dartTodo,dartDocLink,@Spell
|
2015-12-06 05:38:02 -05:00
|
|
|
syntax match dartLineComment "//.*" contains=dartTodo,@Spell
|
|
|
|
syntax match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
|
2017-11-19 15:26:59 -05:00
|
|
|
syntax match dartShebangLine /^\%1l#!.*/
|
2015-12-17 04:44:58 -05:00
|
|
|
syntax region dartDocLink oneline contained start=+\[+ end=+\]+
|
2015-12-06 05:38:02 -05:00
|
|
|
|
|
|
|
" Strings
|
2017-09-27 13:57:29 -04:00
|
|
|
syntax cluster dartRawStringContains contains=@Spell
|
|
|
|
if exists('dart_html_in_strings') && dart_html_in_strings
|
|
|
|
syntax include @HTML syntax/html.vim
|
|
|
|
syntax cluster dartRawStringContains add=@HTML
|
|
|
|
endif
|
|
|
|
syntax cluster dartStringContains contains=@dartRawStringContains,dartInterpolation,dartSpecialChar
|
|
|
|
syntax region dartString oneline start=+\z(["']\)+ end=+\z1+ contains=@dartStringContains keepend
|
|
|
|
syntax region dartRawString oneline start=+r\z(["']\)+ end=+\z1+ contains=@dartRawStringContains keepend
|
2017-12-06 06:56:27 -05:00
|
|
|
syntax region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartStringContains keepend
|
|
|
|
syntax region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@dartSRawtringContains keepend
|
2017-09-27 13:57:29 -04:00
|
|
|
syntax match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" extend
|
|
|
|
syntax match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)" extend
|
2015-12-06 05:38:02 -05:00
|
|
|
|
|
|
|
" The default highlighting.
|
|
|
|
highlight default link dartBranch Conditional
|
|
|
|
highlight default link dartUserLabelRef dartUserLabel
|
|
|
|
highlight default link dartLabel Label
|
|
|
|
highlight default link dartUserLabel Label
|
|
|
|
highlight default link dartConditional Conditional
|
|
|
|
highlight default link dartRepeat Repeat
|
|
|
|
highlight default link dartExceptions Exception
|
|
|
|
highlight default link dartAssert Statement
|
|
|
|
highlight default link dartStorageClass StorageClass
|
|
|
|
highlight default link dartClassDecl dartStorageClass
|
|
|
|
highlight default link dartBoolean Boolean
|
|
|
|
highlight default link dartString String
|
|
|
|
highlight default link dartRawString String
|
|
|
|
highlight default link dartMultilineString String
|
|
|
|
highlight default link dartRawMultilineString String
|
|
|
|
highlight default link dartNumber Number
|
|
|
|
highlight default link dartStatement Statement
|
|
|
|
highlight default link dartOperator Operator
|
|
|
|
highlight default link dartComment Comment
|
|
|
|
highlight default link dartLineComment Comment
|
|
|
|
highlight default link dartLineDocComment Comment
|
2017-11-19 15:26:59 -05:00
|
|
|
highlight default link dartShebangLine Comment
|
2015-12-06 05:38:02 -05:00
|
|
|
highlight default link dartConstant Constant
|
|
|
|
highlight default link dartTypedef Typedef
|
|
|
|
highlight default link dartTodo Todo
|
|
|
|
highlight default link dartKeyword Keyword
|
|
|
|
highlight default link dartType Type
|
|
|
|
highlight default link dartInterpolation PreProc
|
|
|
|
highlight default link dartDocLink SpecialComment
|
|
|
|
highlight default link dartSpecialChar SpecialChar
|
|
|
|
highlight default link dartLibrary Include
|
2016-07-26 07:43:53 -04:00
|
|
|
highlight default link dartUri String
|
|
|
|
highlight default link dartCombinator Keyword
|
2015-12-06 05:38:02 -05:00
|
|
|
highlight default link dartCoreClasses Type
|
|
|
|
highlight default link dartCoreTypedefs Typedef
|
|
|
|
highlight default link dartCoreExceptions Exception
|
2016-07-26 07:43:53 -04:00
|
|
|
highlight default link dartMetadata PreProc
|
2015-12-06 05:38:02 -05:00
|
|
|
|
|
|
|
let b:current_syntax = "dart"
|
|
|
|
let b:spell_options = "contained"
|
|
|
|
|
|
|
|
if g:main_syntax is# 'dart'
|
|
|
|
unlet g:main_syntax
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|