summaryrefslogtreecommitdiffstats
path: root/kate/data/curry.xml
blob: 4dcb9b4a6d628c69949aa5808726c708c024a62c (plain)
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
  <!-- qualification of entities -->
  <!ENTITY qualify     "([A-Z][a-zA-Z0-9_']*\.)*">
  <!-- identifier -->
  <!ENTITY ident       "[a-z][a-zA-Z0-9_']*">
  <!-- Type -->
  <!ENTITY type        "[A-Z][a-zA-Z0-9_']*">
  <!-- infix operator characters -->
  <!ENTITY infixchar   "~!@#\$&#37;\^&amp;\*\+\-=&lt;&gt;\?\./\|&backslash;:">
  <!-- identifier in prefix notation, e.g.: id, ($) -->
  <!ENTITY prefixIdent "(&ident;|\([&infixchar;]+\))">

  <!-- Characters allowed in character escape sequence, e.g., \n -->
  <!ENTITY escSeqChar  "abfnrtv\&quot;'" >
  <!-- Ascii escape sequence, e.g., \NUL -->
  <!ENTITY escSeqAscii "NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL" >
  <!-- Control escape sequence, e.g., \^X -->
  <!ENTITY escSeqCntrl "\^[A-Z@\[&backslash;\]\^_]" >

  <!-- octal number -->
  <!ENTITY octal       "[0-7]+" >
  <!-- decimal number -->
  <!ENTITY decimal     "[0-9]+" >
  <!-- hexadecimal number -->
  <!ENTITY hexadecimal "[0-9a-fA-F]+" >
  <!-- a backslash, escaped for use in regular expressions -->
  <!ENTITY backslash   "\\" >
  <!-- dashes introducing a currydoc comment -->
  <!ENTITY currydoc    "---" >
]>
<language name="Curry" version="0.3" kateversion="2.3"
          section="Sources" extensions="*.curry" mimetype="text/x-curry"
          author="Björn Peemöller (bjp@informatik.uni-kiel.de)" license="LGPL"
          indenter="haskell">
  <highlighting>
  <list name="keywords">
    <item> case </item>
    <item> data </item>
    <item> do </item>
    <item> else </item>
    <item> external </item>
    <item> fcase </item>
    <item> free </item>
    <item> if </item>
<!-- Although import is a keyword, it is handled in a special context
     to highlight "qualified", "as" and "hiding" in keyword style,
     albeit these lexemes are no keywords.
    <item> import </item>
  -->
    <item> in </item>
    <item> infix </item>
    <item> infixl </item>
    <item> infixr </item>
    <item> let </item>
    <item> module </item>
    <item> of </item>
    <item> then </item>
    <item> type </item>
    <item> where </item>
  </list>
  <list name="Prelude Func">
    <item> and </item>
    <item> all </item>
    <item> any </item>
    <item> appendFile </item>
    <item> best </item>
    <item> break </item>
    <item> browse </item>
    <item> browseList </item>
    <item> chr </item>
    <item> concat </item>
    <item> concatMap </item>
    <item> const </item>
    <item> curry </item>
    <item> div </item>
    <item> done </item>
    <item> doSolve </item>
    <item> drop </item>
    <item> dropWhile </item>
    <item> either </item>
    <item> elem </item>
    <item> ensureNotFree </item>
    <item> ensureSpine </item>
    <item> enumFrom </item>
    <item> enumFromThen </item>
    <item> enumFromTo </item>
    <item> enumFromThenTo </item>
    <item> error </item>
    <item> failed </item>
    <item> filter </item>
    <item> findall </item>
    <item> flip </item>
    <item> foldl </item>
    <item> foldl1 </item>
    <item> foldr </item>
    <item> foldr1 </item>
    <item> fst </item>
    <item> getChar </item>
    <item> getLine </item>
    <item> id </item>
    <item> if_then_else </item>
    <item> iterate </item>
    <item> head </item>
    <item> length </item>
    <item> lines </item>
    <item> lookup </item>
    <item> map </item>
    <item> mapIO </item>
    <item> mapIO_ </item>
    <item> max </item>
    <item> maybe </item>
    <item> min </item>
    <item> mod </item>
    <item> negate </item>
    <item> not </item>
    <item> notElem </item>
    <item> null </item>
    <item> once </item>
    <item> or </item>
    <item> ord </item>
    <item> otherwise </item>
    <item> print </item>
    <item> putChar </item>
    <item> putStr </item>
    <item> putStrLn </item>
    <item> readFile </item>
    <item> repeat </item>
    <item> replicate </item>
    <item> return </item>
    <item> reverse </item>
    <item> seq </item>
    <item> sequenceIO </item>
    <item> sequenceIO_ </item>
    <item> show </item>
    <item> snd </item>
    <item> solveAll </item>
    <item> span </item>
    <item> splitAt </item>
    <item> success </item>
    <item> tail </item>
    <item> take </item>
    <item> takeWhile </item>
    <item> try </item>
    <item> uncurry </item>
    <item> unknown </item>
    <item> unlines </item>
    <item> unpack </item>
    <item> until </item>
    <item> unwords </item>
    <item> unzip </item>
    <item> unzip3 </item>
    <item> writeFile </item>
    <item> words </item>
    <item> zip </item>
    <item> zip3 </item>
    <item> zipWith </item>
    <item> zipWith3 </item>
  </list>
  <list name="Prelude Type">
    <item> Bool </item>
    <item> Char </item>
    <item> Either </item>
    <item> Float </item>
    <item> Int </item>
    <item> IO </item>
    <item> Maybe </item>
    <item> Ordering </item>
    <item> String </item>
    <item> Success </item>
  </list>
  <list name="Prelude Cons">
    <item> False </item>
    <item> True </item>
    <item> Left </item>
    <item> Right </item>
    <item> Just </item>
    <item> Nothing </item>
    <item> EQ </item>
    <item> LT </item>
    <item> GT </item>
  </list>
  <contexts>
    <context name="Normal" attribute="Normal" lineEndContext="#stay">
      <!-- pragmas, currydoc, comments -->
      <StringDetect attribute="Pragma"   context="Pragma"            String="{-#"        beginRegion="Pragma"  />
      <Detect2Chars attribute="Comment"  context="Multiline Comment" char="{" char1="-"  beginRegion="Multiline Comment" />
      <StringDetect attribute="Currydoc" context="Currydoc"          String="&currydoc;" />
      <Detect2Chars attribute="Comment"  context="Comment"           char="-" char1="-"  />

      <!-- keywords, Prelude entities -->
      <keyword      attribute="Keyword"             context="#stay"   String="keywords" />
      <keyword      attribute="Prelude Function"    context="#stay"   String="Prelude Func" />
      <keyword      attribute="Prelude Type"        context="#stay"   String="Prelude Type" />
      <keyword      attribute="Prelude Constructor" context="#stay"   String="Prelude Cons" />
      <RegExpr      attribute="Keyword"             context="Import"  String="import\s+(qualified)?" />

      <!-- Literals -->
      <Float        attribute="Float"   context="#stay"   />
      <RegExpr      attribute="Octal"   context="#stay"   String="0(o|O)&octal;" />
      <HlCHex       attribute="Hex"     context="#stay"   />
      <Int          attribute="Decimal" context="#stay"   />
      <DetectChar   attribute="Char"    context="Char"    char="'" />
      <DetectChar   attribute="String"  context="String"  char="&quot;" />

      <!-- Others -->
      <RegExpr      attribute="Special Symbol"    context="#stay"   String="(::|:=|:&gt;|\-&gt;|&lt;\-|\.\.)" />
      <RegExpr      attribute="Signature"         context="#stay"   String="\s*&prefixIdent;\s*(,\s*&prefixIdent;)*\s*(?=::[^&infixchar;])" />
      <RegExpr      attribute="Function"          context="#stay"   String="&qualify;&ident;" />
      <RegExpr      attribute="Operator"          context="#stay"   String="&qualify;[&infixchar;]+" />
      <RegExpr      attribute="Type, Constructor" context="#stay"   String="&qualify;&type;" />
      <DetectChar   attribute="Infix Application" context="Infix"   char="`" />

      <!-- Folding of braces -->
      <DetectChar char="(" context="#stay" beginRegion="nested" attribute="Braces" />
      <DetectChar char=")" context="#stay" endRegion="nested"   attribute="Braces" />
      <DetectChar char="[" context="#stay" beginRegion="list"   attribute="Braces" />
      <DetectChar char="]" context="#stay" endRegion="list"     attribute="Braces" />
      <DetectChar char="{" context="#stay" beginRegion="curly"  attribute="Braces" />
      <DetectChar char="}" context="#stay" endRegion="curly"    attribute="Braces" />
    </context>

    <!-- Pragma -->
    <context name="Pragma" attribute="Pragma" lineEndContext="#stay" >
      <StringDetect attribute="Pragma" context="#pop" String="#-}" endRegion="Pragma" />
    </context>

    <!-- Multiline comment -->
    <context name="Multiline Comment" attribute="Comment" lineEndContext="#stay" >
      <Detect2Chars attribute="Comment" context="#pop" char="-" char1="}" endRegion="Multiline Comment" />
    </context>

    <!-- Currydoc -->
    <context name="Currydoc" attribute="Currydoc" lineEndContext="#pop" />

    <!-- Single line comment -->
    <context name="Comment" attribute="Comment" lineEndContext="#pop" />

    <!-- Import section -->
    <context name="Import" attribute="Normal" lineEndContext="#pop" >
      <!-- pragmas, currydoc, comments -->
      <StringDetect attribute="Pragma"   context="Pragma"            String="{-#"        beginRegion="Pragma"  />
      <Detect2Chars attribute="Comment"  context="Multiline Comment" char="{" char1="-"  beginRegion="Multiline Comment" />
      <StringDetect attribute="Currydoc" context="Currydoc"          String="&currydoc;" />
      <Detect2Chars attribute="Comment"  context="Comment"           char="-" char1="-"  />

      <RegExpr      attribute="Type, Constructor" context="#stay" String="&qualify;&type;" />
      <Detect2Chars attribute="Keyword"           context="#stay" char="a" char1="s" />
      <StringDetect attribute="Keyword"           context="#stay" String="hiding" />
      <!-- Pop context at open paren to highlight imported entities -->
      <DetectChar   attribute="Braces"            context="#pop"   char="(" beginRegion="nested" />
      <RegExpr      attribute="Syntax Error"      context="#stay"  String="\S+" />
    </context>

    <!-- A single characters, with escape sequences -->
    <context name="Char" attribute="Char" lineEndContext="CharSyntaxError" >
      <DetectChar attribute="Syntax Error" context="#pop"       char="'" />
      <DetectChar attribute="Char"         context="CharEscape" char="\" />
      <RegExpr    attribute="Char"         context="CharEnd"    String="[^'&backslash;]" />
    </context>

    <!-- Character escape sequence -->
    <context name="CharEscape" attribute="Char" lineEndContext="#popCharSyntaxError" >
      <AnyChar attribute="Char"         context="#popCharEnd" String="&escSeqChar;"   />
      <RegExpr attribute="Char"         context="#popCharEnd" String="o&octal;"       />
      <RegExpr attribute="Char"         context="#popCharEnd" String="&decimal;"      />
      <RegExpr attribute="Char"         context="#popCharEnd" String="x&hexadecimal;" />
      <RegExpr attribute="Char"         context="#popCharEnd" String="&escSeqCntrl;"  />
      <RegExpr attribute="Char"         context="#popCharEnd" String="&escSeqAscii;"  />
      <RegExpr attribute="Syntax Error" context="#popCharEnd" String="."              />
    </context>

    <!-- Ending quote of character literal -->
    <context name="CharEnd" attribute="Char" lineEndContext="#popCharSyntaxError" >
      <DetectChar attribute="Char"         context="#pop#pop" char="'" />
      <RegExpr    attribute="Syntax Error" context="#stay"    String="." />
    </context>

    <!-- Character syntax error: Newline inside literal -->
    <context name="CharSyntaxError" attribute="Syntax Error" lineEndContext="#stay" >
      <DetectChar attribute="Syntax Error" context="#pop#pop" char="'" />
    </context>

    <!-- A string, with escape sequences -->
    <context name="String" attribute="String" lineEndContext="StringSyntaxError" >
      <DetectChar   attribute="String"        context="#pop"         char="&quot;" />
      <DetectChar   attribute="String Escape" context="StringEscape" char="\" />
      <RegExpr      attribute="String"        context="#stay"        String="[^&quot;&backslash;]*" />
    </context>

    <!-- String escape sequence -->
    <context name="StringEscape" attribute="String" lineEndContext="StringGap" >
      <AnyChar      attribute="String Escape"  context="#pop"      String="&escSeqChar;&amp;" />
      <RegExpr      attribute="String Escape"  context="#pop"      String="o&octal;"          />
      <RegExpr      attribute="String Escape"  context="#pop"      String="&decimal;"         />
      <RegExpr      attribute="String Escape"  context="#pop"      String="x&hexadecimal;"    />
      <RegExpr      attribute="String Escape"  context="#pop"      String="&escSeqCntrl;"     />
      <RegExpr      attribute="String Escape"  context="#pop"      String="&escSeqAscii;"     />
      <DetectSpaces attribute="String Escape"  context="StringGap"                            />
      <RegExpr      attribute="Syntax Error"   context="#pop"      String="."                 />
    </context>

    <context name="StringGap" attribute="String" lineEndContext="#stay" >
      <DetectSpaces attribute="String Escape" context="#stay" />
      <DetectChar   attribute="String Escape" context="#pop#pop#popString" char="\"      />
      <DetectChar   attribute="Syntax Error"  context="#pop#pop#pop"       char="&quot;" />
      <RegExpr      attribute="Syntax Error"  context="#stay"              String="."    />
    </context>

    <!-- String syntax error: Newline inside literal -->
    <context name="StringSyntaxError" attribute="Syntax Error" lineEndContext="#stay" >
      <DetectChar attribute="Syntax Error" context="#pop#pop" char="&quot;" />
    </context>

    <!-- Infix application -->
    <context name="Infix" attribute="Infix Application" lineEndContext="#stay" >
      <DetectChar attribute="Infix Application" context="#pop" char="`"/>
    </context>
  </contexts>

  <itemDatas>
    <itemData name="Normal"              defStyleNum="dsNormal"   spellChecking="false" />

    <!-- Comments -->
    <itemData name="Pragma"              defStyleNum="dsOthers"   spellChecking="false" />
    <itemData name="Comment"             defStyleNum="dsComment"  />
    <itemData name="Currydoc"            defStyleNum="dsComment"  color="#008000" selColor="#FFFFFF"/>

    <!-- Keywords, predefined entities -->
    <itemData name="Keyword"             defStyleNum="dsKeyword"  spellChecking="false" />
    <itemData name="Prelude Type"        defStyleNum="dsDataType" spellChecking="false" />
    <itemData name="Prelude Function"    defStyleNum="dsFunction" spellChecking="false" />
    <itemData name="Prelude Constructor" defStyleNum="dsKeyword"  spellChecking="false" />

    <!-- Literals -->
    <itemData name="Float"               defStyleNum="dsFloat"    spellChecking="false" />
    <itemData name="Octal"               defStyleNum="dsBaseN"    spellChecking="false" />
    <itemData name="Hex"                 defStyleNum="dsBaseN"    spellChecking="false" />
    <itemData name="Decimal"             defStyleNum="dsDecVal"   spellChecking="false" />
    <itemData name="Char"                defStyleNum="dsChar"     spellChecking="false" />
    <itemData name="String Escape"       defStyleNum="dsChar"     spellChecking="false" />
    <itemData name="String"              defStyleNum="dsString"   />

    <!-- Others -->
    <itemData name="Braces"              defStyleNum="dsNormal"   spellChecking="false" />
    <itemData name="Signature"           defStyleNum="dsOthers"   spellChecking="false" />
    <itemData name="Function"            defStyleNum="dsNormal"   spellChecking="false" />
    <itemData name="Operator"            defStyleNum="dsFunction" spellChecking="false" />
    <itemData name="Type, Constructor"   defStyleNum="dsDataType" spellChecking="false" />
    <itemData name="Special Symbol"      defStyleNum="dsOthers"   spellChecking="false" />
    <itemData name="Infix Application"   defStyleNum="dsOthers"   spellChecking="false" />
    <itemData name="Syntax Error"        defStyleNum="dsError"    spellChecking="false" />
  </itemDatas>
  </highlighting>
  <general>
    <folding indentationsensitive="1"/>
    <comments>
      <comment name="singleLine" start="--" />
      <comment name="multiLine" start="{-" end="-}" region="Multiline Comment" />
    </comments>
    <keywords casesensitive="1" />
  </general>
</language>