Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 " Vim syntax file " Language: Dart | 1 " Vim syntax file " Language: Dart |
| 2 " Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 " Copyright (c) 2011, 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 while for | 20 syn keyword dartRepeat 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 |
| 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 const bool int double num |
| 27 syn keyword dartStatement return | 27 syn keyword dartStatement return |
| 28 syn keyword dartStorageClass static final abstract | 28 syn keyword dartStorageClass static final abstract |
| 29 syn keyword dartExceptions throw try catch finally | 29 syn keyword dartExceptions throw try catch finally |
| 30 syn keyword dartAssert assert | 30 syn keyword dartAssert assert |
| 31 syn keyword dartClassDecl extends implements interface | 31 syn keyword dartClassDecl extends implements interface |
| 32 " TODO(antonm): check if labels on break and continue are supported. | 32 " TODO(antonm): check if labels on break and continue are supported. |
| 33 syn keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhi te | 33 syn keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhi te |
| 34 syn keyword dartKeyword function get set | 34 syn keyword dartKeyword function get set |
| 35 syn match dartUserLabelRef "\k\+" contained | 35 syn match dartUserLabelRef "\k\+" contained |
| 36 syn match dartVarArg "\.\.\." | 36 syn match dartVarArg "\.\.\." |
| 37 | 37 |
| 38 " TODO(antonm): consider conditional highlighting of corelib classes. | 38 " TODO(antonm): consider conditional highlighting of corelib classes. |
| 39 | 39 |
| 40 syn region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":" | 40 syn region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":" |
| 41 syn keyword dartLabel default | 41 syn keyword dartLabel default |
| 42 | 42 |
| 43 " Comments | 43 " Comments |
| 44 syn keyword dartTodo contained TODO FIXME XXX | 44 syn keyword dartTodo contained TODO FIXME XXX |
| 45 syn region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLi nk,@Spell | 45 syn region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLi nk,@Spell |
| 46 syn match dartLineComment "//.*" contains=dartTodo,@Spell | 46 syn match dartLineComment "//.*" contains=dartTodo,@Spell |
| 47 syn region dartDocLink contained start=+\[+ end=+\]+ | 47 syn region dartDocLink contained start=+\[+ end=+\]+ |
| 48 | 48 |
| 49 " Strings | 49 " Strings |
| 50 syn region dartString start=+"+ end=+"+ contains=@Spell,dartInterpolation ,dartSpecialChar | 50 syn region dartString start=+"+ end=+"+ contains=@Spell,dartInterpolation ,dartSpecialChar |
| 51 syn region dartString start=+'+ end=+'+ contains=@Spell,dartInterpolation ,dartSpecialChar | 51 syn region dartString start=+'+ end=+'+ contains=@Spell,dartInterpolation ,dartSpecialChar |
| 52 syn match dartInterpolation contained "\$\(\w+\|{\w\+}\)" | 52 syn match dartInterpolation contained "\$\(\w\+\|{[^\}]\+}\)" |
|
Anton Muhin
2011/10/31 17:51:31
not sure it's properly handled by implementations,
| |
| 53 syn match dartSpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf ]\|u\x\{4\}\)" | 53 syn match dartSpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf ]\|u\x\{4\}\)" |
| 54 | 54 |
| 55 " Numbers | 55 " Numbers |
| 56 syn match dartNumber "\<\d\+\(\.\d\+\)\=\>" | 56 syn match dartNumber "\<\d\+\(\.\d\+\)\=\>" |
| 57 | 57 |
| 58 " The default highlighting. | 58 " The default highlighting. |
| 59 command! -nargs=+ HiLink hi def link <args> | 59 command! -nargs=+ HiLink hi def link <args> |
| 60 HiLink dartVarArg Function | 60 HiLink dartVarArg Function |
| 61 HiLink dartBranch Conditional | 61 HiLink dartBranch Conditional |
| 62 HiLink dartUserLabelRef dartUserLabel | 62 HiLink dartUserLabelRef dartUserLabel |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 85 HiLink dartSpecialChar SpecialChar | 85 HiLink dartSpecialChar SpecialChar |
| 86 delcommand HiLink | 86 delcommand HiLink |
| 87 | 87 |
| 88 let b:current_syntax = "dart" | 88 let b:current_syntax = "dart" |
| 89 | 89 |
| 90 if main_syntax == 'dart' | 90 if main_syntax == 'dart' |
| 91 unlet main_syntax | 91 unlet main_syntax |
| 92 endif | 92 endif |
| 93 | 93 |
| 94 let b:spell_options="contained" | 94 let b:spell_options="contained" |
| OLD | NEW |