| 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 " keyword definitions | 18 " keyword definitions |
| 19 syn keyword dartConditional if else switch | 19 syn keyword dartConditional if else switch |
| 20 syn keyword dartRepeat do while for | 20 syn keyword dartRepeat do while for |
| 21 syn keyword dartBoolean true false | 21 syn keyword dartBoolean true false |
| 22 syn keyword dartConstant null | 22 syn keyword dartConstant null |
| 23 syn keyword dartTypedef this super class typedef | 23 syn keyword dartTypedef this super class typedef |
| 24 syn keyword dartOperator new is in factory | 24 syn keyword dartOperator new is in factory const |
| 25 syn match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=
\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~" | 25 syn match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=
\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~" |
| 26 syn keyword dartType void var const bool int double num | 26 syn keyword dartType void var final bool int double num |
| 27 syn keyword dartCommonInterfaces String Object Math RegExp Date |
| 28 syn keyword dartInterfaces Collection Comparable Completer Duration Dynami
c Function Future Hashable HashMap HashSet Iterable Iterator LinkedHashMap List
Map Match Options Pattern Queue Set Stopwatch StringBuffer TimeZone |
| 29 syn keyword dartErrors AssertionError TypeError FallThroughError |
| 27 syn keyword dartStatement return | 30 syn keyword dartStatement return |
| 28 syn keyword dartStorageClass static final abstract | 31 syn keyword dartStorageClass static abstract |
| 29 syn keyword dartExceptions throw try catch finally | 32 syn keyword dartExceptions throw try catch finally |
| 33 syn keyword dartExceptions BadNumberFormatException ClosureArgumentMismatchE
xception EmptyQueueException Exception ExpectException FutureAlreadyCompleteExce
ption FutureNotCompleteException IllegalAccessException IllegalArgumentException
IllegalJSRegExpException IndexOutOfRangeException IntegerDivisionByZeroExceptio
n NoMoreElementsException NoSuchMethodException NotImplementedException NullPoin
terException ObjectNotClosureException OutOfMemoryException StackOverflowExcepti
on UnsupportedOperationException WrongArgumentCountException |
| 30 syn keyword dartAssert assert | 34 syn keyword dartAssert assert |
| 31 syn keyword dartClassDecl extends implements interface | 35 syn keyword dartClassDecl extends implements interface |
| 32 " TODO(antonm): check if labels on break and continue are supported. | 36 " TODO(antonm): check if labels on break and continue are supported. |
| 33 syn keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhi
te | 37 syn keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhi
te |
| 34 syn keyword dartKeyword get set operator call equals negate | 38 syn keyword dartKeyword get set operator call equals negate |
| 35 syn match dartUserLabelRef "\k\+" contained | 39 syn match dartUserLabelRef "\k\+" contained |
| 36 syn match dartVarArg "\.\.\." | 40 syn match dartVarArg "\.\.\." |
| 37 | 41 |
| 38 " TODO(antonm): consider conditional highlighting of corelib classes. | 42 " TODO(antonm): consider conditional highlighting of corelib classes. |
| 39 | 43 |
| 40 syn region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>"
matchgroup=NONE end=":" | 44 syn region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>"
matchgroup=NONE end=":" |
| 41 syn keyword dartLabel default | 45 syn keyword dartLabel default |
| 42 | 46 |
| 43 " Comments | 47 " Comments |
| 44 syn keyword dartTodo contained TODO FIXME XXX | 48 syn keyword dartTodo contained TODO FIXME XXX |
| 45 syn region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLi
nk,@Spell | 49 syn region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLi
nk,@Spell |
| 46 syn match dartLineComment "//.*" contains=dartTodo,@Spell | 50 syn match dartLineComment "//.*" contains=dartTodo,@Spell |
| 47 syn match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell | 51 syn match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell |
| 48 syn region dartDocLink contained start=+\[+ end=+\]+ | 52 syn region dartDocLink contained start=+\[+ end=+\]+ |
| 49 | 53 |
| 50 " Strings | 54 " Strings |
| 51 syn region dartString start=+\z(["']\)+hs=s+1 end=+\z1+he=e-1 contains=@
Spell,dartInterpolation,dartSpecialChar | 55 syn region dartString start=+\z(["']\)+hs=s+1 end=+\z1+he=e-1 contains=@
Spell,dartInterpolation,dartSpecialChar |
| 52 syn region dartRawString start=+@\z(["']\)+hs=s+2 end=+\z1+he=e-1 contains=
@Spell | 56 syn region dartRawString start=+@\z(["']\)+hs=s+2 end=+\z1+he=e-1 contains=
@Spell |
| 53 syn match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" | 57 syn match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)" |
| 54 syn match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|
.\)" | 58 syn match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|
.\)" |
| 55 | 59 |
| 56 " Numbers | 60 " Numbers |
| 57 syn match dartNumber "\<\d\+\(\.\d\+\)\=\>" | 61 syn match dartNumber "\<\d\+\(\.\d\+\)\=\>" |
| 58 | 62 |
| 63 syn match dartInclude "^#\(import\|include\|source\|library\)(\(\"[^\"]\+
\"\|'[^']\+'\));" |
| 64 |
| 59 " The default highlighting. | 65 " The default highlighting. |
| 60 command! -nargs=+ HiLink hi def link <args> | 66 command! -nargs=+ HiLink hi def link <args> |
| 61 HiLink dartVarArg Function | 67 HiLink dartVarArg Function |
| 62 HiLink dartBranch Conditional | 68 HiLink dartBranch Conditional |
| 63 HiLink dartUserLabelRef dartUserLabel | 69 HiLink dartUserLabelRef dartUserLabel |
| 64 HiLink dartLabel Label | 70 HiLink dartLabel Label |
| 65 HiLink dartUserLabel Label | 71 HiLink dartUserLabel Label |
| 66 HiLink dartConditional Conditional | 72 HiLink dartConditional Conditional |
| 67 HiLink dartRepeat Repeat | 73 HiLink dartRepeat Repeat |
| 68 HiLink dartExceptions Exception | 74 HiLink dartExceptions Exception |
| (...skipping 10 matching lines...) Expand all Loading... |
| 79 HiLink dartLineComment Comment | 85 HiLink dartLineComment Comment |
| 80 HiLink dartLineDocComment Comment | 86 HiLink dartLineDocComment Comment |
| 81 HiLink dartConstant Constant | 87 HiLink dartConstant Constant |
| 82 HiLink dartTypedef Typedef | 88 HiLink dartTypedef Typedef |
| 83 HiLink dartTodo Todo | 89 HiLink dartTodo Todo |
| 84 HiLink dartKeyword Keyword | 90 HiLink dartKeyword Keyword |
| 85 HiLink dartType Type | 91 HiLink dartType Type |
| 86 HiLink dartInterpolation PreProc | 92 HiLink dartInterpolation PreProc |
| 87 HiLink dartDocLink SpecialComment | 93 HiLink dartDocLink SpecialComment |
| 88 HiLink dartSpecialChar SpecialChar | 94 HiLink dartSpecialChar SpecialChar |
| 95 HiLink dartInclude Include |
| 96 HiLink dartErrors Error |
| 97 HiLink dartCommonInterfaces Type |
| 98 HiLink dartInterfaces Type |
| 89 delcommand HiLink | 99 delcommand HiLink |
| 90 | 100 |
| 91 let b:current_syntax = "dart" | 101 let b:current_syntax = "dart" |
| 92 | 102 |
| 93 if main_syntax == 'dart' | 103 if main_syntax == 'dart' |
| 94 unlet main_syntax | 104 unlet main_syntax |
| 95 endif | 105 endif |
| 96 | 106 |
| 97 let b:spell_options="contained" | 107 let b:spell_options="contained" |
| 98 | 108 |
| 99 " Enable automatic indentation (2 spaces) | 109 " Enable automatic indentation (2 spaces) |
| 100 set expandtab | 110 set expandtab |
| 101 set shiftwidth=2 | 111 set shiftwidth=2 |
| 102 set softtabstop=2 | 112 set softtabstop=2 |
| 103 set cindent | 113 set cindent |
| OLD | NEW |