@@ -0,0 +1,821 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<syntax name="haskell">
6+ <preferred-file-extension>hs</preferred-file-extension>
10+ <extension priority="1.0">hs</extension>
15+ <expression>--</expression>
19+ <expression>{-</expression>
22+ <expression>-}</expression>
28+ <pair open="{" close="}" />
29+ <pair open="[" close="]" />
30+ <pair open="(" close=")" />
34+ <pair open="[" close="]" />
35+ <pair open="(" close=")" />
36+ <pair open="'" close="'" />
37+ <pair open=""" close=""" />
38+ <pair open="`" close="`" />
44+ (case|class|do|let|where).*
48+ <expression>^\\s*(end|done|with|in|else)\\b|^\\s*;;</expression>
54+ <include syntax="self" collection="comments" />
55+ <include syntax="self" collection="module" />
56+ <include syntax="self" collection="import" />
57+ <include syntax="self" collection="type-family-definition" />
58+ <include syntax="self" collection="pattern-definition" />
59+ <include syntax="self" collection="type-definition" />
60+ <!-- <include syntax="self" collection="type-annotation" /> -->
61+ <include syntax="self" collection="data-definition" />
62+ <include syntax="self" collection="GADT-definition" />
63+ <include syntax="self" collection="instance" />
64+ <include syntax="self" collection="typeclass" />
65+ <include syntax="self" collection="definition" />
69+ <include syntax="self" collection="Quote" />
70+ <include syntax="self" collection="comments" />
76+ <collection name="operators">
77+ <scope name="keyword.modifier">
78+ <expression>(!|#|\$|%|&|โ|\+|\.|/|<|=|>|\?|@|\\|\^|\||-|~|:)+</expression>
82+ <collection name="expressions">
83+ <include syntax="self" collection="do-bind" />
84+ <include syntax="self" collection="literal" />
85+ <include syntax="self" collection="operators" />
86+ <include syntax="self" collection="list" />
87+ <include syntax="self" collection="lambda-case" />
88+ <include syntax="self" collection="lambda-head" />
89+ <include syntax="self" collection="type-applications" />
90+ <include syntax="self" collection="case-expression" />
91+ <include syntax="self" collection="qvarid" />
92+ <include syntax="self" collection="bind-arrow" />
93+ <include syntax="self" collection="tuple" />
97+ <!-- Needed for do binds -->
98+ <!-- <include syntax="self" collection="pattern-match" /> -->
101+ <collection name="pattern-match">
102+ <include syntax="self" collection="literal" />
103+ <include syntax="self" collection="view-pattern" />
104+ <include syntax="self" collection="tuple-match" />
105+<!-- <include syntax="self" collection="at-pattern" /> -->
106+ <include syntax="self" collection="varid" />
107+ <include syntax="self" collection="qconid" />
108+ <include syntax="self" collection="record-match" />
109+ <include syntax="self" collection="list-pattern" />
112+ <collection name="type-applications">
113+ <scope name="type-applications">
115+ <expression>(\s@)\(</expression>
116+ <capture number="1" name="haskell.keyword.operator.typeapplication" />
119+ <expression>)</expression>
122+ <include syntax="self" collection="type" />
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" />
132+ <collection name="Quote">
133+ <scope name="haskell.quasiquote.string-template">
135+ <expression>\[((?:\w|')+)\|</expression>
136+ <capture number="1" name="haskell.identifier.constant" />
139+ <expression>\|\]</expression>
142+ <scope name="haskell.quasiquote.string-template.value">
143+ <expression>.+?</expression>
149+ <collection name="record-match">
150+ <include syntax="self" collection="qconid" />
151+ <include syntax="self" collection="record-fields-match" />
152+ <include syntax="self" collection="record-fields-match-all" />
156+ <collection name="record-fields-match">
157+ <scope name="record-fields-match">
158+ <symbol type="expression" />
160+ <expression>(\{)</expression>
161+ <capture number="1" name="haskell.pattern.record.bracket" />
164+ <expression>(\})</expression>
165+ <capture number="1" name="haskell.pattern.record.bracket" />
168+ <include syntax="self" collection="pattern-match" />
169+ <include syntax="self" collection="varid" />
170+ <scope name="record-sep">
171+ <expression>=</expression>
173+ <scope name="record-sep">
174+ <expression>,</expression>
180+ <collection name="record-fields-match-wildcard">
181+ <scope name="record-fields-match-all">
183+ <expression>(\{)</expression>
184+ <capture number="1" name="haskell.pattern.record.bracket" />
187+ <expression>(\})</expression>
188+ <capture number="1" name="haskell.pattern.record.bracket" />
191+ <scope name="haskell.pattern.record.wildcard">
192+ <expression>\.\.</expression>
198+ <collection name="bind-arrow">
199+ <scope name="haskell.operator.bind-arrow">
200+ <expression><-</expression>
205+ <collection name="list">
206+ <symbol type="expression" />
207+ <scope name="haskell.list">
209+ <expression>(\[)</expression>
210+ <capture number="1" name="haskell.list.bracket" />
213+ <expression>(\])</expression>
214+ <capture number="1" name="haskell.list.bracket" />
217+ <include syntax="self" collection="expressions" />
222+ <collection name="list-pattern">
223+ <symbol type="expression" />
224+ <scope name="haskell.pattern.list">
226+ <expression>(\[)</expression>
227+ <capture number="1" name="haskell.pattern.list.bracket" />
230+ <expression>(\])</expression>
231+ <capture number="1" name="haskell.pattern.list.bracket" />
234+ <include syntax="self" collection="pattern-match" />
240+ <collection name="view-pattern">
241+ <scope name="haskell.pattern.view">
242+ <symbol type="expression" />
244+ <expression>(\()</expression>
245+ <capture number="1" name="haskell.pattern.view.bracket" />
248+ <expression>(\))</expression>
249+ <capture number="1" name="haskell.pattern.view.bracket" />
251+ <subscopes anchored="true">
252+ <include syntax="self" collection="expressions" />
253+ <scope name="haskell.pattern.view.operator.arrow">
254+ <expression>-></expression>
256+ <include syntax="self" collection="pattern-match" />
261+ <collection name="tuple-match">
262+ <symbol type="expression" />
263+ <scope name="haskell.pattern.tuple">
265+ <expression>(\()</expression>
266+ <capture number="1" name="haskell.pattern.tuple.bracket" />
269+ <expression>(\))</expression>
270+ <capture number="1" name="haskell.pattern.tuple.bracket" />
273+ <include syntax="self" collection="pattern-match" />
278+ <collection name="case-expression">
279+ <scope name="haskell.case">
281+ <expression>(case)</expression>
282+ <capture number="1" name="haskell.case.keyword.condition" />
285+ <expression>(of)</expression>
286+ <capture number="1" name="haskell.case.keyword.condition" />
289+ <include syntax="self" collection="expressions" />
294+ <collection name="tuple">
295+ <symbol type="expression" />
296+ <scope name="haskell.tuple">
298+ <expression>(\()</expression>
299+ <capture number="1" name="haskell.tuple.bracket" />
302+ <expression>(\))</expression>
303+ <capture number="1" name="haskell.tuple.bracket" />
306+ <include syntax="self" collection="expressions" />
311+ <collection name="typeclass">
312+ <symbol type="interface" />
313+ <scope name="haskell.definition.class">
315+ <expression>^(\h*)(class)($|\h)</expression>
316+ <capture number="2" name="haskell.keyword.construct.class" />
319+ <template>^(?!\s+\1\S)(?!\s*$)</template>
322+ <scope name="haskell.keyword.construct.where">
323+ <expression>where</expression>
325+ <include syntax="self" collection="type" />
326+ <include syntax="self" collection="type-definition" />
327+ <!-- <include syntax="self" collection="type-annotation" /> -->
328+ <include syntax="self" collection="definition" />
333+ <collection name="instance">
334+ <scope name="haskell.instance">
335+ <symbol type="category" />
337+ <expression>^(\h*)(instance)($|\h)</expression>
338+ <capture number="2" name="haskell.keyword.construct.instance" />
341+ <template>^(?!\s+\1\S)(?!\s*$)</template>
344+ <scope name="haskell.keyword.construct.where">
345+ <expression>where</expression>
347+ <include syntax="self" collection="type" />
348+ <include syntax="self" collection="type-definition" />
349+ <include syntax="self" collection="type-annotation" />
350+ <include syntax="self" collection="definition" />
355+ <collection name="type-family-definition">
356+ <scope name="haskell.definition.type.type-family">
357+ <symbol type="type" />
359+ <expression>^(\h*)(type\h+family)\h+`?(\w(\w|')*)`?($|\h)</expression>
360+ <capture number="2" name="haskell.keyword.construct.type-family" />
363+ <template>^(?!\s+\1\S)(?!\s*$)</template>
366+ <scope name="haskell.keyword.construct.where">
367+ <expression>where</expression>
369+ <include syntax="self" collection="type" />
374+ <collection name="definition">
375+ <scope name="haskell.definition.type.function">
376+ <symbol type="function">
378+ <component selector="haskell.definition.type.function" />
383+ <expression>^(?=(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h))</expression>
384+ <capture number="2" name="haskell.keyword.construct.default" />
385+ <capture number="3" name="haskell.identifier.function" />
388+ <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
391+ <include syntax="self" collection="type-annotation" />
392+ <include syntax="self" collection="implementation" />
397+ <collection name="do-bind">
398+ <scope name="do-bind">
400+ <expression>^(?=(\h*).+<-($|\h))</expression>
403+ <template>^(?!\0)(?!\s+\1\S)(?!\s*$)</template>
405+ <subscopes anchored="true">
406+ <include syntax="self" collection="pattern-match" />
407+ <scope name="bind-arrow">
408+ <expression><-</expression>
410+ <include syntax="self" collection="expressions" repeat="true" />
415+ <collection name="implementation">
416+ <scope name="haskell.definition.type.function">
417+ <local scope="within-construct" />
419+ <expression>^(\h*)(default\h+)?`?(\w(\w|')*)`?($|\h)</expression>
420+ <capture number="2" name="haskell.keyword.construct.default" />
421+ <capture number="3" name="haskell.identifier.function" />
424+ <template>^(?!\1\3\s)(?!\s+\1\S)(?!\s*$)</template>
427+ <include syntax="self" collection="where-clause" />
428+ <include syntax="self" collection="expressions" />
433+ <collection name="type-annotation">
434+ <scope name="haskell.definition.type.function">
436+ <expression>^(\h*)`?(\w(\w|')*)`?\h*::($|\h)</expression>
437+ <capture number="2" name="haskell.identifier.function" />
440+ <template>^(?!\s+\1\S)(?!\s*$)</template>
443+ <include syntax="self" collection="type" />
448+ <collection name="type-definition">
449+ <scope name="haskell.definition.type">
451+ <expression>^(\h*)(type)\h+(\w(\w|')*)</expression>
452+ <capture number="2" name="haskell.keyword.construct.type" />
453+ <capture number="3" name="haskell.identifier.type" />
456+ <template>^(?!\s+\1\S)(?!\s*$)</template>
459+ <include syntax="self" collection="type" />
464+ <collection name="GADT-definition">
465+ <scope name="haskell.definition.struct.GADT">
467+ <expression>^(\h*)(data)\h+(\w(\w|')*)</expression>
468+ <capture number="2" name="haskell.keyword.construct.data.GADT" />
471+ <template>^(?!\s+\1\S)(?!\s*$)</template>
474+ <include syntax="self" collection="gadt-constructor" />
475+ <include syntax="self" collection="type" />
476+ <include syntax="self" collection="record-definition" />
477+ <include syntax="self" collection="record-definition-field-name" />
482+ <collection name="gadt-constructor">
483+ <scope name="identifier.type.struct.GADT.constructor">
484+ <expression>^\h+[A-Z](\w|')*</expression>
488+ <collection name="data-definition">
489+ <scope name="haskell.definition.struct.data">
491+ <expression>^(\h*)(data|newtype)\h+(\w(\w|')*)</expression>
492+ <capture number="2" name="haskell.keyword.construct.data.newtype" />
493+ <capture number="3" name="haskell.identifier.type" />
496+ <template>^(?!\s+\1\S)(?!\s*$)</template>
499+ <include syntax="self" collection="record-definition" />
500+ <include syntax="self" collection="data-constructor" />
501+ <include syntax="self" collection="type" />
506+ <collection name="data-constructor">
507+ <scope name="haskell.identifier.type.struct.data.constructor">
508+ <expression>=\h+[A-Z](\w|')*</expression>
510+ <scope name="haskell.identifier.type.struct.data.constructor">
511+ <expression>\|\h+[A-Z](\w|')*</expression>
515+ <collection name="record-definition">
516+ <scope name="haskell.record">
518+ <expression>(\{)</expression>
519+ <capture number="1" name="haskell.record.bracket" />
522+ <expression>(\})</expression>
523+ <capture number="1" name="haskell.record.bracket" />
526+ <include syntax="self" collection="record-definition-field-name" />
527+ <include syntax="self" collection="type" />
532+ <collection name="record-definition-field-name">
533+ <scope name="haskell.record.definition.property">
534+ <expression>\w(\w|')*\h*::</expression>
538+ <collection name="type">
539+ <include syntax="self" collection="type-list" />
540+ <scope name="haskell.identifier.type">
541+ <expression>([A-Z](\w|')*\.)*[A-Z](\w|')*</expression>
543+ <scope name="haskell.keyword.construct.forall">
544+ <expression>forall</expression>
546+ <scope name="haskell.identifier.type.variable">
547+ <expression>\w(\w|')*</expression>
549+ <scope name="haskell.keyword.construct.function-arrow">
550+ <expression>-></expression>
552+ <scope name="haskell.keyword.construct.fat-arrow">
553+ <expression>=></expression>
557+ <collection name="pattern-definition">
558+ <scope name="haskell.pattern">
560+ <expression>^(\h*)(pattern)\h+(\w(\w|')*)</expression>
561+ <capture number="2" name="haskell.keyword.construct.pattern" />
562+ <capture number="3" name="haskell.identifier.decorator.pattern" />
565+ <template>^(?!\s+\1\S)(?!\s*$)</template>
568+ <scope name="haskell.keyword.construct.where">
569+ <expression>where</expression>
571+ <include syntax="self" collection="expressions" />
576+ <collection name="type-list">
577+ <scope name="haskell.type-list">
579+ <expression>('\[)</expression>
580+ <capture number="1" name="haskell.type-list.bracket" />
583+ <expression>(\])</expression>
584+ <capture number="1" name="haskell.type-list.bracket" />
587+ <include syntax="self" collection="type" />
592+ <collection name="lambda-head">
593+ <scope name="haskell.lambda">
595+ <expression>(\\)</expression>
596+ <capture number="1" name="haskell.keyword.construct.lambda" />
599+ <expression>(->)</expression>
600+ <capture number="1" name="haskell.keyword.construct.lambda" />
603+ <include syntax="self" collection="pattern-match" />
608+ <collection name="lambda-case">
609+ <scope name="haskell.keyword.condition.lambda-case">
610+ <expression>\\case</expression>
614+ <collection name="where-clause">
615+ <scope name="haskell.construct.where">
616+ <local scope="within-parent" />
618+ <expression>^(\h*)(where)</expression>
619+ <capture number="2" name="haskell.construct.keyword.where" />
622+ <template>^(?!\1\s*\S)(?!s*$)</template>
625+ <include syntax="self" collection="definition" />
631+ <collection name="qvarid">
632+ <scope name="haskell.identifier.function">
633+ <expression>([A-Z](\w|')*\.)*\w(\w|')*</expression>
637+ <collection name="varid">
638+ <scope name="haskell.identifier.variable">
639+ <expression>\w(\w|')*</expression>
643+ <collection name="qconid">
644+ <scope name="haskell.identifier.type.struct.constructor">
645+ <expression>([A-Z](\w|')*\.)*[A-Z](\w|')*</expression>
649+ <collection name="qconsym">
650+ <scope name="haskell.identifier.decorator.pattern">
651+ <expression>([A-Z](\w|')*\.):(\w|')*</expression>
655+ <collection name="literal">
656+ <include syntax="self" collection="number" />
657+ <include syntax="self" collection="strings" />
661+ <collection name="strings">
662+ <scope name="haskell.string.double-quoted">
664+ <expression>"</expression>
667+ <expression>"</expression>
670+ <scope name="haskell.string.escape-sequences">
671+ <expression>\\.</expression>
675+ <scope name="haskell.string.single-quoted">
676+ <expression>'([^'\\]|\\.)'</expression>
681+ <collection name="number">
682+ <scope name="haskell.value.number">
683+ <expression>(0x|0o|0O|0X)?\d+(\d|_)*(\.[\d|_]+)?((e|E)(\+|-)?\d+)?</expression>
688+ <collection name="module">
689+ <scope name="haskell.definition.module.package">
691+ <expression>^(module)\s+(\w|\.)+</expression>
692+ <capture number="1" name="haskell.construct.keyword.module" />
693+ <capture number="2" name="haskell.definition.module.package" />
696+ <expression>(where)</expression>
697+ <capture number="1" name="haskell.construct.keyword.module" />
699+ <subscopes export-symbols="true">
700+ <scope name="identifier.constant">
701+ <expression>(\w|')+</expression>
707+ <collection name="import">
708+ <scope name="haskell.construct.keyword.import">
709+ <expression>^import\s</expression>
711+ <scope name="haskell.construct.keyword.qualified">
712+ <expression>qualified</expression>
714+ <scope name="haskell.construct.keyword.as">
715+ <expression>as</expression>
717+ <scope name="haskell.identifier.module.package">
718+ <expression>([A-Z](\w|')*\.)*[A-Z](\w|')*</expression>
720+ <include syntax="self" collection="import-list" />
723+ <collection name="import-list">
724+ <scope name="import-list">
726+ <expression>(\()</expression>
727+ <capture number="1" name="haskell.import-list.bracket" />
730+ <expression>(\))</expression>
731+ <capture number="1" name="haskell.import-list.bracket" />
734+ <scope name="identifier.decorator">
735+ <expression>([A-Z](\w|')*\.)*\w(\w|')*</expression>
741+ <!-- <collection name="special">
743+ <expression>(;|,)</expression>
748+ <collection name="reservedop">
749+ <scope name="keyword.operator">
750+ <expression>(\.\.|:|::|=|\\|\||<-|->|@|~|=>)</expression>
754+ <collection name="keywords">
755+ <scope name="haskell.keyword.modifier">
756+ <symbol type="keyword" />
760+ <string>infix</string>
761+ <string>infixl</string>
762+ <string>infixr</string>
763+ <string>where</string>
764+ <string>let</string>
767+ <scope name="haskell.keyword.condition">
768+ <symbol type="keyword" />
771+ <string>case</string>
772+ <string>else</string>
774+ <string>then</string>
777+ <scope name="haskell.keyword.keyword.construct">
778+ <symbol type="keyword" />
780+ <string>instance</string>
781+ <string>newtype</string>
782+ <string>module</string>
783+ <string>type</string>
784+ <string>class</string>
785+ <string>data</string>
786+ <string>default</string>
787+ <string>deriving</string>
788+ <string>foreign</string>
791+ <scope name="haskell.keyword.self">
792+ <symbol type="keyword" />
794+ <string>undefined</string>
800+ <collection name="comments">
801+ <scope name="haskell.comment.single" spell-check="true">
803+ <expression>--</expression>
806+ <expression>$</expression>
809+ <scope name="haskell.comment.block" spell-check="true">
811+ <expression>{-</expression>
814+ <expression>-}</expression>