@@ -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,54 +77,27 @@
7977 </collection>
8078
8179 <collection name="expressions">
82− <scope>
83− <expression></expression>
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>
8488 </scope>
85− <include syntax="self" collection="do-bind" />
89+ <include syntax="self" collection="keywords" />
8690 <include syntax="self" collection="literal" />
8791 <include syntax="self" collection="operators" />
92+ <include syntax="self" collection="record-match" />
8893 <include syntax="self" collection="list" />
94+ <include syntax="self" collection="view-pattern" />
8995 <include syntax="self" collection="lambda-case" />
9096 <include syntax="self" collection="lambda-head" />
91− <include syntax="self" collection="type-applications" />
92− <include syntax="self" collection="outer-case-expression" />
97+ <include syntax="self" collection="case-expression" />
98+ <include syntax="self" collection="qconid" />
9399 <include syntax="self" collection="qvarid" />
94100 <include syntax="self" collection="tuple" />
95−
96−
97− <!-- Needed for do binds -->
98− <!-- <include syntax="self" collection="pattern-match" /> -->
99− </collection>
100−
101− <collection name="pattern-match">
102− <include syntax="self" collection="literal" />
103− <include syntax="self" collection="tuple-match" />
104− <!-- <include syntax="self" collection="at-pattern" /> -->
105− <include syntax="self" collection="varid" />
106− <include syntax="self" collection="qconid" />
107− <include syntax="self" collection="record-match" />
108− <include syntax="self" collection="list-pattern" />
109− <include syntax="self" collection="view-pattern" />
110− </collection>
111−
112− <collection name="type-applications">
113− <scope name="type-applications">
114− <starts-with>
115− <expression>(\s@)\(</expression>
116− <capture number="1" name="haskell.keyword.operator.typeapplication" />
117− </starts-with>
118− <ends-with>
119− <expression>)</expression>
120− </ends-with>
121− <subscopes>
122− <include syntax="self" collection="type" />
123− </subscopes>
124− </scope>
125− <scope name="type-applications-single">
126− <expression>(@)(\w+)</expression>
127− <capture number="1" name="haskell.keyword.operator.typeapplication" />
128− <capture number="2" name="haskell.identifier.type" />
129− </scope>
130101 </collection>
131102
132103 <collection name="Quote">
@@ -165,8 +136,8 @@
165136 <capture number="1" name="haskell.pattern.record.bracket" />
166137 </ends-with>
167138 <subscopes>
168− <include syntax="self" collection="pattern-match" />
169− <include syntax="self" collection="varid" />
139+ <include syntax="self" collection="comments" />
140+ <include syntax="self" collection="expressions" />
170141 <scope name="record-sep">
171142 <expression>=</expression>
172143 </scope>
@@ -188,6 +159,7 @@
188159 <capture number="1" name="haskell.pattern.record.bracket" />
189160 </ends-with>
190161 <subscopes>
162+ <include syntax="self" collection="comments" />
191163 <scope name="haskell.pattern.record.wildcard">
192164 <expression>\.\.</expression>
193165 </scope>
@@ -214,29 +186,12 @@
214186 <capture number="1" name="haskell.list.bracket" />
215187 </ends-with>
216188 <subscopes>
189+ <include syntax="self" collection="comments" />
217190 <include syntax="self" collection="expressions" />
218191 </subscopes>
219192 </scope>
220193 </collection>
221194
222− <collection name="list-pattern">
223− <symbol type="expression" />
224− <scope name="haskell.pattern.list">
225− <starts-with>
226− <expression>(\[)</expression>
227− <capture number="1" name="haskell.pattern.list.bracket" />
228− </starts-with>
229− <ends-with>
230− <expression>(\])</expression>
231− <capture number="1" name="haskell.pattern.list.bracket" />
232− </ends-with>
233− <subscopes>
234− <include syntax="self" collection="pattern-match" />
235− </subscopes>
236− </scope>
237− </collection>
238−
239−
240195 <collection name="view-pattern">
241196 <scope name="haskell.pattern.view">
242197 <symbol type="expression" />
@@ -253,24 +208,7 @@
253208 <scope name="haskell.pattern.view.operator.arrow">
254209 <expression>-></expression>
255210 </scope>
256− <include syntax="self" collection="pattern-match" />
257− </subscopes>
258− </scope>
259− </collection>
260−
261− <collection name="tuple-match">
262− <symbol type="expression" />
263− <scope name="haskell.pattern.tuple">
264− <starts-with>
265− <expression>(\()</expression>
266− <capture number="1" name="haskell.pattern.tuple.bracket" />
267− </starts-with>
268− <ends-with>
269− <expression>(\))</expression>
270− <capture number="1" name="haskell.pattern.tuple.bracket" />
271− </ends-with>
272− <subscopes>
273− <include syntax="self" collection="pattern-match" />
211+ <include syntax="self" collection="expressions" />
274212 </subscopes>
275213 </scope>
276214 </collection>
@@ -286,53 +224,11 @@
286224 <capture number="1" name="haskell.case.keyword.condition" />
287225 </ends-with>
288226 <subscopes anchored="true">
289− <include syntax="self" collection="pattern-match" />
290− </subscopes>
291− </scope>
292− </collection>
293−
294− <collection name="case-match">
295− <scope name="case-match">
296− <starts-with>
297− <expression>(?=((\h*)\S.*->($|\h)))</expression>
298− </starts-with>
299− <ends-with>
300− <expression>-></expression>
301− </ends-with>
302− <subscopes anchored="true">
303− <include syntax="self" collection="pattern-match" />
304− </subscopes>
305− </scope>
306− </collection>
307−
308− <collection name="inner-case-expressions">
309− <scope name="inner-case-expressions">
310− <starts-with>
311− <expression>(?=((\h*)\S.*->($|\h)))</expression>
312− </starts-with>
313− <ends-with>
314− <template>^(?!\1)(?!\2\h)(?!\s*$)</template>
315− </ends-with>
316− <subscopes anchored="true" skip-whitespace="false">
317− <include syntax="self" collection="case-match" />
318227 <include syntax="self" collection="expressions" />
319228 </subscopes>
320229 </scope>
321230 </collection>
322231
323− <collection name="outer-case-expression">
324− <scope name="outer-case-expression">
325− <starts-with>
326− <expression>(?=case)</expression>
327− </starts-with>
328− <ends-with />
329− <subscopes anchored="true" skip-whitespace="false">
330− <include syntax="self" collection="case-expression" />
331− <include syntax="self" collection="inner-case-expressions" repeat="true" />
332− </subscopes>
333− </scope>
334− </collection>
335−
336232 <collection name="tuple">
337233 <symbol type="expression" />
338234 <scope name="haskell.tuple">
@@ -345,73 +241,73 @@
345241 <capture number="1" name="haskell.tuple.bracket" />
346242 </ends-with>
347243 <subscopes>
244+ <include syntax="self" collection="comments" />
348245 <include syntax="self" collection="expressions" />
349246 </subscopes>
350247 </scope>
351248 </collection>
352249
353250 <collection name="typeclass">
354− <symbol type="interface" />
355− <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>
356255 <starts-with>
357256 <expression>^(\h*)(class)($|\h)</expression>
358257 <capture number="2" name="haskell.keyword.construct.class" />
359258 </starts-with>
360− <ends-with>
361− <template>^(?!\s+\1\S)(?!\s*$)</template>
362− </ends-with>
363− <subscopes>
364− <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">
365274 <expression>where</expression>
366275 </scope>
367− <include syntax="self" collection="type" />
368− <include syntax="self" collection="type-definition" />
369− <!-- <include syntax="self" collection="type-annotation" /> -->
370− <include syntax="self" collection="definition" />
371276 </subscopes>
372277 </scope>
373278 </collection>
374279
375280 <collection name="instance">
376281 <scope name="haskell.instance">
377− <symbol type="category">
282+ <symbol type="category" name-selector="haskell.keyword.construct.instance.name">
378283 <context behavior="whitespace" foldable="true" />
379284 </symbol>
380285 <starts-with>
381286 <expression>^(\h*)(instance)($|\h)</expression>
382287 <capture number="2" name="haskell.keyword.construct.instance" />
383288 </starts-with>
384− <ends-with>
385− <template>^(?!\s+\1\S)(?!\s*$)</template>
386− </ends-with>
387− <subscopes anchored="true" skip-whitespace="false">
388− <scope name="haskell.construct.instance.head">
289+ <ends-with />
290+ <subscopes anchored="true">
291+ <scope name="haskell.keyword.construct.instance.name">
389292 <starts-with>
390293 <expression></expression>
391294 </starts-with>
392295 <ends-with>
393− <expression>where</expression>
394− <capture number="0" name="haskell.keyword.construct.where" />
296+ <expression>(?=(where|^\s*$))</expression>
395297 </ends-with>
396298 <subscopes>
397− <include syntax="self" collection="type" optional="true" repeat="true" />
299+ <include syntax="self" collection="type" />
398300 </subscopes>
399301 </scope>
400− <include syntax="self" collection="instance-body" />
302+ <scope name="haskell.keyword.construct.where" optional="true">
303+ <expression>where</expression>
304+ </scope>
401305 </subscopes>
402306 </scope>
403307 </collection>
404308
405− <collection name="instance-body">
406− <include syntax="self" collection="definition" />
407− <include syntax="self" collection="type-definition" />
408− </collection>
409−
410309 <collection name="type-family-definition">
411310 <scope name="haskell.definition.type-family.type">
412− <symbol type="type" scope="global">
413− <context behavior="subtree" foldable="false" />
414− </symbol>
415311 <starts-with>
416312 <expression>^(\h*)(type\h+family)</expression>
417313 <capture number="2" name="haskell.keyword.construct.type-family" />
@@ -450,6 +346,7 @@
450346 <template>^(?!\s+\1\S)(?!\s*$)</template>
451347 </ends-with>
452348 <subscopes>
349+ <include syntax="self" collection="comments" />
453350 <include syntax="self" collection="type" optional="true" repeat="true" />
454351 <scope>
455352 <expression>=</expression>
@@ -461,7 +358,7 @@
461358
462359 <collection name="definition">
463360 <scope name="haskell.definition.type.function">
464− <symbol type="function" scope="local">
361+ <symbol type="function">
465362 <context behavior="whitespace" foldable="true" />
466363 </symbol>
467364 <starts-with>
@@ -473,53 +370,15 @@
473370 <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
474371 </ends-with>
475372 <subscopes>
373+ <include syntax="self" collection="comments" />
476374 <include syntax="self" collection="type-annotation" />
477375 <include syntax="self" collection="implementation" />
478376 </subscopes>
479377 </scope>
480378 </collection>
481379
482− <collection name="do-bind">
483− <scope name="do-bind">
484− <symbol>
485− <context behavior="whitespace"></context>
486− </symbol>
487− <starts-with>
488− <expression>^(?=((\h*)\S.+<-($|\h)))</expression>
489− </starts-with>
490− <ends-with>
491− <template>^(?!\1)(?!\2\h)(?!\s*$)</template>
492− </ends-with>
493− <subscopes>
494− <include syntax="self" collection="do-pattern" />
495− <include syntax="self" collection="expressions" />
496− <!-- <scope name="bind-arrow">
497− <expression><-</expression>
498− </scope> -->
499− </subscopes>
500− </scope>
501− </collection>
502−
503− <collection name="do-pattern">
504− <scope name="do-pattern">
505− <starts-with>
506− <expression>^(?=((\h*)\S.+<-($|\h)))</expression>
507− </starts-with>
508− <ends-with>
509− <expression><-</expression>
510− </ends-with>
511− <subscopes>
512− <include syntax="self" collection="pattern-match" />
513− <!-- <scope name="bind-arrow">
514− <expression><-</expression>
515− </scope>
516− <include syntax="self" collection="expressions" repeat="true" /> -->
517− </subscopes>
518− </scope>
519− </collection>
520−
521380 <collection name="implementation">
522− <scope name="haskell.definition.type.function">
381+ <scope name="haskell.definition.type.function.implementation">
523382 <starts-with>
524383 <expression>^(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h)</expression>
525384 <capture number="2" name="haskell.keyword.construct.default" />
@@ -528,7 +387,8 @@
528387 <ends-with>
529388 <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
530389 </ends-with>
531− <subscopes anchored="true">
390+ <subscopes>
391+ <include syntax="self" collection="comments" />
532392 <include syntax="self" collection="pattern-match" optional="true" repeat="true" />
533393 <scope>
534394 <expression>=</expression>
@@ -541,7 +401,7 @@
541401 </collection>
542402
543403 <collection name="type-annotation">
544− <scope name="haskell.definition.type.function">
404+ <scope name="haskell.definition.type.function.type-signature">
545405 <starts-with>
546406 <expression>^(\h*)`?(\w(\w|')*)`?\h*::($|\h)</expression>
547407 <capture number="2" name="haskell.identifier.function" />
@@ -550,6 +410,7 @@
550410 <template>^(?!\s+\1\S)(?!\s*$)</template>
551411 </ends-with>
552412 <subscopes>
413+ <include syntax="self" collection="comments" />
553414 <include syntax="self" collection="type" />
554415 </subscopes>
555416 </scope>
@@ -569,6 +430,7 @@
569430 <template>^(?!\s+\1\S)(?!\s*$)</template>
570431 </ends-with>
571432 <subscopes>
433+ <include syntax="self" collection="comments" />
572434 <include syntax="self" collection="type" />
573435 </subscopes>
574436 </scope>
@@ -588,6 +450,7 @@
588450 <template>^(?!\s+\1\S)(?!\s*$)</template>
589451 </ends-with>
590452 <subscopes>
453+ <include syntax="self" collection="comments" />
591454 <scope name="haskell.keyword.construct.where">
592455 <expression>where</expression>
593456 </scope>
@@ -603,15 +466,16 @@
603466 <collection name="gadt-constructor">
604467 <scope name="haskell.identifier.type.struct.data.constructor">
605468 <symbol type="constructor">
606− <context behavior="whitespace" />
469+ <context behavior="subtree" foldable="true" />
607470 </symbol>
608− <expression>(^|=|\|)\h+([A-Z](\w|')*)</expression>
609− <capture number="2" name="haskell.identifier.data.name" />
610− </scope>
611− <scope name="identifier.type.struct.GADT.constructor">
612− <symbol type="constructor"></symbol>
613− <expression>^\h+([A-Z](\w|')*)</expression>
614− <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>
615479 </scope>
616480 </collection>
617481
@@ -619,6 +483,10 @@
619483 <scope name="haskell.record.construct.deriving.keyword">
620484 <expression>deriving(\h+(newtype|stock|anyclass))?</expression>
621485 </scope>
486+ <scope name="haskell.record.construct.deriving.keyword">
487+ <include syntax="self" collection="comments" />
488+ <expression>via</expression>
489+ </scope>
622490 </collection>
623491
624492 <collection name="record-definition">
@@ -635,6 +503,7 @@
635503 <capture number="1" name="haskell.record.bracket" />
636504 </ends-with>
637505 <subscopes>
506+ <include syntax="self" collection="comments" />
638507 <include syntax="self" collection="record-definition-field-name" />
639508 <include syntax="self" collection="type" />
640509 </subscopes>
@@ -666,6 +535,7 @@
666535 <expression>\)</expression>
667536 </ends-with>
668537 <subscopes>
538+ <include syntax="self" collection="comments" />
669539 <scope name="haskell.construct.type.typle.comma">
670540 <expression>\,</expression>
671541 </scope>
@@ -680,6 +550,7 @@
680550 <expression>\]</expression>
681551 </ends-with>
682552 <subscopes>
553+ <include syntax="self" collection="comments" />
683554 <include syntax="self" collection="type" />
684555 </subscopes>
685556 </scope>
@@ -699,7 +570,7 @@
699570 <expression>forall</expression>
700571 </scope>
701572 <scope name="haskell.identifier.type.variable">
702− <expression>(?!where)(?!=)((?!(\(|\)|\,|\!))\S)((?!(\(|\)|\,))\S)*</expression>
573+ <expression>(?!where)(?!=)((?!(\(|\)|\,|\!))\S)((?!(\(|\)|\,))\w)*</expression>
703574 </scope>
704575 </collection>
705576
@@ -714,6 +585,7 @@
714585 <template>^(?!\s+\1\S)(?!\s*$)</template>
715586 </ends-with>
716587 <subscopes>
588+ <include syntax="self" collection="comments" />
717589 <scope name="haskell.keyword.construct.where">
718590 <expression>where</expression>
719591 </scope>
@@ -733,6 +605,7 @@
733605 <capture number="1" name="haskell.type-list.bracket" />
734606 </ends-with>
735607 <subscopes>
608+ <include syntax="self" collection="comments" />
736609 <include syntax="self" collection="type" />
737610 </subscopes>
738611 </scope>
@@ -749,6 +622,7 @@
749622 <capture number="1" name="haskell.keyword.construct.lambda" />
750623 </ends-with>
751624 <subscopes>
625+ <include syntax="self" collection="comments" />
752626 <include syntax="self" collection="pattern-match" />
753627 </subscopes>
754628 </scope>
@@ -770,6 +644,7 @@
770644 <template>^(?!\1\s*\S)(?!s*$)</template>
771645 </ends-with>
772646 <subscopes>
647+ <include syntax="self" collection="comments" />
773648 <include syntax="self" collection="definition" />
774649 </subscopes>
775650 </scope>
@@ -809,12 +684,12 @@
809684
810685
811686 <collection name="strings">
812− <scope name="haskell.string.double-quoted">
687+ <scope name="haskell.string.double-quoted" spell-check="true">
813688 <starts-with>
814− <expression>"</expression>
689+ <expression>"</expression>
815690 </starts-with>
816691 <ends-with>
817− <expression>"</expression>
692+ <expression>"</expression>
818693 </ends-with>
819694 <subscopes>
820695 <scope name="haskell.string.escape-sequences">
@@ -851,6 +726,7 @@
851726 </ends-with>
852727 <subscopes>
853728 <scope name="identifier.haskell.type">
729+ <symbol type="expression" />
854730 <symbol type="expression" />
855731 <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
856732 <capture number="1" name="identifier.type" />
@@ -875,6 +751,7 @@
875751 </ends-with>
876752 <subscopes>
877753 <scope name="haskell.construct.qualified">
754+ <symbol type="expression" />
878755 <expression>qualified</expression>
879756 <capture number="0" name="haskell.construct.keyword.qualified" />
880757 </scope>
@@ -892,6 +769,7 @@
892769 </ends-with>
893770 <subscopes anchored="true">
894771 <include syntax="self" collection="import-list" />
772+ <symbol type="expression" />
895773 </subscopes>
896774 </scope>
897775
@@ -925,6 +803,7 @@
925803 </ends-with>
926804 <subscopes>
927805 <scope name="haskell.identifier.struct">
806+ <symbol type="expression" />
928807 <symbol type="reference" scope="local" />
929808 <expression>([A-Z](\w|')*)\h*(\(\h*\.\.\h*\))?</expression>
930809 <capture number="1" name="haskell.import-list.identifier.type.name" />
@@ -938,13 +817,6 @@
938817 </scope>
939818 </collection>
940819
941− <!-- <collection name="special">
942− <scope>
943− <expression>(;|,)</expression>
944− </scope>
945− </collection> -->
946−
947−
948820 <collection name="reservedop">
949821 <scope name="keyword.operator">
950822 <expression>(\.\.|:|::|=|\\|\||<-|->|@|~|=>)</expression>
@@ -952,10 +824,11 @@
952824 </collection>
953825
954826 <collection name="keywords">
955− <scope name="haskell.keyword.modifier">
827+ <scope name="haskell.keyword.self">
956828 <symbol type="keyword" />
957829 <strings>
958830 <string>do</string>
831+ <string>mdo</string>
959832 <string>in</string>
960833 <string>infix</string>
961834 <string>infixl</string>
@@ -993,20 +866,18 @@
993866 <strings>
994867 <string>undefined</string>
995868 <string>_</string>
869+ <string>@</string>
996870 </strings>
997871 </scope>
998872 </collection>
999873
1000874 <collection name="comments">
1001875 <scope name="haskell.comment.single" spell-check="true">
1002− <starts-with>
1003− <expression>--</expression>
1004− </starts-with>
1005− <ends-with>
1006− <expression>$</expression>
1007− </ends-with>
876+ <symbol type="comment" />
877+ <expression> --.*$</expression>
1008878 </scope>
1009879 <scope name="haskell.comment.block" spell-check="true">
880+ <symbol type="comment" />
1010881 <starts-with>
1011882 <expression>{-</expression>
1012883 </starts-with>