blob: de4fd1b1f336db51402f6271c81be523720e3ad7 (
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
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<language name="Modula-2 (R10 only)" mimetype="text/x-modula2" version="1"
kateversion="2.2" section="Sources" priority="2" extensions="*.mod;*.def"
casesensitive="1" author="B. Kowarsch (trijezdci@github)" license="MIT">
<!--
*****************************************************************************
Modula-2 R10 syntax highlighting profile for Kate
Copyright (C) 2018 Modula-2 Software Foundation
Licensed under the MIT license <https://opensource.org/licenses/MIT>
A reference for the Modula-2 R10 BSK subset is available online at:
https://github.com/m2sf/m2bsk/wiki/Language-Description
In Modula-2 terminology, keywords are called reserved words.
https://github.com/m2sf/m2bsk/wiki/Language-Description#reserved-words.
Additional reserved words are available in the fulls spec for which the
specification is outdated and being revised. The EBNF is available at:
https://github.com/m2sf/M2-R10-Syntax-Diagrams/blob/master/m2r10-grammar.gll
There are two kinds of built-in identifiers:
(1) Predefined identifiers, also known as pervasives are listed at:
https://github.com/m2sf/m2bsk/wiki/Language-Description#predefined-identifiers
(2) Identifiers provided by built-in Module UNSAFE are listed at:
https://github.com/m2sf/m2bsk/wiki/Language-Description#low-level-facilities
In Modula-2 terminology, there are two kinds of procedures: those that return
a result in their own name, and those that do not. When it is necessary to
differentiate, the former are called function procedures and the latter
proper procedures. For this reason, both function and procedure identifiers
are listed together under a single group "procedures" in this profile.
*****************************************************************************
-->
<highlighting>
<list name="workaround">
<!-- BUG: Kate ignores first entry in context 'Normal' -->
<!-- WORKAROUND: Use the name of this dummy list as first entry -->
<item>???</item> <!-- use '???' in source to test/verify this bug -->
</list>
<!-- Reserved Words -->
<list name="keywords">
<item>ALIAS</item>
<item>AND</item>
<item>ARGLIST</item>
<item>ARRAY</item>
<item>BEGIN</item>
<item>BLUEPRINT</item>
<item>BY</item>
<item>CASE</item>
<item>CONST</item>
<item>COPY</item>
<item>DEFINITION</item>
<item>DIV</item>
<item>DO</item>
<item>ELSE</item>
<item>ELSIF</item>
<item>END</item>
<item>EXIT</item>
<item>FOR</item>
<item>FROM</item>
<item>GENLIB</item>
<item>IF</item>
<item>IMPLEMENTATION</item>
<item>IMPORT</item>
<item>IN</item>
<item>LOOP</item>
<item>MOD</item>
<item>MODULE</item>
<item>NEW</item>
<item>NOT</item>
<item>OF</item>
<item>OPAQUE</item>
<item>OR</item>
<item>POINTER</item>
<item>PROCEDURE</item>
<item>READ</item>
<item>RECORD</item>
<item>REFERENTIAL</item>
<item>RELEASE</item>
<item>REPEAT</item>
<item>RETAIN</item>
<item>RETURN</item>
<item>SET</item>
<item>THEN</item>
<item>TO</item>
<item>TYPE</item>
<item>UNTIL</item>
<item>VAR</item>
<item>WHILE</item>
<item>WRITE</item>
<item>YIELD</item>
</list>
<!-- Built-in Constant Identifiers -->
<list name="constants">
<item>FALSE</item>
<item>NIL</item>
<item>TRUE</item>
</list>
<!-- Built-in Type Identifiers -->
<list name="types">
<!-- Pervasives -->
<item>BOOLEAN</item>
<item>CARDINAL</item>
<item>CHAR</item>
<item>INTEGER</item>
<item>LONGCARD</item>
<item>LONGINT</item>
<item>LONGREAL</item>
<item>OCTET</item>
<item>REAL</item>
<item>UNICHAR</item>
</list>
<!-- Built-in Procedure Identifiers -->
<list name="procedures">
<!-- Pervasives -->
<item>ABS</item>
<item>APPEND</item>
<item>CAPACITY</item>
<item>CHR</item>
<item>COUNT</item>
<item>ENTIER</item>
<item>INSERT</item>
<item>LENGTH</item>
<item>LOG2</item>
<item>MAX</item>
<item>MIN</item>
<item>ODD</item>
<item>ORD</item>
<item>POW2</item>
<item>PRED</item>
<item>PTR</item>
<item>REMOVE</item>
<item>SGN</item>
<item>SUCC</item>
</list>
<!-- Built-in Macros -->
<list name="macros">
<item>TLIMIT</item>
<item>TMAX</item>
<item>TMIN</item>
<item>TSIZE</item>
</list>
<!-- Module UNSAFE -->
<list name="unsafe">
<!-- Reserved Words -->
<item>CAST</item>
<!-- Module Identifier -->
<item>UNSAFE</item>
<!-- Constants -->
<item>BitsPerAddress</item>
<item>BitsPerByte</item>
<item>BytesPerWord</item>
<item>BytesPerLongWord</item>
<!-- Types -->
<item>ADDRESS</item>
<item>BYTE</item>
<item>LONGWORD</item>
<item>OCTETSEQ</item>
<item>WORD</item>
<!-- Procedures -->
<item>ADD</item>
<item>ADR</item>
<item>BIT</item>
<item>BWAND</item>
<item>BWNOT</item>
<item>BWOR</item>
<item>HALT</item>
<item>SETBIT</item>
<item>SHL</item>
<item>SHR</item>
<item>SUB</item>
<!-- Macros -->
<item>NOP</item>
</list>
<contexts>
<context attribute="Plain Source" lineEndContext="#stay" name="plain">
<!-- BUG: first entry is ignored, leave Dummy at first position -->
<keyword attribute="Dummy" context="#stay" String="workaround"/>
<!-- Reserved Words -->
<keyword attribute="Keyword" context="#stay" String="keywords"/>
<!-- Built-in Constant Identifiers -->
<keyword attribute="Const" context="#stay" String="constants"/>
<!-- Built-in Type Identifiers -->
<keyword attribute="Type" context="#stay" String="types"/>
<!-- Built-in Procedure Identifiers -->
<keyword attribute="Builtin" context="#stay" String="procedures"/>
<!-- Built-in Macro Identifiers and Translations -->
<keyword attribute="Builtin" context="#stay" String="macros"/>
<!-- Facilities from Built-in Module UNSAFE -->
<keyword attribute="Unsafe" context="#stay" String="unsafe"/>
<!-- Base-2 Integer Literals -->
<RegExpr attribute="Number" context="#stay"
String="0b([01]+('[01]+)?)+"/>
<!-- Base-16 Integer and Character Code Literals -->
<RegExpr attribute="Number" context="#stay"
String="0[ux]([0-9A-F]+('[0-9A-F]+)?)+"/>
<!-- Real Number Literals -->
<Float attribute="Number" context="#stay"/>
<!-- Decimal Integer Literals -->
<RegExpr attribute="Number" context="#stay"
String="([1-9][0-9]*('[0-9]+)*)|0"/>
<!-- Start of Double-Quoted String Literal -->
<DetectChar attribute="String" context="DoubleQuotedString" char="""/>
<!-- Start of Single-Quoted String Literal -->
<DetectChar attribute="String" context="SingleQuotedString" char="'"/>
<!-- Start of Modula-2 Dialect Tag -->
<StringDetect attribute="DialectTag" context="InDialectTag" String="(*!"/>
<!-- Start of Pragma -->
<Detect2Chars attribute="Pragma" context="InPragma" char="<" char1="*"/>
<!-- Start of Line Comment -->
<DetectChar attribute ="Comment" context="LineComment" char="!"/>
<!-- Start of Block Comment -->
<Detect2Chars attribute="Comment" context="BlockComment"
char="(" char1="*" beginRegion="FoldableComment"/>
</context>
<!-- End of Double-Quoted String Literal -->
<context attribute="String" lineEndContext="#pop" name="DoubleQuotedString">
<DetectChar attribute="String" context="#pop" char="""/>
</context>
<!-- End of Single-Quoted String Literal -->
<context attribute="String" lineEndContext="#pop" name="SingleQuotedString">
<DetectChar attribute="String" context="#pop" char="'" />
</context>
<!-- End of Dialect Tag -->
<context attribute="DialectTag" lineEndContext="#pop" name="InDialectTag">
<Detect2Chars attribute="DialectTag" context="#pop" char="*" char1=")"/>
</context>
<!-- End of Pragma -->
<context attribute="Pragma" lineEndContext="#stay" name="InPragma">
<Detect2Chars attribute="Pragma" context="#pop" char="*" char1=">"/>
</context>
<!-- End of Line Comment -->
<context attribute="Comment" lineEndContext="#pop" name="LineComment">
</context>
<context attribute="Comment" lineEndContext="#stay" name="BlockComment">
<!-- Start of nessted Block Comment -->
<Detect2Chars attribute="Comment"
context="BlockComment" char="(" char1="*" beginRegion="FoldableComment"/>
<!-- End of Block Comment -->
<Detect2Chars attribute="Comment"
context="#pop" char="*" char1=")" endRegion="FoldableComment"/>
</context>
</contexts>
<itemDatas>
<!-- Style for Plain Source Text -->
<itemData name="Plain Source"
defStyleNum="dsNormal" bold="0" italic="0" />
<!-- Style for Reserved Words -->
<itemData name="Keyword"
defStyleNum="dsKeyword" bold="1" italic="0" />
<!-- Style for Built-in Constant Identifiers -->
<itemData name="Const"
defStyleNum="dsBuiltIn" bold="1" italic="0" />
<!-- Style for Built-in Type Identifiers -->
<itemData name="Type"
defStyleNum="dsDataType" bold="1" italic="0" />
<!-- Style for Built-in Procedure Identifiers -->
<itemData name="Builtin"
defStyleNum="dsBuiltIn" bold="1" italic="0" />
<!-- Style for Facilities from Module UNSAFE -->
<itemData name="Unsafe"
defStyleNum="dsWarning" bold="1" italic="0" />
<!-- Style for Number Literals -->
<itemData name="Number"
defStyleNum="dsDecVal" bold="0" italic="0" />
<!-- Style for Quoted Literals -->
<itemData name="String"
defStyleNum="dsString" bold="0" italic="0" />
<!-- Style for Dialect Tags -->
<itemData name="DialectTag"
defStyleNum="dsComment" bold="1" italic="0" />
<!-- Style for Pragmas -->
<itemData name="Pragma"
defStyleNum="dsPreprocessor" bold="1" italic="0" />
<!-- Style for Comments -->
<itemData name="Comment"
defStyleNum="dsComment" bold="0" italic="1" />
<!-- Dummy style for testing -->
<itemData name="Dummy" defStyleNum="dsError" />
</itemDatas>
</highlighting>
<general>
<keywords casesensitive="1" />
<comments>
<comment name="singleLine" start="!" />
<comment name="multiLine" start="(*" end="*)" />
</comments>
</general>
</language>
|