| OLD | NEW |
| 1 " Vim syntax file " Language: Dart | 1 " Vim syntax file " Language: Dart |
| 2 " Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 " Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 " for details. All rights reserved. Use of this source code is governed by a | 3 " for details. All rights reserved. Use of this source code is governed by a |
| 4 " BSD-style license that can be found in the LICENSE file. | 4 " BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 " Quit when a syntax file was already loaded | 6 " Quit when a syntax file was already loaded |
| 7 if !exists("main_syntax") | 7 if !exists("main_syntax") |
| 8 if version < 600 | 8 if version < 600 |
| 9 syntax clear | 9 syntax clear |
| 10 elseif exists("b:current_syntax") | 10 elseif exists("b:current_syntax") |
| 11 finish | 11 finish |
| 12 endif | 12 endif |
| 13 " we define it here so that included files can test for it | 13 " we define it here so that included files can test for it |
| 14 let main_syntax='dart' | 14 let main_syntax='dart' |
| 15 syn region dartFold start="{" end="}" transparent fold | 15 syn region dartFold start="{" end="}" transparent fold |
| 16 endif | 16 endif |
| 17 | 17 |
| 18 " Ensure long multiline strings are highlighted. |
| 19 syn sync fromstart |
| 20 |
| 18 " keyword definitions | 21 " keyword definitions |
| 19 syn keyword dartConditional if else switch | 22 syn keyword dartConditional if else switch |
| 20 syn keyword dartRepeat do while for | 23 syn keyword dartRepeat do while for |
| 21 syn keyword dartBoolean true false | 24 syn keyword dartBoolean true false |
| 22 syn keyword dartConstant null | 25 syn keyword dartConstant null |
| 23 syn keyword dartTypedef this super class typedef | 26 syn keyword dartTypedef this super class typedef |
| 24 syn keyword dartOperator new is in factory const | 27 syn keyword dartOperator new is in factory const |
| 25 syn match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=
\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~" | 28 syn match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=
\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~" |
| 26 syn keyword dartType void var final bool int double num | 29 syn keyword dartType void var final bool int double num dynamic |
| 27 syn keyword dartCommonInterfaces String Object Math RegExp Date | 30 syn keyword dartCommonInterfaces String Object Math RegExp Date |
| 28 syn keyword dartInterfaces Collection Comparable Completer Duration Dynami
c Function Future HashMap HashSet Iterable Iterator LinkedHashMap List Map Match
Options Pattern Queue Set Stopwatch StringBuffer TimeZone | 31 syn keyword dartInterfaces Collection Comparable Completer Duration Functi
on Future HashMap HashSet Iterable Iterator LinkedHashMap List Map Match Options
Pattern Queue Set Stopwatch StringBuffer TimeZone |
| 32 syn keyword dartInterfaces_DEPRECATED Dynamic |
| 29 syn keyword dartErrors AssertionError TypeError FallThroughError | 33 syn keyword dartErrors AssertionError TypeError FallThroughError |
| 30 syn keyword dartStatement return | 34 syn keyword dartStatement return |
| 31 syn keyword dartStorageClass static abstract | 35 syn keyword dartStorageClass static abstract |
| 32 syn keyword dartExceptions throw try catch finally | 36 syn keyword dartExceptions throw try catch finally |
| 33 syn keyword dartExceptions BadNumberFormatException ClosureArgumentMismatchE
xception EmptyQueueException Exception ExpectException FutureAlreadyCompleteExce
ption FutureNotCompleteException IllegalAccessException ArgumentError IllegalJSR
egExpException IndexOutOfRangeException IntegerDivisionByZeroException NoMoreEle
mentsException NoSuchMethodError NotImplementedException NullPointerException Ob
jectNotClosureException OutOfMemoryException StackOverflowException UnsupportedO
perationException WrongArgumentCountException | 37 syn keyword dartExceptions FormatException ClosureArgumentMismatchException
EmptyQueueException Exception ExpectException FutureAlreadyCompleteException Fut
ureNotCompleteException IllegalAccessException ArgumentError IllegalJSRegExpExce
ption IndexOutOfRangeException IntegerDivisionByZeroException NoMoreElementsExce
ption NoSuchMethodError NotImplementedException NullPointerException ObjectNotCl
osureException OutOfMemoryException StackOverflowException UnsupportedOperationE
xception WrongArgumentCountException |
| 38 syn keyword dartExceptions_DEPRECATED BadNumberFormatException |
| 34 syn keyword dartAssert assert | 39 syn keyword dartAssert assert |
| 35 syn keyword dartClassDecl extends implements interface | 40 syn keyword dartClassDecl extends implements interface |
| 36 " TODO(antonm): check if labels on break and continue are supported. | 41 " TODO(antonm): check if labels on break and continue are supported. |
| 37 syn keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhi
te | 42 syn keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhi
te |
| 38 syn keyword dartKeyword get set operator call equals negate external | 43 syn keyword dartKeyword get set operator call equals negate external |
| 39 syn match dartUserLabelRef "\k\+" contained | 44 syn match dartUserLabelRef "\k\+" contained |
| 40 syn match dartVarArg "\.\.\." | 45 syn match dartVarArg "\.\.\." |
| 41 | 46 |
| 42 " TODO(antonm): consider conditional highlighting of corelib classes. | 47 " TODO(antonm): consider conditional highlighting of corelib classes. |
| 43 | 48 |
| 44 syn region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>"
matchgroup=NONE end=":" | 49 syn region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>"
matchgroup=NONE end=":" |
| 45 syn keyword dartLabel default | 50 syn keyword dartLabel default |
| 46 | 51 |
| 47 " Comments | 52 " Comments |
| 48 syn keyword dartTodo contained TODO FIXME XXX | 53 syn keyword dartTodo contained TODO FIXME XXX |
| 49 syn region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLi
nk,@Spell | 54 syn region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLi
nk,@Spell |
| 50 syn match dartLineComment "//.*" contains=dartTodo,@Spell | 55 syn match dartLineComment "//.*" contains=dartTodo,@Spell |
| 51 syn match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell | 56 syn match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell |
| 52 syn region dartDocLink contained start=+\[+ end=+\]+ | 57 syn region dartDocLink contained start=+\[+ end=+\]+ |
| 53 | 58 |
| 54 " Strings | 59 " Strings |
| 55 syn region dartString start=+\z(["']\)+hs=s+1 end=+\z1+he=e-1 contains=@
Spell,dartInterpolation,dartSpecialChar | 60 syn region dartString start=+\z(["']\)+ end=+\z1+ contains=@Spell,dartIn
terpolation,dartSpecialChar |
| 56 syn region dartRawString start=+@\z(["']\)+hs=s+2 end=+\z1+he=e-1 contains=
@Spell | 61 syn region dartRawString_DEPRECATED start=+@\z(["']\)+ end=+\z1+ contains=@
Spell |
| 62 syn region dartRawString start=+r\z(["']\)+ end=+\z1+ contains=@Spell |
| 63 syn region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contai
ns=@Spell,dartInterpolation,dartSpecialChar |
| 64 syn region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ co
ntains=@Spell |
| 57 syn match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" | 65 syn match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" |
| 58 syn match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|
.\)" | 66 syn match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|
.\)" |
| 59 | 67 |
| 60 " Numbers | 68 " Numbers |
| 61 syn match dartNumber "\<\d\+\(\.\d\+\)\=\>" | 69 syn match dartNumber "\<\d\+\(\.\d\+\)\=\>" |
| 62 | 70 |
| 63 syn match dartInclude "^#\(import\|include\|source\|library\)(\(\"[^\"]\+
\"\|'[^']\+'\));" | 71 syn match dartInclude_DEPRECATED "^#\(import\|include\|source\|library\)(
\(\"[^\"]\+\"\|'[^']\+'\));" |
| 72 syn match dartInclude "^\(import\|include\|source\|library\)\s" |
| 64 | 73 |
| 65 " The default highlighting. | 74 " The default highlighting. |
| 66 command! -nargs=+ HiLink hi def link <args> | 75 command! -nargs=+ HiLink hi def link <args> |
| 67 HiLink dartVarArg Function | 76 HiLink dartVarArg Function |
| 68 HiLink dartBranch Conditional | 77 HiLink dartBranch Conditional |
| 69 HiLink dartUserLabelRef dartUserLabel | 78 HiLink dartUserLabelRef dartUserLabel |
| 70 HiLink dartLabel Label | 79 HiLink dartLabel Label |
| 71 HiLink dartUserLabel Label | 80 HiLink dartUserLabel Label |
| 72 HiLink dartConditional Conditional | 81 HiLink dartConditional Conditional |
| 73 HiLink dartRepeat Repeat | 82 HiLink dartRepeat Repeat |
| 74 HiLink dartExceptions Exception | 83 HiLink dartExceptions Exception |
| 84 HiLink dartExceptions_DEPRECATED Todo |
| 75 HiLink dartAssert Statement | 85 HiLink dartAssert Statement |
| 76 HiLink dartStorageClass StorageClass | 86 HiLink dartStorageClass StorageClass |
| 77 HiLink dartClassDecl dartStorageClass | 87 HiLink dartClassDecl dartStorageClass |
| 78 HiLink dartBoolean Boolean | 88 HiLink dartBoolean Boolean |
| 79 HiLink dartString String | 89 HiLink dartString String |
| 90 HiLink dartRawString_DEPRECATED Todo |
| 80 HiLink dartRawString String | 91 HiLink dartRawString String |
| 92 HiLink dartMultilineString String |
| 93 HiLink dartRawMultilineString String |
| 81 HiLink dartNumber Number | 94 HiLink dartNumber Number |
| 82 HiLink dartStatement Statement | 95 HiLink dartStatement Statement |
| 83 HiLink dartOperator Operator | 96 HiLink dartOperator Operator |
| 84 HiLink dartComment Comment | 97 HiLink dartComment Comment |
| 85 HiLink dartLineComment Comment | 98 HiLink dartLineComment Comment |
| 86 HiLink dartLineDocComment Comment | 99 HiLink dartLineDocComment Comment |
| 87 HiLink dartConstant Constant | 100 HiLink dartConstant Constant |
| 88 HiLink dartTypedef Typedef | 101 HiLink dartTypedef Typedef |
| 89 HiLink dartTodo Todo | 102 HiLink dartTodo Todo |
| 90 HiLink dartKeyword Keyword | 103 HiLink dartKeyword Keyword |
| 91 HiLink dartType Type | 104 HiLink dartType Type |
| 92 HiLink dartInterpolation PreProc | 105 HiLink dartInterpolation PreProc |
| 93 HiLink dartDocLink SpecialComment | 106 HiLink dartDocLink SpecialComment |
| 94 HiLink dartSpecialChar SpecialChar | 107 HiLink dartSpecialChar SpecialChar |
| 108 HiLink dartInclude_DEPRECATED Todo |
| 95 HiLink dartInclude Include | 109 HiLink dartInclude Include |
| 96 HiLink dartErrors Error | 110 HiLink dartErrors Error |
| 97 HiLink dartCommonInterfaces Type | 111 HiLink dartCommonInterfaces Type |
| 98 HiLink dartInterfaces Type | 112 HiLink dartInterfaces Type |
| 113 HiLink dartInterfaces_DEPRECATED Todo |
| 99 delcommand HiLink | 114 delcommand HiLink |
| 100 | 115 |
| 101 let b:current_syntax = "dart" | 116 let b:current_syntax = "dart" |
| 102 | 117 |
| 103 if main_syntax == 'dart' | 118 if main_syntax == 'dart' |
| 104 unlet main_syntax | 119 unlet main_syntax |
| 105 endif | 120 endif |
| 106 | 121 |
| 107 let b:spell_options="contained" | 122 let b:spell_options="contained" |
| 108 | 123 |
| 109 " Enable automatic indentation (2 spaces) | 124 " Enable automatic indentation (2 spaces) |
| 110 set expandtab | 125 set expandtab |
| 111 set shiftwidth=2 | 126 set shiftwidth=2 |
| 112 set softtabstop=2 | 127 set softtabstop=2 |
| 113 set cindent | 128 set cindent |
| OLD | NEW |