-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdart-mode.el
722 lines (635 loc) · 24.4 KB
/
dart-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
;;; dart-mode.el --- Major mode for editing Dart files -*- lexical-binding: t; -*-
;; Copyright (C) 2011-2018 Google Inc.
;; Copyright (C) 2018-2023 Brady Trainor
;; Author: Brady Trainor
;; Maintainer: Jen-Chieh Shen <jcs090218@gmail.com>
;; URL: https://github.com/emacsorphanage/dart-mode
;; Version: 1.0.7
;; Package-Requires: ((emacs "27.1"))
;; Keywords: languages
;;; About the previous implementation:
;; To a not fully determined extend, this implementation derives from an
;; earlier implementation by Natalie Weizenbaum, for which the copyright
;; holder is Google.
;; In the discussion attached to [1], Brady Trainor implicitly repeats
;; his claim, that no code from that earlier implementation remains.
;; This seems plausible, but, as mentioned in that discussion, would have
;; to be studied in more detail, to be absolutely certain, which is why I
;; am restoring Google's copyright notice.
;; [1]: https://github.com/emacsorphanage/dart-mode/commit/69d7c23be7518bcb004860120ba3ea2a7dcfb6de
;; Bradly Trainor added the below statement in 2021. It is preserved
;; unchanged:
;; The author is Brady Trainor, but removed from keywords in attempt
;; to avoid some class of robots.
;; Honorable mention to previous author, maintainer and
;; contributors. Please see git history for significant
;; contributions. They are mostly gone from the current repo, replaced
;; or split out to dart-server repo. Most of the Github stars are from
;; previous management. The mistakes and regressions in the rewrite
;; below are my own. The previous implementation was done with cc-mode
;; framework. Let me know if you think it should be added back as an
;; option.
;;; Commentary:
;; This package implements a major-mode for the Dart language,
;; providing basic syntax highlighting and indentation support.
;;; Code:
;;; Configuration
(defvar dart-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<backtab>") #'dart-dedent-simple)
(define-key map (kbd "C-c C-i") #'indent-according-to-mode)
map)
"Keymap used in dart-mode buffers.")
;;; Indentation
(defcustom dart-indent-trigger-commands
'(indent-for-tab-command yas-expand yas/expand dart-dedent-simple)
"Commands that might trigger a `dart-indent-line' call."
:type '(repeat symbol)
:group 'dart)
(defun dart-indent-line-function ()
"`indent-line-function' for Dart mode.
When the variable `last-command' is equal to one of the symbols
inside `dart-indent-trigger-commands' it cycles possible
indentation levels from right to left."
(if (and (memq this-command dart-indent-trigger-commands)
(eq last-command this-command))
(dart-indent-simple)
(dart-indent-line-relative)))
(defun dart-indent-simple (&optional backwards)
(interactive)
(save-excursion
(indent-line-to
(max 0 (indent-next-tab-stop (current-indentation) backwards))))
(when (< (current-column) (current-indentation))
(back-to-indentation)))
(defun dart-dedent-simple ()
(interactive)
(dart-indent-simple 'backwards))
(defun dart-depth-of-line ()
(save-excursion
(back-to-indentation)
(let ((depth (car (syntax-ppss))))
(when (and (char-after)
(= (char-syntax (char-after)) ?\)))
(while (and (char-after)
(/= (char-syntax (char-after)) ?\()
(/= (char-after) ?\C-j))
(when (= (char-syntax (char-after)) ?\))
(setq depth (1- depth)))
(forward-char)))
depth)))
(defun dart-indent-line-relative ()
(let ((curr-depth (dart-depth-of-line))
prev-line
prev-depth
prev-indent)
(save-excursion
(beginning-of-line)
(catch 'done
(while t
(when (= (point) 1)
(throw 'done t))
(forward-line -1)
(unless (looking-at (rx (and bol (zero-or-more space) eol)))
(setq prev-line t)
(setq prev-indent (current-indentation))
(setq prev-depth (dart-depth-of-line))
(throw 'done t)))))
(save-excursion
(if prev-line
(indent-line-to (max 0 (+ prev-indent
(* (- curr-depth prev-depth)
tab-width))))
(indent-line-to 0)))
(when (< (current-column) (current-indentation))
(back-to-indentation))))
;;; Fontification
(defvar dart--file-directives
'("as"
"deferred"
"export"
"hide"
"import"
"library"
"of"
"part"
"show"))
(defvar dart--builtins
;; ECMA 408; Section: Identifier Reference
;; "Built-in identifiers"
'("abstract"
"as"
"covariant"
"deferred"
"dynamic"
"export"
"extension"
"external"
"factory"
"Function"
"get"
"implements"
"import"
"interface"
"late"
"library"
"mixin"
"operator"
"part"
"required"
"set"
"static"
"typedef"))
(defvar dart--keywords
;; ECMA 408; Section: Reserved Words
'("assert"
"break"
"case"
"catch"
"class"
"const"
"continue"
"default"
"do"
"else"
"enum"
"extends"
"final"
"finally"
"for"
"if"
"in"
"is"
"new"
"rethrow"
"return"
"super"
"switch"
"this"
"throw"
"try"
"var"
"while"
"with"))
(defvar dart--types
'("bool"
"double"
"int"
"num"
"void"))
(defvar dart--constants
'("false"
"null"
"true"))
(defvar dart--async-keywords-re
(rx word-start
(or "async" "await" "sync" "yield")
word-end
(zero-or-one ?*)))
;; https://dart.dev/guides/language/specifications/DartLangSpec-v2.10.pdf
;; 17.5 Numbers
(defvar dart--numeric-literal-re
(rx-let
((numeric-literal (| number hex-number))
(number (: (| (: (1+ digit) (? (: ?. (1+ digit))))
(: ?. (1+ digit)))
(? exponent)))
(exponent (: (| ?e ?E)
(? (| ?+ ?-))
(1+ digit)))
(hex-number (: ?0 (| ?x ?X) (1+ hex-digit))))
(rx bow numeric-literal eow)))
(defvar dart--operator-declaration-re
(rx "operator"
(one-or-more space)
(group
(one-or-more (not (any ?\())))))
(eval-and-compile
(defun dart--identifier (&optional case)
`(and (or word-start symbol-start)
(zero-or-more (any ?$ ?_))
,(if case
case
'alpha)
(zero-or-more (or ?$ ?_ alnum)))))
(defvar dart--metadata-re (rx ?@ (eval (dart--identifier))))
(defvar dart--types-re (rx (eval (dart--identifier 'upper))))
(defvar dart--constants-re (rx (and word-start
upper
(>= 2 (or upper ?_))
word-end)))
(defun dart--string-interpolation-id-func (limit)
"Font-lock matcher for string interpolation identifiers.
These have the form $variableName.
Can fontify entire match with group 0, or using group 1 for sigil,
group 2 for variableName."
(catch 'result
(let (data end syntax)
(while (re-search-forward (rx (group ?$)
(group (zero-or-more ?_)
lower
(zero-or-more (or ?_ alnum))))
limit t)
(setq data (match-data))
(setq end (match-end 2))
(setq syntax (syntax-ppss))
;; Check that we are in a string and not in a raw string
(when (and (nth 3 syntax)
(or (= (nth 8 syntax) 1)
(not (eq (char-before (nth 8 syntax)) ?r))))
(set-match-data data)
(goto-char end)
(throw 'result t))
(when end
(goto-char end)))
(throw 'result nil))))
(defun dart--string-interpolation-exp-func (limit)
"Font-lock matcher for string interpolation expressions.
These have the form ${expression}.
Can fontify entire match with group 0, or using group 1 for sigil,
groups 2 and 4 for curly brackets, and 3 for contents."
(catch 'result
(let (sigil beg open close end depth)
;; Loop and put point after ${
(while (and (search-forward "${" limit t)
;; Check that we are in a string and not in a raw string
(save-excursion
(and (nth 3 (syntax-ppss))
(not (eq (char-before (nth 8 (syntax-ppss))) ?r)))))
;; "a string with ${someInterpolation + aValue} inside of it."
;; ^^^ ^^
;; ||| ||
;; sigil -+|+- open close -++- end
;; +- beg
(setq open (point))
(setq beg (- open 1))
(setq sigil (- open 2))
(setq depth 1)
;; Move forward until limit, while depth is positive and we
;; are inside string.
(while (and (> depth 0)
(< (point) limit)
(nth 3 (syntax-ppss)))
(setq depth (+ depth (pcase (char-after)
(?\{ 1)
(?\} -1)
(_ 0))))
(forward-char))
(setq end (point))
;; If depth is zero, we have found a closing } within string
;; and before limit. Set `match-data', `point', and return `t'.
(when (= depth 0)
(setq close (1- end))
(set-match-data (list sigil end
sigil beg
beg open
open close
close end))
(goto-char end)
(throw 'result t))
;; If the candidate did not meet criteria, put point at end
;; and search again.
(goto-char end))
;; When there are no more candidate "${", return nil.
(throw 'result nil))))
(defun dart--function-declaration-func (limit)
"Font-lock matcher function for function declarations.
Matches function declarations before LIMIT that look like,
\"lowercaseIdentifier([...]) [[a]sync[*], {, =>]\"
For example, \"main\" in \"void main() async\" would be matched."
(catch 'result
(let (beg end)
(while (re-search-forward
(rx (group (eval (dart--identifier 'lower))) ?\() limit t)
(setq beg (match-beginning 1))
(setq end (match-end 1))
(condition-case nil
(progn
(up-list)
(when (looking-at (rx (one-or-more space)
(or "async" "async*" "sync*" "{" "=>")))
(set-match-data (list beg end))
(goto-char end)
(throw 'result t)))
(scan-error nil))
(goto-char end))
(throw 'result nil))))
(defun dart--abstract-method-func (limit)
"Font-lock matcher function for abstract methods.
Matches function declarations before LIMIT that look like,
\" [^ ][^=]* lowercaseIdentifier([...]);\"
For example, \"compareTo\" in \" int compareTo(num other);\" would be
matched."
(catch 'result
(let (beg end)
(while (re-search-forward
(rx (and (not (any ?\.)) (group (eval (dart--identifier 'lower))))
?\()
limit t)
(setq beg (match-beginning 1))
(setq end (match-end 1))
(condition-case nil
(progn
(up-list)
(when (and (< (point) (point-max))
(= (char-after (point)) ?\;))
(goto-char beg)
(back-to-indentation)
(when (and (= (current-column) 2)
(not (looking-at "return"))
(string-match-p
" " (buffer-substring-no-properties
(point) beg))
(not (string-match-p
"=" (buffer-substring-no-properties
(point) beg))))
(goto-char end)
(set-match-data (list beg end))
(throw 'result t))))
(scan-error nil))
(goto-char end)))
(throw 'result nil)))
(defun dart--declared-identifier-func (limit)
"Font-lock matcher function for declared identifiers.
Matches declared identifiers before LIMIT that look like,
\"finalConstVarOrType lowercaseIdentifier\"
For example, \"height\" in \"const int height\" would be matched."
(catch 'result
(let (beg end)
(while (re-search-forward
(rx
(and (group (or (or "const" "final"
"bool" "double" "dynamic" "int" "num" "void"
"var"
"get" "set")
(eval (dart--identifier 'upper)))
(zero-or-more ?>))
(one-or-more (or space ?\C-j))
(group (eval (dart--identifier 'lower)))
(not (any ?\( alnum ?$ ?_))))
limit t)
(setq beg (match-beginning 2))
(setq end (match-end 2))
;; Check for false positives
(when (not (member (match-string 2)
'("bool" "double" "dynamic" "int" "num" "void"
"var"
"get" "set")))
(goto-char end)
(unless (nth 3 (syntax-ppss))
(set-match-data (list beg end))
(throw 'result t)))
(goto-char (match-end 1)))
(throw 'result nil))))
(defun dart--in-parenthesized-expression-or-formal-parameter-list-p ()
"Returns `t' if `point' is in parentheses, otherwise `nil'.
In particular, parenthesized expressions or formal parameter lists."
(save-excursion
(catch 'result
;; Attempt to jump out of parentheses.
(condition-case nil
(backward-up-list)
(scan-error (throw 'result nil)))
;; If we've only jumped out of optional or named section of
;; formal parameters, try to jump again.
(when (member (char-after (point)) '(?\[ ?\{))
(condition-case nil
(backward-up-list)
(scan-error (throw 'result nil))))
(throw 'result (= (char-after (point)) ?\()))))
(defun dart--declared-identifier-anchor-func (limit)
"Font-lock matcher for declared identifier.
Uses `dart--declared-identifier-func' to find candidates before
LIMIT, and checks that they are not in parentheses.
This matcher is an anchor to match multiple identifiers in a
single variable declaration. From ECMA-408,
variableDeclaration:
declaredIdentifier (', ' identifier)*
;
After this function sets anchor, font-lock will use the function
`dart--declared-identifier-next-func' to find subsequent
identifiers."
(catch 'result
(let (data)
(while (dart--declared-identifier-func limit)
(setq data (match-data))
(unless (dart--in-parenthesized-expression-or-formal-parameter-list-p)
(set-match-data data)
(goto-char (match-end 0))
(throw 'result t))
(goto-char (match-end 0)))
(throw 'result nil))))
(defun dart--declared-identifier-next-func (limit)
"Font-lock matcher for subsequent identifiers.
For use after `dart--declared-identifier-anchor-func' sets
anchor, this function will look for subsequent identifers to
fontify as declared variables. From ECMA-408,
variableDeclaration:
declaredIdentifier (', ' identifier)*
;"
(catch 'result
(let ((depth (car (syntax-ppss))))
(while t
(cond
;; If point is followed by semi-colon, we are done.
((or (> (point) limit)
(null (char-after (point)))
(= (char-after (point)) ?\;)
(< (car (syntax-ppss)) depth))
(throw 'result nil))
;; If point is followed by comma, and we are still at same
;; depth, then attempt to match another identifier, otherwise
;; return nil.
((and (= (char-after (point)) ?\x2c) ; ?,
(= (car (syntax-ppss)) depth))
(if (looking-at (rx ?\x2c
(one-or-more space)
(group (eval (dart--identifier 'lower)))))
(progn (set-match-data (list (match-beginning 1)
(match-end 1)))
(goto-char (match-end 0))
(throw 'result t))
(throw 'result nil)))
;; Otherwise, if we are still before `point-max' (shouldn't
;; this be `limit'? May be a bad attempt to deal with
;; multiline searches. Should research how this is done with
;; font-lock.), move forward.
((< (point) (point-max))
(forward-char))
;; Otherwise, return nil.
(t (throw 'result nil)))))))
(defun dart--anonymous-function-matcher (limit)
"Font-lock matcher for start of anonymous functions.
Looks for opening parenthesis, tries to jump to opening
parenthesis, ensure it is not preceded by for, while, etc. Then
tries to jump to closing parenthesis and check if followed by \"
{\" or \" =>\".
Used with `dart--untyped-parameter-anchored-matcher' to fontify
untyped parameters. For example, in
(untypedParameter) => untypedParameter.length"
(catch 'result
(let (beg end)
(while (search-forward "(" limit t)
(setq beg (match-beginning 0))
(setq end (match-end 0))
(unless (looking-back (rx (or (and (or "do" "for" "if" "switch" "while")
space)
"super")
?\()
(point-at-bol))
(condition-case nil
(up-list)
(scan-error (throw 'result nil)))
(when (looking-at (rx space (or ?\{ "=>")))
(set-match-data (list beg end))
(goto-char end)
(throw 'result t))
(goto-char end)))
(throw 'result nil))))
(defun dart--untyped-parameter-anchored-matcher (limit)
"Font-lock anchored-matcher for untyped parameters.
Searches forward for for lowercase idenitifer and ensures depth
is still same.
Used with `dart--anonymous-function-matcher' to fontify
untyped parameters. For example, in
(untypedParameter) => untypedParameter.length"
(let (beg end)
(catch 'result
(if (equal (char-after) ?\))
(throw 'result nil))
(let ((depth (car (syntax-ppss))))
(while (re-search-forward
(rx (and (group (or (one-or-more (char ?_))
(eval (dart--identifier 'lower))))
(or ?, ?\)))))
(setq beg (match-beginning 1))
(setq end (match-end 1))
(goto-char end)
(if (or (> (point) limit)
(< (car (syntax-ppss)) depth))
(throw 'result nil)
(set-match-data (list beg end))
(throw 'result t))))
(throw 'result nil))))
(defun dart--get-point-at-end-of-list ()
(let (pt)
(save-excursion
(up-list)
(setq pt (point)))
pt))
(defvar dart-font-lock-defaults
'((dart-font-lock-keywords-1 dart-font-lock-keywords-1
dart-font-lock-keywords-2
dart-font-lock-keywords-3)))
(defvar dart-font-lock-keywords-1
`((,(regexp-opt dart--file-directives 'words) . font-lock-builtin-face)
(dart--function-declaration-func . font-lock-function-name-face)
(,dart--operator-declaration-re . (1 font-lock-function-name-face))
(dart--abstract-method-func . font-lock-function-name-face)))
(defvar dart-font-lock-keywords-2
`(,dart--async-keywords-re
,(regexp-opt dart--keywords 'words)
(,(regexp-opt dart--builtins 'words) . font-lock-builtin-face)
(,(regexp-opt dart--constants 'words) . font-lock-constant-face)
(,dart--numeric-literal-re . font-lock-constant-face)
(,dart--metadata-re . font-lock-constant-face)
(,dart--constants-re . font-lock-constant-face)
(,(regexp-opt dart--types 'words) . font-lock-type-face)
(,dart--types-re . font-lock-type-face)
(dart--function-declaration-func . font-lock-function-name-face)
(,dart--operator-declaration-re . (1 font-lock-function-name-face))
(dart--abstract-method-func . font-lock-function-name-face)))
(defvar dart-font-lock-keywords-3
(append
dart-font-lock-keywords-2
`((dart--declared-identifier-func . font-lock-variable-name-face)
(dart--declared-identifier-anchor-func
. (dart--declared-identifier-next-func
nil
nil
(0 font-lock-variable-name-face)))
(dart--anonymous-function-matcher
. (dart--untyped-parameter-anchored-matcher
(dart--get-point-at-end-of-list)
nil
(0 font-lock-variable-name-face)))
(dart--string-interpolation-id-func (0 font-lock-variable-name-face t))
(dart--string-interpolation-exp-func (0 font-lock-variable-name-face t)))))
(defun dart-syntax-propertize-function (beg end)
"Sets syntax-table text properties for raw and/or multiline strings.
We use fences uniformly for consistency.
In raw strings, we modify backslash characters to have punctuation
syntax rather than escape syntax.
String interpolation is not handled correctly yet, but the fixes to
quote characters in multiline strings, and escape characters in raw
strings, ensures that code outside of strings is not highlighted as
strings."
(goto-char beg)
;; We rely on syntax-propertize-extend-region-functions that `beg`
;; will be at beginning of line, but we ensure here that we are not
;; in a string
(while (nth 3 (syntax-ppss))
(goto-char (nth 8 (syntax-ppss)))
(beginning-of-line))
;; Search for string opening
(while (re-search-forward (rx (group (optional ?r))
(group (or (repeat 3 ?\")
(repeat 3 ?\')
?\"
?\')))
end t)
(let ((bos (match-beginning 2))
(rawp (equal (match-string-no-properties 1) "r"))
(string-delimiter (match-string-no-properties 2)))
;; Set string fence syntax at beginning of string
(put-text-property bos (1+ bos) 'syntax-table (string-to-syntax "|") nil)
;; Look for the end of string delimiter, depending on rawp and
;; string-delimiter
;; Unless rawp, ensure an even number of backslashes
(when (or (looking-at (concat (unless rawp (rx (zero-or-more ?\\ ?\\)))
string-delimiter))
(re-search-forward (concat (unless rawp
(rx (not (any ?\\))
(zero-or-more ?\\ ?\\)))
string-delimiter)
end t))
(let ((eos (match-end 0)))
;; Set end of string fence delimiter
(put-text-property (1- eos) eos 'syntax-table (string-to-syntax "|"))
;; For all strings, remove fence property between fences
;; For raw strings, set all backslashes to punctuation syntax
(dolist (pt (number-sequence (1+ bos) (- eos 2)))
(when (equal (get-text-property pt 'syntax-table)
(string-to-syntax "|"))
(remove-text-properties pt (1+ pt) 'syntax-table))
(when (and rawp (equal (char-after pt) ?\\))
(put-text-property pt (1+ pt) 'syntax-table
(string-to-syntax ".") nil)))
(goto-char eos))))))
;;; Initialization
;;;###autoload (add-to-list 'auto-mode-alist '("\\.dart\\'" . dart-mode))
;;;###autoload
(define-derived-mode dart-mode prog-mode "Dart"
"Major mode for editing Dart files.
The hook `dart-mode-hook' is run with no args at mode
initialization.
Key bindings:
\\{dart-mode-map}"
(modify-syntax-entry ?/ "_ 124b")
(modify-syntax-entry ?* ". 23")
(modify-syntax-entry ?\n "> b")
(modify-syntax-entry ?\' "\"")
(modify-syntax-entry ?\> ".")
(modify-syntax-entry ?\< ".")
(setq-local electric-indent-chars '(?\n ?\) ?\] ?\}))
(setq electric-indent-inhibit t)
(setq-local comment-start "//")
(setq-local comment-end "")
(setq fill-column 80)
(setq font-lock-defaults dart-font-lock-defaults)
(setq-local indent-line-function 'dart-indent-line-function)
(setq indent-tabs-mode nil)
(setq tab-width 2)
(setq-local syntax-propertize-function 'dart-syntax-propertize-function))
(provide 'dart-mode)
;;; dart-mode.el ends here