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
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
====================================================================
Julia syntax highlighting file for the TDE editors Kate and Kwrite
====================================================================
This was adapted from the Matlab syntax highlighting file
Most of this XML file is straightforward. Only the character ' (')
needs nontrivial treatment, since it is both a postfix operator indicating
complex conjugate transpose (adjoint) and a character delimiter. It is an
adjoint operator in the following positions:
1) immediately after an identifier (variable, function, but not keyword)
2) immediately after a number literal
3) immediately after the closing parenthesis ), ] and }
4) immediately after a simple transpose operator .'
5) immediately after another adjoint operator '
Otherwise it is a character delimiter.
This is implemented using look-ahead regexps. If one of the entities in the
above cases 1-4 (identifier, number literal, ...) matches and look-ahead
shows that it is followed by a ', the entity is highlighted and control is
passed to the special context _adjoint, whose sole purpose is to correctly
highlight a series of ' (thus covering case 5 as well). _adjoint immediately
returns to the default context _normal.
Author: Timothy E. Holy, Washington University in St. Louis
-->
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Julia" section="Sources" version="1-1" kateversion="2.4" extensions="*.jl" casesensitive="1" priority="5" license="MIT">
<highlighting>
<list name="block_begin">
<item> begin </item>
<item> do </item>
<item> for </item>
<item> function </item>
<item> if </item>
<item> let </item>
<item> quote </item>
<item> try </item>
<item> type </item>
<item> while </item>
</list>
<list name="block_eb">
<item> catch </item>
<item> else </item>
<item> elseif </item>
</list>
<list name="block_end">
<item> end </item>
</list>
<list name="keywords">
<item> abstract </item>
<item> bitstype </item>
<item> break </item>
<item> ccall </item>
<item> const </item>
<item> continue </item>
<item> export </item>
<item> global </item>
<item> import </item>
<item> in </item>
<item> local </item>
<item> macro </item>
<item> module </item>
<item> return </item>
<item> typealias </item>
</list>
<list name="types">
<item> AbstractArray </item>
<item> AbstractMatrix </item>
<item> AbstractVector </item>
<item> Any </item>
<item> Array </item>
<item> ASCIIString </item>
<item> Associative </item>
<item> Bool </item>
<item> ByteString </item>
<item> Char </item>
<item> Complex </item>
<item> Complex64 </item>
<item> Complex128 </item>
<item> ComplexPair </item>
<item> DArray </item>
<item> Dict </item>
<item> Exception </item>
<item> Expr </item>
<item> Float </item>
<item> Float32 </item>
<item> Float64 </item>
<item> Function </item>
<item> ObjectIdDict </item>
<item> Int </item>
<item> Int8 </item>
<item> Int16 </item>
<item> Int32 </item>
<item> Int64 </item>
<item> Integer </item>
<item> IntSet </item>
<item> IO </item>
<item> IOStream </item>
<item> Matrix </item>
<item> Nothing </item>
<item> None </item>
<item> NTuple </item>
<item> Number </item>
<item> Ptr </item>
<item> Range </item>
<item> Range1 </item>
<item> Ranges </item>
<item> Rational </item>
<item> Real </item>
<item> Regex </item>
<item> RegexMatch </item>
<item> Set </item>
<item> Signed </item>
<item> StridedArray </item>
<item> StridedMatrix </item>
<item> StridedVecOrMat </item>
<item> StridedVector </item>
<item> String </item>
<item> SubArray </item>
<item> SubString </item>
<item> Symbol </item>
<item> Task </item>
<item> Tuple </item>
<item> Type </item>
<item> Uint </item>
<item> Uint8 </item>
<item> Uint16 </item>
<item> Uint32 </item>
<item> Uint64 </item>
<item> Union </item>
<item> Unsigned </item>
<item> UTF8String </item>
<item> VecOrMat </item>
<item> Vector </item>
<item> Void </item>
<item> WeakRef </item>
</list>
<contexts>
<context name="_normal" attribute="Normal Text" lineEndContext="#stay">
<DetectSpaces />
<!-- Blocks -->
<keyword context="#stay" attribute="Keyword" String="block_begin"
beginRegion="block" />
<keyword context="#stay" attribute="Keyword" String="block_eb"
endRegion="block" beginRegion="block" />
<keyword context="#stay" attribute="Keyword" String="block_end"
endRegion="block" />
<StringDetect String="#BEGIN" context="region_marker" attribute="FoldingComment" beginRegion="user_region" />
<StringDetect String="#END" context="region_marker" attribute="FoldingComment" endRegion="user_region" />
<!-- Keywords, types, and comments -->
<keyword context="#stay" attribute="Keyword" String="keywords" />
<keyword context="#stay" attribute="Data Type" String="types" />
<DetectChar char="#" context="1-comment" attribute="Comment"/>
<!-- Lists and arrays -->
<!-- <DetectChar char="(" context="nested" beginRegion="nested" attribute="Delimiter" />
<DetectChar char="[" context="squared" beginRegion="squared" attribute="Delimiter" />
<DetectChar char="{" context="curly" beginRegion="curly" attribute="Delimiter" /> -->
<!-- Strings -->
<DetectChar attribute="String" context="String" char="""/>
<!-- Multi-character operators -->
<StringDetect context="#stay" attribute="Operator" String="..."/>
<StringDetect context="#stay" attribute="Operator" String="::"/>
<StringDetect context="#stay" attribute="Operator" String=">>>"/>
<StringDetect context="#stay" attribute="Operator" String=">>"/>
<StringDetect context="#stay" attribute="Operator" String="<<"/>
<StringDetect context="#stay" attribute="Operator" String="=="/>
<StringDetect context="#stay" attribute="Operator" String="!="/>
<StringDetect context="#stay" attribute="Operator" String="<="/>
<StringDetect context="#stay" attribute="Operator" String=">="/>
<StringDetect context="#stay" attribute="Operator" String="&&"/>
<StringDetect context="#stay" attribute="Operator" String="||"/>
<StringDetect context="#stay" attribute="Operator" String=".*"/>
<StringDetect context="#stay" attribute="Operator" String=".^"/>
<StringDetect context="#stay" attribute="Operator" String="./"/>
<StringDetect context="#stay" attribute="Operator" String=".'"/>
<StringDetect context="#stay" attribute="Operator" String="+="/>
<StringDetect context="#stay" attribute="Operator" String="-="/>
<StringDetect context="#stay" attribute="Operator" String="*="/>
<StringDetect context="#stay" attribute="Operator" String="/="/>
<StringDetect context="#stay" attribute="Operator" String="&="/>
<StringDetect context="#stay" attribute="Operator" String="|="/>
<StringDetect context="#stay" attribute="Operator" String="$="/>
<StringDetect context="#stay" attribute="Operator" String=">>>="/>
<StringDetect context="#stay" attribute="Operator" String=">>="/>
<StringDetect context="#stay" attribute="Operator" String="<<="/>
<!-- Look-ahead for adjoint ' after variable, number literal, closing braces and .' -->
<RegExpr context="_adjoint" attribute="Variable" String="[a-zA-Z]\w*(?=')" />
<RegExpr context="_adjoint" attribute="Float" String="(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?(im)?(?=')" />
<RegExpr context="_adjoint" attribute="Delimiter" String="[\)\]}](?=')" />
<RegExpr context="_adjoint" attribute="Operator" String="\.'(?=')" />
<!-- If ' is not the adjoint operator, it starts a character or an unterminated char -->
<RegExpr context="#stay" attribute="Char" String="'[^']*(''[^']*)*'(?=[^']|$)" />
<RegExpr context="#stay" attribute="Incomplete Char" String="'[^']*(''[^']*)*" />
<!-- Identifiers, numbers and braces -->
<!-- We can't use HlCHex, Int, and Float because we need to allow the "im" at the end of complex numbers -->
<DetectIdentifier context="#stay" attribute="Variable" />
<RegExpr context="#stay" attribute="Hex" String="0x[0-9a-fA-F]+(im)?" />
<RegExpr context="#stay" attribute="Float" String="(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?(im)?" />
<AnyChar context="#stay" attribute="Delimiter" String="()[]{}"/>
<!-- Single-character operators -->
<AnyChar context="#stay" attribute="Operator" String="*+-/\&|<>~$!^=,;:@"/>
</context>
<!-- Context for user block (#BEGIN...#END) -->
<context name="region_marker" lineEndContext="#pop" attribute="FoldingComment" >
<IncludeRules context="1-comment" />
</context>
<!-- Contexts entered after beginning a list or array -->
<context name="nested" attribute="Normal text" lineEndContext="#stay">
<DetectChar char=")" context="#pop" endRegion="nested" attribute="Delimiter" />
</context>
<context name="squared" attribute="Normal text" lineEndContext="#stay">
<DetectChar char="]" context="#pop" endRegion="squared" attribute="Delimiter" />
</context>
<context name="curly" attribute="Normal text" lineEndContext="#stay">
<DetectChar char="}" context="#pop" endRegion="curly" attribute="Delimiter" />
</context>
<!-- Context entered after encountering an ' adjoint operator -->
<context name="_adjoint" attribute="Operator" lineEndContext="#pop">
<RegExpr context="#pop" attribute="Operator" String="'+" />
</context>
<!-- Context entered after encountering an " (string) -->
<context attribute="String" lineEndContext="#pop" name="String">
<DetectSpaces />
<DetectIdentifier />
<LineContinue attribute="String" context="#stay"/>
<HlCStringChar attribute="String Char" context="#stay"/>
<DetectChar attribute="String" context="#pop" char="""/>
</context>
<!-- 1-line comment: #pop@EOL -->
<context name="1-comment" lineEndContext="#pop" attribute="Comment">
<DetectSpaces />
<DetectIdentifier />
</context>
</contexts>
<itemDatas>
<itemData name="Normal Text" defStyleNum="dsNormal" />
<itemData name="Variable" defStyleNum="dsNormal" />
<itemData name="Operator" defStyleNum="dsNormal"/>
<itemData name="Decimal" defStyleNum="dsDecVal" />
<itemData name="Float" defStyleNum="dsFloat" />
<itemData name="Hex" defStyleNum="dsBaseN" />
<itemData name="Delimiter" defStyleNum="dsNormal" />
<itemData name="String" defStyleNum="dsString"/>
<itemData name="Char" defStyleNum="dsChar"/>
<itemData name="Incomplete Char" defStyleNum="dsChar"/>
<itemData name="System" defStyleNum="dsBaseN"/>
<itemData name="Keyword" defStyleNum="dsKeyword"/>
<itemData name="Data Type" defStyleNum="dsDataType"/>
<itemData name="Comment" defStyleNum="dsComment"/>
<itemData name="FoldingComment" defStyleNum="dsComment" />
</itemDatas>
</highlighting>
<general>
<comments>
<comment name="singleLine" start="#" />
</comments>
<keywords casesensitive="1" weakDeliminator=""/>
</general>
</language>
<!-- It's recommended to put the following line in the Variables field under Settings->Configure Kate->Open/Save->Modes&Filetypes -->
<!-- kate: space-indent on; indent-width 4; mixed-indent off; indent-mode cstyle; -->
|