blob: d1c2bf215843bee8a0192c93aa94c86c651f2079 [file] [log] [blame]
Bram Moolenaar96f45c02019-10-26 19:53:45 +02001" Vim syntax file
2"
3" Language: Dart
4" Maintainer: Eugene 'pr3d4t0r' Ciurana <dart.syntax AT cime.net >
5" Source: https://github.com/pr3d4t0r/dart-vim-syntax
6" Last Update: 2019 Oct 19
7"
8" License: Vim is Charityware. dart.vim syntax is Charityware.
9" (c) Copyright 2019 by Eugene Ciurana / pr3d4t0r. Licensed
10" under the standard VIM LICENSE - Vim command :help uganda.txt
11" for details.
12"
13" Questions, comments: <dart.syntax AT cime.net>
14" https://ciurana.eu/pgp, https://keybase.io/pr3d4t0r
15"
16" vim: set fileencoding=utf-8:
17
18
19" Quit when a (custom) syntax file was already loaded
20if exists("b:current_syntax")
21 finish
22endif
23
24let s:cpo_save = &cpo
25set cpo&vim
26
27
28syn keyword dartCommentTodo contained TODO FIXME XXX TBD
29syn match dartLineComment "//.*" contains=dartTodo,@Spell
30syn match dartCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
31syn region dartComment start="/\*" end="\*/" contains=@Spell,dartTodo
32syn keyword dartReserved assert async await class const export extends external final hide import implements interface library mixin on show super sync yield
33syn match dartNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
34
35
36syn keyword dartBoolean false true
37syn keyword dartBranch break continue
38syn keyword dartConditional if else switch
39syn keyword dartException catch finally rethrow throw try
40syn keyword dartIdentifier abstract covariant deferred dynamic factory Function operator part static this typedef var
41syn keyword dartLabel case default
42syn keyword dartNull null
43syn keyword dartOperator is new
44syn keyword dartRepeat for do in while
45syn keyword dartStatement return with
46syn keyword dartType bool double enum int String StringBuffer void
47syn keyword dartTodo contained TODO FIXME XXX
48
49
50syn match dartEscape contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)"
51syn match dartSpecialError contained "\\."
52syn match dartStrInterpol contained "\${[\x, _]*\}"
53
54syn region dartDQString start=+"+ end=+"+ end=+$+ contains=dartEscape,dartStrInterpol,dartSpecialError,@Spell
55syn region dartSQString start=+'+ end=+'+ end=+$+ contains=dartEscape,dartStrInterpol,dartSpecialError,@Spell
56
57syn match dartBraces "[{}\[\]]"
58syn match dartParens "[()]"
59
60
61syn sync fromstart
62syn sync maxlines=100
63
64
65hi def link dartBoolean Boolean
66hi def link dartBranch Conditional
67hi def link dartComment Comment
68hi def link dartConditional Conditional
69hi def link dartDQString String
70hi def link dartEscape SpecialChar
71hi def link dartException Exception
72hi def link dartIdentifier Identifier
73hi def link dartLabel Label
74hi def link dartLineComment Comment
75hi def link dartNull Keyword
76hi def link dartOperator Operator
77hi def link dartRepeat Repeat
78hi def link dartReserved Keyword
79hi def link dartSQString String
80hi def link dartSpecialError Error
81hi def link dartStatement Statement
82hi def link dartStrInterpol Special
83hi def link dartTodo Todo
84hi def link dartType Type
85
86
87let b:current_syntax = "dart"
88let &cpo = s:cpo_save
89unlet s:cpo_save
90