@@ -1,9 +1,9 @@
11<?xml version="1.0" encoding="UTF-8"?>
22<syntax name="haskell">
33 <meta>
4− <name>Haskell</name>
5− <type>compiled</type>
6− <preferred-file-extension>hs</preferred-file-extension>
4+ <name>Haskell</name>
5+ <type>compiled</type>
6+ <preferred-file-extension>hs</preferred-file-extension>
77 </meta>
88
99 <detectors>
@@ -57,7 +57,6 @@
5757 <include syntax="self" collection="type-family-definition" />
5858 <include syntax="self" collection="pattern-definition" />
5959 <include syntax="self" collection="type-definition" />
60− <!-- <include syntax="self" collection="type-annotation" /> -->
6160 <include syntax="self" collection="GADT-definition" />
6261 <include syntax="self" collection="instance" />
6362 <include syntax="self" collection="typeclass" />
@@ -66,7 +65,6 @@
6665
6766 <template-scopes>
6867 <include syntax="self" collection="Quote" />
69− <include syntax="self" collection="comments" />
7068 </template-scopes>
7169
7270 <collections>
@@ -79,7 +77,16 @@
7977 </collection>
8078
8179 <collection name="expressions">
82− <include syntax="self" collection="do-bind" />
80+ <scope name="haskell.construct.keyword.at">
81+ <expression>@</expression>
82+ </scope>
83+ <scope name="haskell.construct.keyword.case-arrow">
84+ <expression>-></expression>
85+ </scope>
86+ <scope name="haskell.construct.keyword.bind-arrow">
87+ <expression><-</expression>
88+ </scope>
89+ <include syntax="self" collection="keywords" />
8390 <include syntax="self" collection="literal" />
8491 <include syntax="self" collection="operators" />
8592 <include syntax="self" collection="record-match" />
@@ -87,33 +94,12 @@
8794 <include syntax="self" collection="view-pattern" />
8895 <include syntax="self" collection="lambda-case" />
8996 <include syntax="self" collection="lambda-head" />
90− <include syntax="self" collection="type-applications" />
91− <include syntax="self" collection="outer-case-expression" />
97+ <include syntax="self" collection="case-expression" />
9298 <include syntax="self" collection="qconid" />
9399 <include syntax="self" collection="qvarid" />
94100 <include syntax="self" collection="tuple" />
95101 </collection>
96102
97− <collection name="type-applications">
98− <scope name="type-applications">
99− <starts-with>
100− <expression>(\s@)\(</expression>
101− <capture number="1" name="haskell.keyword.operator.typeapplication" />
102− </starts-with>
103− <ends-with>
104− <expression>)</expression>
105− </ends-with>
106− <subscopes>
107− <include syntax="self" collection="type" />
108− </subscopes>
109− </scope>
110− <scope name="type-applications-single">
111− <expression>(@)(\w+)</expression>
112− <capture number="1" name="haskell.keyword.operator.typeapplication" />
113− <capture number="2" name="haskell.identifier.type" />
114− </scope>
115− </collection>
116−
117103 <collection name="Quote">
118104 <scope name="haskell.quasiquote.string-template">
119105 <starts-with>
@@ -150,6 +136,7 @@
150136 <capture number="1" name="haskell.pattern.record.bracket" />
151137 </ends-with>
152138 <subscopes>
139+ <include syntax="self" collection="comments" />
153140 <include syntax="self" collection="expressions" />
154141 <scope name="record-sep">
155142 <expression>=</expression>
@@ -172,6 +159,7 @@
172159 <capture number="1" name="haskell.pattern.record.bracket" />
173160 </ends-with>
174161 <subscopes>
162+ <include syntax="self" collection="comments" />
175163 <scope name="haskell.pattern.record.wildcard">
176164 <expression>\.\.</expression>
177165 </scope>
@@ -198,6 +186,7 @@
198186 <capture number="1" name="haskell.list.bracket" />
199187 </ends-with>
200188 <subscopes>
189+ <include syntax="self" collection="comments" />
201190 <include syntax="self" collection="expressions" />
202191 </subscopes>
203192 </scope>
@@ -240,48 +229,6 @@
240229 </scope>
241230 </collection>
242231
243− <collection name="case-match">
244− <scope name="case-match">
245− <starts-with>
246− <expression>(?=((\h*)\S.*->($|\h)))</expression>
247− </starts-with>
248− <ends-with>
249− <expression>-></expression>
250− </ends-with>
251− <subscopes anchored="true">
252− <include syntax="self" collection="expressions" />
253− </subscopes>
254− </scope>
255− </collection>
256−
257− <collection name="inner-case-expressions">
258− <scope name="inner-case-expressions">
259− <starts-with>
260− <expression>(?=((\h*)\S.*->($|\h)))</expression>
261− </starts-with>
262− <ends-with>
263− <template>^(?!\1)(?!\2\h)(?!\s*$)</template>
264− </ends-with>
265− <subscopes anchored="true" skip-whitespace="false">
266− <include syntax="self" collection="case-match" />
267− <include syntax="self" collection="expressions" />
268− </subscopes>
269− </scope>
270− </collection>
271−
272− <collection name="outer-case-expression">
273− <scope name="outer-case-expression">
274− <starts-with>
275− <expression>(?=case)</expression>
276− </starts-with>
277− <ends-with />
278− <subscopes anchored="true" skip-whitespace="false">
279− <include syntax="self" collection="case-expression" />
280− <include syntax="self" collection="inner-case-expressions" repeat="true" />
281− </subscopes>
282− </scope>
283− </collection>
284−
285232 <collection name="tuple">
286233 <symbol type="expression" />
287234 <scope name="haskell.tuple">
@@ -294,73 +241,73 @@
294241 <capture number="1" name="haskell.tuple.bracket" />
295242 </ends-with>
296243 <subscopes>
244+ <include syntax="self" collection="comments" />
297245 <include syntax="self" collection="expressions" />
298246 </subscopes>
299247 </scope>
300248 </collection>
301249
302250 <collection name="typeclass">
303− <symbol type="interface" />
304− <scope name="haskell.definition.class">
251+ <scope name="haskell.definition.class.head">
252+ <symbol type="class" scope="global" name-selector="haskell.keyword.construct.class.name">
253+ <context behavior="whitespace" foldable="true" />
254+ </symbol>
305255 <starts-with>
306256 <expression>^(\h*)(class)($|\h)</expression>
307257 <capture number="2" name="haskell.keyword.construct.class" />
308258 </starts-with>
309− <ends-with>
310− <template>^(?!\s+\1\S)(?!\s*$)</template>
311− </ends-with>
312− <subscopes>
313− <scope name="haskell.keyword.construct.where">
259+ <ends-with />
260+ <subscopes anchored="true">
261+ <scope name="haskell.keyword.construct.class.name">
262+ <starts-with>
263+ <expression></expression>
264+ </starts-with>
265+ <ends-with>
266+ <expression>(?=(where|^\s*$))</expression>
267+ </ends-with>
268+ <subscopes>
269+ <include syntax="self" collection="comments" />
270+ <include syntax="self" collection="type" />
271+ </subscopes>
272+ </scope>
273+ <scope name="haskell.keyword.construct.where" optional="true">
314274 <expression>where</expression>
315275 </scope>
316− <include syntax="self" collection="type" />
317− <include syntax="self" collection="type-definition" />
318− <!-- <include syntax="self" collection="type-annotation" /> -->
319− <include syntax="self" collection="definition" />
320276 </subscopes>
321277 </scope>
322278 </collection>
323279
324280 <collection name="instance">
325281 <scope name="haskell.instance">
326− <symbol type="category">
282+ <symbol type="category" name-selector="haskell.keyword.construct.instance.name">
327283 <context behavior="whitespace" foldable="true" />
328284 </symbol>
329285 <starts-with>
330286 <expression>^(\h*)(instance)($|\h)</expression>
331287 <capture number="2" name="haskell.keyword.construct.instance" />
332288 </starts-with>
333− <ends-with>
334− <template>^(?!\s+\1\S)(?!\s*$)</template>
335− </ends-with>
336− <subscopes anchored="true" skip-whitespace="false">
337− <scope name="haskell.construct.instance.head">
289+ <ends-with />
290+ <subscopes anchored="true">
291+ <scope name="haskell.keyword.construct.instance.name">
338292 <starts-with>
339293 <expression></expression>
340294 </starts-with>
341295 <ends-with>
342− <expression>where</expression>
343− <capture number="0" name="haskell.keyword.construct.where" />
296+ <expression>(?=(where|^\s*$))</expression>
344297 </ends-with>
345298 <subscopes>
346− <include syntax="self" collection="type" optional="true" repeat="true" />
299+ <include syntax="self" collection="type" />
347300 </subscopes>
348301 </scope>
349− <include syntax="self" collection="instance-body" />
302+ <scope name="haskell.keyword.construct.where" optional="true">
303+ <expression>where</expression>
304+ </scope>
350305 </subscopes>
351306 </scope>
352307 </collection>
353308
354− <collection name="instance-body">
355− <include syntax="self" collection="definition" />
356− <include syntax="self" collection="type-definition" />
357− </collection>
358−
359309 <collection name="type-family-definition">
360310 <scope name="haskell.definition.type-family.type">
361− <symbol type="type" scope="global">
362− <context behavior="subtree" foldable="false" />
363− </symbol>
364311 <starts-with>
365312 <expression>^(\h*)(type\h+family)</expression>
366313 <capture number="2" name="haskell.keyword.construct.type-family" />
@@ -399,6 +346,7 @@
399346 <template>^(?!\s+\1\S)(?!\s*$)</template>
400347 </ends-with>
401348 <subscopes>
349+ <include syntax="self" collection="comments" />
402350 <include syntax="self" collection="type" optional="true" repeat="true" />
403351 <scope>
404352 <expression>=</expression>
@@ -410,7 +358,7 @@
410358
411359 <collection name="definition">
412360 <scope name="haskell.definition.type.function">
413− <symbol type="function" scope="local">
361+ <symbol type="function">
414362 <context behavior="whitespace" foldable="true" />
415363 </symbol>
416364 <starts-with>
@@ -422,35 +370,15 @@
422370 <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
423371 </ends-with>
424372 <subscopes>
373+ <include syntax="self" collection="comments" />
425374 <include syntax="self" collection="type-annotation" />
426375 <include syntax="self" collection="implementation" />
427376 </subscopes>
428377 </scope>
429378 </collection>
430379
431− <collection name="do-bind">
432− <scope name="do-bind">
433− <symbol>
434− <context behavior="whitespace"></context>
435− </symbol>
436− <starts-with>
437− <expression>^(?=((\h*)\S.+<-($|\h)))</expression>
438− </starts-with>
439− <ends-with>
440− <template>^(?!\1)(?!\2\h)(?!\s*$)</template>
441− </ends-with>
442− <subscopes>
443− <include syntax="self" collection="do-pattern" />
444− <include syntax="self" collection="expressions" />
445− <!-- <scope name="bind-arrow">
446− <expression><-</expression>
447− </scope> -->
448− </subscopes>
449− </scope>
450− </collection>
451−
452380 <collection name="implementation">
453− <scope name="haskell.definition.type.function">
381+ <scope name="haskell.definition.type.function.implementation">
454382 <starts-with>
455383 <expression>^(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h)</expression>
456384 <capture number="2" name="haskell.keyword.construct.default" />
@@ -460,6 +388,7 @@
460388 <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
461389 </ends-with>
462390 <subscopes>
391+ <include syntax="self" collection="comments" />
463392 <include syntax="self" collection="pattern-match" optional="true" repeat="true" />
464393 <scope>
465394 <expression>=</expression>
@@ -472,7 +401,7 @@
472401 </collection>
473402
474403 <collection name="type-annotation">
475− <scope name="haskell.definition.type.function">
404+ <scope name="haskell.definition.type.function.type-signature">
476405 <starts-with>
477406 <expression>^(\h*)`?(\w(\w|')*)`?\h*::($|\h)</expression>
478407 <capture number="2" name="haskell.identifier.function" />
@@ -481,6 +410,7 @@
481410 <template>^(?!\s+\1\S)(?!\s*$)</template>
482411 </ends-with>
483412 <subscopes>
413+ <include syntax="self" collection="comments" />
484414 <include syntax="self" collection="type" />
485415 </subscopes>
486416 </scope>
@@ -500,6 +430,7 @@
500430 <template>^(?!\s+\1\S)(?!\s*$)</template>
501431 </ends-with>
502432 <subscopes>
433+ <include syntax="self" collection="comments" />
503434 <include syntax="self" collection="type" />
504435 </subscopes>
505436 </scope>
@@ -519,6 +450,7 @@
519450 <template>^(?!\s+\1\S)(?!\s*$)</template>
520451 </ends-with>
521452 <subscopes>
453+ <include syntax="self" collection="comments" />
522454 <scope name="haskell.keyword.construct.where">
523455 <expression>where</expression>
524456 </scope>
@@ -534,15 +466,16 @@
534466 <collection name="gadt-constructor">
535467 <scope name="haskell.identifier.type.struct.data.constructor">
536468 <symbol type="constructor">
537− <context behavior="whitespace" />
469+ <context behavior="subtree" foldable="true" />
538470 </symbol>
539− <expression>(^|=|\|)\h+([A-Z](\w|')*)</expression>
540− <capture number="2" name="haskell.identifier.data.name" />
541− </scope>
542− <scope name="identifier.type.struct.GADT.constructor">
543− <symbol type="constructor"></symbol>
544− <expression>^\h+([A-Z](\w|')*)</expression>
545− <capture number="1" name="haskell.identifier.data.name" />
471+ <starts-with>
472+ <expression>(^|=|\||^)\h+([A-Z](\w|')*)</expression>
473+ <capture number="2" name="haskell.identifier.data.name" />
474+ </starts-with>
475+ <ends-with />
476+ <subscopes anchored="true">
477+ <include syntax="self" collection="record-definition" />
478+ </subscopes>
546479 </scope>
547480 </collection>
548481
@@ -551,6 +484,7 @@
551484 <expression>deriving(\h+(newtype|stock|anyclass))?</expression>
552485 </scope>
553486 <scope name="haskell.record.construct.deriving.keyword">
487+ <include syntax="self" collection="comments" />
554488 <expression>via</expression>
555489 </scope>
556490 </collection>
@@ -569,6 +503,7 @@
569503 <capture number="1" name="haskell.record.bracket" />
570504 </ends-with>
571505 <subscopes>
506+ <include syntax="self" collection="comments" />
572507 <include syntax="self" collection="record-definition-field-name" />
573508 <include syntax="self" collection="type" />
574509 </subscopes>
@@ -600,6 +535,7 @@
600535 <expression>\)</expression>
601536 </ends-with>
602537 <subscopes>
538+ <include syntax="self" collection="comments" />
603539 <scope name="haskell.construct.type.typle.comma">
604540 <expression>\,</expression>
605541 </scope>
@@ -614,6 +550,7 @@
614550 <expression>\]</expression>
615551 </ends-with>
616552 <subscopes>
553+ <include syntax="self" collection="comments" />
617554 <include syntax="self" collection="type" />
618555 </subscopes>
619556 </scope>
@@ -648,6 +585,7 @@
648585 <template>^(?!\s+\1\S)(?!\s*$)</template>
649586 </ends-with>
650587 <subscopes>
588+ <include syntax="self" collection="comments" />
651589 <scope name="haskell.keyword.construct.where">
652590 <expression>where</expression>
653591 </scope>
@@ -667,6 +605,7 @@
667605 <capture number="1" name="haskell.type-list.bracket" />
668606 </ends-with>
669607 <subscopes>
608+ <include syntax="self" collection="comments" />
670609 <include syntax="self" collection="type" />
671610 </subscopes>
672611 </scope>
@@ -683,6 +622,7 @@
683622 <capture number="1" name="haskell.keyword.construct.lambda" />
684623 </ends-with>
685624 <subscopes>
625+ <include syntax="self" collection="comments" />
686626 <include syntax="self" collection="pattern-match" />
687627 </subscopes>
688628 </scope>
@@ -704,6 +644,7 @@
704644 <template>^(?!\1\s*\S)(?!s*$)</template>
705645 </ends-with>
706646 <subscopes>
647+ <include syntax="self" collection="comments" />
707648 <include syntax="self" collection="definition" />
708649 </subscopes>
709650 </scope>
@@ -743,12 +684,12 @@
743684
744685
745686 <collection name="strings">
746− <scope name="haskell.string.double-quoted">
687+ <scope name="haskell.string.double-quoted" spell-check="true">
747688 <starts-with>
748− <expression>"</expression>
689+ <expression>"</expression>
749690 </starts-with>
750691 <ends-with>
751− <expression>"</expression>
692+ <expression>"</expression>
752693 </ends-with>
753694 <subscopes>
754695 <scope name="haskell.string.escape-sequences">
@@ -785,6 +726,7 @@
785726 </ends-with>
786727 <subscopes>
787728 <scope name="identifier.haskell.type">
729+ <symbol type="expression" />
788730 <symbol type="expression" />
789731 <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
790732 <capture number="1" name="identifier.type" />
@@ -809,6 +751,7 @@
809751 </ends-with>
810752 <subscopes>
811753 <scope name="haskell.construct.qualified">
754+ <symbol type="expression" />
812755 <expression>qualified</expression>
813756 <capture number="0" name="haskell.construct.keyword.qualified" />
814757 </scope>
@@ -826,6 +769,7 @@
826769 </ends-with>
827770 <subscopes anchored="true">
828771 <include syntax="self" collection="import-list" />
772+ <symbol type="expression" />
829773 </subscopes>
830774 </scope>
831775
@@ -859,6 +803,7 @@
859803 </ends-with>
860804 <subscopes>
861805 <scope name="haskell.identifier.struct">
806+ <symbol type="expression" />
862807 <symbol type="reference" scope="local" />
863808 <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
864809 <capture number="1" name="haskell.import-list.identifier.type.name" />
@@ -872,13 +817,6 @@
872817 </scope>
873818 </collection>
874819
875− <!-- <collection name="special">
876− <scope>
877− <expression>(;|,)</expression>
878− </scope>
879− </collection> -->
880−
881−
882820 <collection name="reservedop">
883821 <scope name="keyword.operator">
884822 <expression>(\.\.|:|::|=|\\|\||<-|->|@|~|=>)</expression>
@@ -886,10 +824,11 @@
886824 </collection>
887825
888826 <collection name="keywords">
889− <scope name="haskell.keyword.modifier">
827+ <scope name="haskell.keyword.self">
890828 <symbol type="keyword" />
891829 <strings>
892830 <string>do</string>
831+ <string>mdo</string>
893832 <string>in</string>
894833 <string>infix</string>
895834 <string>infixl</string>
@@ -927,20 +866,18 @@
927866 <strings>
928867 <string>undefined</string>
929868 <string>_</string>
869+ <string>@</string>
930870 </strings>
931871 </scope>
932872 </collection>
933873
934874 <collection name="comments">
935875 <scope name="haskell.comment.single" spell-check="true">
936− <starts-with>
937− <expression>--</expression>
938− </starts-with>
939− <ends-with>
940− <expression>$</expression>
941− </ends-with>
876+ <symbol type="comment" />
877+ <expression> --.*$</expression>
942878 </scope>
943879 <scope name="haskell.comment.block" spell-check="true">
880+ <symbol type="comment" />
944881 <starts-with>
945882 <expression>{-</expression>
946883 </starts-with>