-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.apl.js
597 lines (595 loc) · 30.4 KB
/
source.apl.js
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
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/Alhadis/language-apl>
// and licensed `isc`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.apl', '.dyalog'],
names: ['apl'],
patterns: [
{match: '\\A#!.*$', name: 'comment.line.shebang.apl'},
{include: '#heredocs'},
{include: '#main'},
{
begin: '^\\s*((\\))OFF|(\\])NEXTFILE)\\b(.*)$',
beginCaptures: {
1: {name: 'entity.name.command.eof.apl'},
2: {name: 'punctuation.definition.command.apl'},
3: {name: 'punctuation.definition.command.apl'},
4: {patterns: [{include: '#comment'}]}
},
contentName: 'text.embedded.apl',
end: '(?=N)A'
},
{
begin: '\\(',
beginCaptures: {0: {name: 'punctuation.round.bracket.begin.apl'}},
end: '\\)',
endCaptures: {0: {name: 'punctuation.round.bracket.end.apl'}},
name: 'meta.round.bracketed.group.apl',
patterns: [{include: '#main'}]
},
{
begin: '\\[',
beginCaptures: {0: {name: 'punctuation.square.bracket.begin.apl'}},
end: '\\]',
endCaptures: {0: {name: 'punctuation.square.bracket.end.apl'}},
name: 'meta.square.bracketed.group.apl',
patterns: [{include: '#main'}]
},
{
begin: '^\\s*((\\))\\S+)',
beginCaptures: {
1: {name: 'entity.name.command.apl'},
2: {name: 'punctuation.definition.command.apl'}
},
end: '$',
name: 'meta.system.command.apl',
patterns: [
{include: '#command-arguments'},
{include: '#command-switches'},
{include: '#main'}
]
},
{
begin: '^\\s*((\\])\\S+)',
beginCaptures: {
1: {name: 'entity.name.command.apl'},
2: {name: 'punctuation.definition.command.apl'}
},
end: '$',
name: 'meta.user.command.apl',
patterns: [
{include: '#command-arguments'},
{include: '#command-switches'},
{include: '#main'}
]
}
],
repository: {
class: {
patterns: [
{
begin:
"(?x)\n(?<=\\s|^)\n((:)Class)\n\\s+\n(\n\t'[^']*'?\n\t|\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ]\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]*\n)\n\\s*\n(\n\t(:)\n\t\\s*\n\t(?:\n\t\t(\n\t\t\t'[^']*'?\n\t\t\t|\n\t\t\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ]\n\t\t\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]*\n\t\t)\n\t\t\\s*\n\t)?\n)?\n(.*?)$",
beginCaptures: {
0: {name: 'meta.class.apl'},
1: {name: 'keyword.control.class.apl'},
2: {name: 'punctuation.definition.class.apl'},
3: {
name: 'entity.name.type.class.apl',
patterns: [{include: '#strings'}]
},
4: {name: 'entity.other.inherited-class.apl'},
5: {name: 'punctuation.separator.inheritance.apl'},
6: {patterns: [{include: '#strings'}]},
7: {
name: 'entity.other.class.interfaces.apl',
patterns: [{include: '#csv'}]
}
},
end: '(?<=\\s|^)((:)EndClass)(?=\\b)',
endCaptures: {
1: {name: 'keyword.control.class.apl'},
2: {name: 'punctuation.definition.class.apl'}
},
patterns: [
{
begin: '(?<=\\s|^)(:)Field(?=\\s)',
beginCaptures: {
0: {name: 'keyword.control.field.apl'},
1: {name: 'punctuation.definition.field.apl'}
},
end: '\\s*(←.*)?(?:$|(?=⍝))',
endCaptures: {
0: {name: 'entity.other.initial-value.apl'},
1: {patterns: [{include: '#main'}]}
},
name: 'meta.field.apl',
patterns: [
{
match: '(?<=\\s|^)(Public|Private)(?=\\s|$)',
name: 'storage.modifier.access.${1:/downcase}.apl'
},
{
match: '(?<=\\s|^)(Shared|Instance|ReadOnly)(?=\\s|$)',
name: 'storage.modifier.${1:/downcase}.apl'
},
{
captures: {1: {include: '#strings'}},
match:
"(?x)\n(\n\t'[^']*'?\n\t|\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ]\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]*\n)",
name: 'entity.name.type.apl'
}
]
},
{include: '$self'}
]
}
]
},
'command-arguments': {
patterns: [
{
begin: '\\b(?=\\S)',
end: '\\b(?=\\s)',
name: 'variable.parameter.argument.apl',
patterns: [{include: '#main'}]
}
]
},
'command-switches': {
patterns: [
{
begin:
'(?x)\n(?<=\\s)(-)\n(\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ]\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]*\n)\n(=)',
beginCaptures: {
1: {name: 'punctuation.delimiter.switch.apl'},
2: {name: 'entity.name.switch.apl'},
3: {name: 'punctuation.assignment.switch.apl'}
},
end: '\\b(?=\\s)',
name: 'variable.parameter.switch.apl',
patterns: [{include: '#main'}]
},
{
captures: {
1: {name: 'punctuation.delimiter.switch.apl'},
2: {name: 'entity.name.switch.apl'}
},
match:
'(?x)\n(?<=\\s)(-)\n(\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ]\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]*\n)\n(?!=)',
name: 'variable.parameter.switch.apl'
}
]
},
comment: {
begin: '⍝',
captures: {0: {name: 'punctuation.definition.comment.apl'}},
end: '$',
name: 'comment.line.apl'
},
csv: {
patterns: [
{match: ',', name: 'punctuation.separator.apl'},
{include: '$self'}
]
},
definition: {
patterns: [
{
begin:
'(?x) ^\\s*? (?# 1: keyword.operator.nabla.apl) (∇) (?: \\s* (?: (?# 2: entity.function.return-value.apl) ( [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* ) | \\s* (?# 3: entity.function.return-value.shy.apl) ( (\\{) (?# 4: punctuation.definition.return-value.begin.apl) (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )* (\\}) (?# 5: punctuation.definition.return-value.end.apl) | (\\() (?# 6: punctuation.definition.return-value.begin.apl) (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )* (\\)) (?# 7: punctuation.definition.return-value.end.apl) | (\\(\\s*\\{) (?# 8: punctuation.definition.return-value.begin.apl) (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )* (\\}\\s*\\)) (?# 9: punctuation.definition.return-value.end.apl) | (\\{\\s*\\() (?# 10: punctuation.definition.return-value.begin.apl) (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )* (\\)\\s*\\}) (?# 11: punctuation.definition.return-value.end.apl) ) \\s* ) \\s* (?# 12: keyword.operator.assignment.apl) (←) )? \\s* (?: (?# MONADIC) (?: (?# 13: entity.function.name.apl) ( [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* ) \\s* (?# 14: entity.function.axis.apl) ( (?# 15: punctuation.definition.axis.begin.apl) (\\[) \\s* (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* (?# 16: invalid.illegal.extra-characters.apl) (.*?) | (?# 17: invalid.illegal.apl) ([^\\]]*) ) \\s* (?# 18: punctuation.definition.axis.end.apl) (\\]) )? \\s*? (?# 19: entity.function.arguments.right.apl) ( (?<=\\s|\\]) [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* | (\\() (?# 20: punctuation.definition.arguments.begin.apl) (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )* (\\)) (?# 21: punctuation.definition.arguments.end.apl) ) \\s* (?=;|$) ) | (?# DYADIC/AMBIVALENT) (?#==================) (?: (?# 22: entity.function.arguments.left.apl) ( [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s+ ) | (?# 23: entity.function.arguments.left.optional.apl) ( (\\{) (?# 24: punctuation.definition.arguments.begin.apl) (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )* (\\}) (?# 25: punctuation.definition.arguments.end.apl) | (\\(\\s*\\{) (?# 26: punctuation.definition.arguments.begin.apl) (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )* (\\}\\s*\\)) (?# 27: punctuation.definition.arguments.end.apl) | (\\{\\s*\\() (?# 28: punctuation.definition.arguments.begin.apl) (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )* (\\)\\s*\\}) (?# 29: punctuation.definition.arguments.end.apl) ) )? \\s* (?: (?# 30: entity.function.name.apl) ( [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* ) \\s* (?# 31: entity.function.axis.apl) ( (?# 32: punctuation.definition.axis.begin.apl) (\\[) \\s* (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* (?# 33: invalid.illegal.extra-characters.apl) (.*?) | (?# 34: invalid.illegal.apl) ([^\\]]*) ) \\s* (?# 35: punctuation.definition.axis.end.apl) (\\]) )? | (?# 36: entity.function.operands.apl) ( (?# 37: punctuation.definition.operands.begin.apl) (\\() (?# 38: entity.function.operands.left.apl) ( \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* )? \\s* (?# 39: entity.function.name.apl) ( [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* ) \\s*? (?# 40: entity.function.axis.apl) ( (?# 41: punctuation.definition.axis.begin.apl) (\\[) \\s* (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* (?# 42: invalid.illegal.extra-characters.apl) (.*?) | (?# 43: invalid.illegal.apl) ([^\\]]*) ) \\s* (?# 44: punctuation.definition.axis.end.apl) (\\]) )? \\s* (?# 45: entity.function.operands.right.apl) ( [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )? (?# 46: punctuation.definition.operands.end.apl) (\\)) ) ) \\s* (?# 47: entity.function.arguments.right.apl) ( (?<=\\s|\\]) [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* | \\s* (\\() (?# 48: punctuation.definition.arguments.begin.apl) (?: \\s* [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )* (\\)) (?# 49: punctuation.definition.arguments.end.apl) )? (?#==================) ) \\s* (?# 50: invalid.illegal.arguments.right.apl) ([^;]+)? (?# 51: entity.function.local-variables.apl) ( (?# 52: Include “;”) ( (?> \\s* ; (?: \\s* [⎕A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ] [A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]* \\s* )+ )+ ) | (?# 53: invalid.illegal.local-variables.apl) ([^⍝]+) )? \\s* (?# 54: comment.line.apl) (⍝.*)? $',
beginCaptures: {
0: {name: 'entity.function.definition.apl'},
1: {name: 'keyword.operator.nabla.apl'},
10: {name: 'punctuation.definition.return-value.begin.apl'},
11: {name: 'punctuation.definition.return-value.end.apl'},
12: {name: 'keyword.operator.assignment.apl'},
13: {
name: 'entity.function.name.apl',
patterns: [{include: '#embolden'}]
},
14: {name: 'entity.function.axis.apl'},
15: {name: 'punctuation.definition.axis.begin.apl'},
16: {name: 'invalid.illegal.extra-characters.apl'},
17: {name: 'invalid.illegal.apl'},
18: {name: 'punctuation.definition.axis.end.apl'},
19: {name: 'entity.function.arguments.right.apl'},
2: {name: 'entity.function.return-value.apl'},
20: {name: 'punctuation.definition.arguments.begin.apl'},
21: {name: 'punctuation.definition.arguments.end.apl'},
22: {name: 'entity.function.arguments.left.apl'},
23: {name: 'entity.function.arguments.left.optional.apl'},
24: {name: 'punctuation.definition.arguments.begin.apl'},
25: {name: 'punctuation.definition.arguments.end.apl'},
26: {name: 'punctuation.definition.arguments.begin.apl'},
27: {name: 'punctuation.definition.arguments.end.apl'},
28: {name: 'punctuation.definition.arguments.begin.apl'},
29: {name: 'punctuation.definition.arguments.end.apl'},
3: {name: 'entity.function.return-value.shy.apl'},
30: {
name: 'entity.function.name.apl',
patterns: [{include: '#embolden'}]
},
31: {name: 'entity.function.axis.apl'},
32: {name: 'punctuation.definition.axis.begin.apl'},
33: {name: 'invalid.illegal.extra-characters.apl'},
34: {name: 'invalid.illegal.apl'},
35: {name: 'punctuation.definition.axis.end.apl'},
36: {name: 'entity.function.operands.apl'},
37: {name: 'punctuation.definition.operands.begin.apl'},
38: {name: 'entity.function.operands.left.apl'},
39: {
name: 'entity.function.name.apl',
patterns: [{include: '#embolden'}]
},
4: {name: 'punctuation.definition.return-value.begin.apl'},
40: {name: 'entity.function.axis.apl'},
41: {name: 'punctuation.definition.axis.begin.apl'},
42: {name: 'invalid.illegal.extra-characters.apl'},
43: {name: 'invalid.illegal.apl'},
44: {name: 'punctuation.definition.axis.end.apl'},
45: {name: 'entity.function.operands.right.apl'},
46: {name: 'punctuation.definition.operands.end.apl'},
47: {name: 'entity.function.arguments.right.apl'},
48: {name: 'punctuation.definition.arguments.begin.apl'},
49: {name: 'punctuation.definition.arguments.end.apl'},
5: {name: 'punctuation.definition.return-value.end.apl'},
50: {name: 'invalid.illegal.arguments.right.apl'},
51: {name: 'entity.function.local-variables.apl'},
52: {patterns: [{match: ';', name: 'punctuation.separator.apl'}]},
53: {name: 'invalid.illegal.local-variables.apl'},
54: {name: 'comment.line.apl'},
6: {name: 'punctuation.definition.return-value.begin.apl'},
7: {name: 'punctuation.definition.return-value.end.apl'},
8: {name: 'punctuation.definition.return-value.begin.apl'},
9: {name: 'punctuation.definition.return-value.end.apl'}
},
end: '^\\s*?(?:(∇)|(⍫))\\s*?(⍝.*?)?$',
endCaptures: {
1: {name: 'keyword.operator.nabla.apl'},
2: {name: 'keyword.operator.lock.apl'},
3: {name: 'comment.line.apl'}
},
name: 'meta.function.apl',
patterns: [
{
captures: {
0: {name: 'entity.function.local-variables.apl'},
1: {patterns: [{match: ';', name: 'punctuation.separator.apl'}]}
},
match:
'(?x)\n^\\s*\n(\n\t(?>\n\t\t;\n\t\t(?:\n\t\t\t\\s*\n\t\t\t[⎕A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ]\n\t\t\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]*\n\t\t\t\\s*\n\t\t)+\n\t)+\n)',
name: 'entity.function.definition.apl'
},
{include: '$self'}
]
}
]
},
'embedded-apl': {
patterns: [
{
begin: '(?i)(<(\\?|%)(?:apl(?=\\s+)|=))',
beginCaptures: {1: {name: 'punctuation.section.embedded.begin.apl'}},
end: '(?<=\\s)(\\2>)',
endCaptures: {1: {name: 'punctuation.section.embedded.end.apl'}},
name: 'meta.embedded.block.apl',
patterns: [{include: '#main'}]
}
]
},
embolden: {match: '.+', name: 'markup.bold.identifier.apl'},
heredocs: {
patterns: [
{
begin: '^.*?⎕INP\\s+(\'|")((?i).*?HTML?.*?|END-OF-⎕INP)\\1.*$',
beginCaptures: {0: {patterns: [{include: '#main'}]}},
contentName: 'text.embedded.html.basic',
end: '^.*?\\2.*?$',
endCaptures: {0: {name: 'constant.other.apl'}},
name: 'meta.heredoc.apl',
patterns: [{include: 'text.html.basic'}, {include: '#embedded-apl'}]
},
{
begin: '^.*?⎕INP\\s+(\'|")((?i).*?(?:XML|XSLT|SVG|RSS).*?)\\1.*$',
beginCaptures: {0: {patterns: [{include: '#main'}]}},
contentName: 'text.embedded.xml',
end: '^.*?\\2.*?$',
endCaptures: {0: {name: 'constant.other.apl'}},
name: 'meta.heredoc.apl',
patterns: [{include: 'text.xml'}, {include: '#embedded-apl'}]
},
{
begin: '^.*?⎕INP\\s+(\'|")((?i).*?(?:CSS|stylesheet).*?)\\1.*$',
beginCaptures: {0: {patterns: [{include: '#main'}]}},
contentName: 'source.embedded.css',
end: '^.*?\\2.*?$',
endCaptures: {0: {name: 'constant.other.apl'}},
name: 'meta.heredoc.apl',
patterns: [{include: 'source.css'}, {include: '#embedded-apl'}]
},
{
begin:
'^.*?⎕INP\\s+(\'|")((?i).*?(?:JS(?!ON)|(?:ECMA|J|Java).?Script).*?)\\1.*$',
beginCaptures: {0: {patterns: [{include: '#main'}]}},
contentName: 'source.embedded.js',
end: '^.*?\\2.*?$',
endCaptures: {0: {name: 'constant.other.apl'}},
name: 'meta.heredoc.apl',
patterns: [{include: 'source.js'}, {include: '#embedded-apl'}]
},
{
begin: '^.*?⎕INP\\s+(\'|")((?i).*?(?:JSON).*?)\\1.*$',
beginCaptures: {0: {patterns: [{include: '#main'}]}},
contentName: 'source.embedded.json',
end: '^.*?\\2.*?$',
endCaptures: {0: {name: 'constant.other.apl'}},
name: 'meta.heredoc.apl',
patterns: [{include: 'source.json'}, {include: '#embedded-apl'}]
},
{
begin: '^.*?⎕INP\\s+(\'|")(?i)((?:Raw|Plain)?\\s*Te?xt)\\1.*$',
beginCaptures: {0: {patterns: [{include: '#main'}]}},
contentName: 'text.embedded.plain',
end: '^.*?\\2.*?$',
endCaptures: {0: {name: 'constant.other.apl'}},
name: 'meta.heredoc.apl',
patterns: [{include: '#embedded-apl'}]
},
{
begin: '^.*?⎕INP\\s+(\'|")(.*?)\\1.*$',
beginCaptures: {0: {patterns: [{include: '#main'}]}},
end: '^.*?\\2.*?$',
endCaptures: {0: {name: 'constant.other.apl'}},
name: 'meta.heredoc.apl',
patterns: [{include: '$self'}]
}
]
},
label: {
patterns: [
{
captures: {
1: {name: 'entity.label.name.apl'},
2: {name: 'punctuation.definition.label.end.apl'}
},
match:
'(?x)\n^\\s*\n(\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ]\n\t[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]*\n)\n(:)',
name: 'meta.label.apl'
}
]
},
lambda: {
begin: '\\{',
beginCaptures: {0: {name: 'punctuation.definition.lambda.begin.apl'}},
end: '\\}',
endCaptures: {0: {name: 'punctuation.definition.lambda.end.apl'}},
name: 'meta.lambda.function.apl',
patterns: [{include: '#main'}, {include: '#lambda-variables'}]
},
'lambda-variables': {
patterns: [
{match: '⍺⍺', name: 'constant.language.lambda.operands.left.apl'},
{match: '⍵⍵', name: 'constant.language.lambda.operands.right.apl'},
{match: '[⍺⍶]', name: 'constant.language.lambda.arguments.left.apl'},
{match: '[⍵⍹]', name: 'constant.language.lambda.arguments.right.apl'},
{match: 'χ', name: 'constant.language.lambda.arguments.axis.apl'},
{
match: '∇∇',
name: 'constant.language.lambda.operands.self.operator.apl'
},
{
match: '∇',
name: 'constant.language.lambda.operands.self.function.apl'
},
{match: 'λ', name: 'constant.language.lambda.symbol.apl'}
]
},
main: {
patterns: [
{include: '#class'},
{include: '#definition'},
{include: '#comment'},
{include: '#label'},
{include: '#sck'},
{include: '#strings'},
{include: '#number'},
{include: '#lambda'},
{include: '#sysvars'},
{include: '#symbols'},
{include: '#name'}
]
},
name: {
match:
'(?x)\n[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ]\n[A-Z_a-zÀ-ÖØ-Ýßà-öø-üþ∆⍙Ⓐ-Ⓩ¯0-9]*',
name: 'variable.other.readwrite.apl'
},
number: {
match:
'¯?[0-9][¯0-9A-Za-z]*(?:\\.[¯0-9Ee][¯0-9A-Za-z]*)*|¯?\\.[0-9Ee][¯0-9A-Za-z]*',
name: 'constant.numeric.apl'
},
sck: {
patterns: [
{
captures: {1: {name: 'punctuation.definition.sck.begin.apl'}},
match: '(?<=\\s|^)(:)[A-Za-z]+',
name: 'keyword.control.sck.apl'
}
]
},
strings: {
patterns: [
{
begin: "'",
beginCaptures: {0: {name: 'punctuation.definition.string.begin.apl'}},
end: "'|$",
endCaptures: {0: {name: 'punctuation.definition.string.end.apl'}},
name: 'string.quoted.single.apl',
patterns: [
{match: "[^']*[^'\\n\\r\\\\]$", name: 'invalid.illegal.string.apl'}
]
},
{
begin: '"',
beginCaptures: {0: {name: 'punctuation.definition.string.begin.apl'}},
end: '"|$',
endCaptures: {0: {name: 'punctuation.definition.string.end.apl'}},
name: 'string.quoted.double.apl',
patterns: [
{match: '[^"]*[^"\\n\\r\\\\]$', name: 'invalid.illegal.string.apl'}
]
}
]
},
symbols: {
patterns: [
{
match: '(?<=\\s)←(?=\\s|$)',
name: 'keyword.spaced.operator.assignment.apl'
},
{match: '(?<=\\s)→(?=\\s|$)', name: 'keyword.spaced.control.goto.apl'},
{
match: '(?<=\\s)≡(?=\\s|$)',
name: 'keyword.spaced.operator.identical.apl'
},
{
match: '(?<=\\s)≢(?=\\s|$)',
name: 'keyword.spaced.operator.not-identical.apl'
},
{match: '\\+', name: 'keyword.operator.plus.apl'},
{match: '[-−]', name: 'keyword.operator.minus.apl'},
{match: '×', name: 'keyword.operator.times.apl'},
{match: '÷', name: 'keyword.operator.divide.apl'},
{match: '⌊', name: 'keyword.operator.floor.apl'},
{match: '⌈', name: 'keyword.operator.ceiling.apl'},
{match: '[∣|]', name: 'keyword.operator.absolute.apl'},
{match: '[⋆*]', name: 'keyword.operator.exponent.apl'},
{match: '⍟', name: 'keyword.operator.logarithm.apl'},
{match: '○', name: 'keyword.operator.circle.apl'},
{match: '!', name: 'keyword.operator.factorial.apl'},
{match: '∧', name: 'keyword.operator.and.apl'},
{match: '∨', name: 'keyword.operator.or.apl'},
{match: '⍲', name: 'keyword.operator.nand.apl'},
{match: '⍱', name: 'keyword.operator.nor.apl'},
{match: '<', name: 'keyword.operator.less.apl'},
{match: '≤', name: 'keyword.operator.less-or-equal.apl'},
{match: '=', name: 'keyword.operator.equal.apl'},
{match: '≥', name: 'keyword.operator.greater-or-equal.apl'},
{match: '>', name: 'keyword.operator.greater.apl'},
{match: '≠', name: 'keyword.operator.not-equal.apl'},
{match: '[∼~]', name: 'keyword.operator.tilde.apl'},
{match: '\\?', name: 'keyword.operator.random.apl'},
{match: '[∊∈]', name: 'keyword.operator.member-of.apl'},
{match: '⍷', name: 'keyword.operator.find.apl'},
{match: ',', name: 'keyword.operator.comma.apl'},
{match: '⍪', name: 'keyword.operator.comma-bar.apl'},
{match: '⌷', name: 'keyword.operator.squad.apl'},
{match: '⍳', name: 'keyword.operator.iota.apl'},
{match: '⍴', name: 'keyword.operator.rho.apl'},
{match: '↑', name: 'keyword.operator.take.apl'},
{match: '↓', name: 'keyword.operator.drop.apl'},
{match: '⊣', name: 'keyword.operator.left.apl'},
{match: '⊢', name: 'keyword.operator.right.apl'},
{match: '⊤', name: 'keyword.operator.encode.apl'},
{match: '⊥', name: 'keyword.operator.decode.apl'},
{match: '\\/', name: 'keyword.operator.slash.apl'},
{match: '⌿', name: 'keyword.operator.slash-bar.apl'},
{match: '\\x5C', name: 'keyword.operator.backslash.apl'},
{match: '⍀', name: 'keyword.operator.backslash-bar.apl'},
{match: '⌽', name: 'keyword.operator.rotate-last.apl'},
{match: '⊖', name: 'keyword.operator.rotate-first.apl'},
{match: '⍉', name: 'keyword.operator.transpose.apl'},
{match: '⍋', name: 'keyword.operator.grade-up.apl'},
{match: '⍒', name: 'keyword.operator.grade-down.apl'},
{match: '⌹', name: 'keyword.operator.quad-divide.apl'},
{match: '≡', name: 'keyword.operator.identical.apl'},
{match: '≢', name: 'keyword.operator.not-identical.apl'},
{match: '⊂', name: 'keyword.operator.enclose.apl'},
{match: '⊃', name: 'keyword.operator.pick.apl'},
{match: '∩', name: 'keyword.operator.intersection.apl'},
{match: '∪', name: 'keyword.operator.union.apl'},
{match: '⍎', name: 'keyword.operator.hydrant.apl'},
{match: '⍕', name: 'keyword.operator.thorn.apl'},
{match: '⊆', name: 'keyword.operator.underbar-shoe-left.apl'},
{match: '⍸', name: 'keyword.operator.underbar-iota.apl'},
{match: '¨', name: 'keyword.operator.each.apl'},
{match: '⍤', name: 'keyword.operator.rank.apl'},
{match: '⌸', name: 'keyword.operator.quad-equal.apl'},
{match: '⍨', name: 'keyword.operator.commute.apl'},
{match: '⍣', name: 'keyword.operator.power.apl'},
{match: '\\.', name: 'keyword.operator.dot.apl'},
{match: '∘', name: 'keyword.operator.jot.apl'},
{match: '⍠', name: 'keyword.operator.quad-colon.apl'},
{match: '&', name: 'keyword.operator.ampersand.apl'},
{match: '⌶', name: 'keyword.operator.i-beam.apl'},
{match: '⌺', name: 'keyword.operator.quad-diamond.apl'},
{match: '@', name: 'keyword.operator.at.apl'},
{match: '◊', name: 'keyword.operator.lozenge.apl'},
{match: ';', name: 'keyword.operator.semicolon.apl'},
{match: '¯', name: 'keyword.operator.high-minus.apl'},
{match: '←', name: 'keyword.operator.assignment.apl'},
{match: '→', name: 'keyword.control.goto.apl'},
{match: '⍬', name: 'constant.language.zilde.apl'},
{match: '⋄', name: 'keyword.operator.diamond.apl'},
{match: '⍫', name: 'keyword.operator.lock.apl'},
{match: '⎕', name: 'keyword.operator.quad.apl'},
{match: '##', name: 'constant.language.namespace.parent.apl'},
{match: '#', name: 'constant.language.namespace.root.apl'},
{match: '⌻', name: 'keyword.operator.quad-jot.apl'},
{match: '⌼', name: 'keyword.operator.quad-circle.apl'},
{match: '⌾', name: 'keyword.operator.circle-jot.apl'},
{match: '⍁', name: 'keyword.operator.quad-slash.apl'},
{match: '⍂', name: 'keyword.operator.quad-backslash.apl'},
{match: '⍃', name: 'keyword.operator.quad-less.apl'},
{match: '⍄', name: 'keyword.operator.greater.apl'},
{match: '⍅', name: 'keyword.operator.vane-left.apl'},
{match: '⍆', name: 'keyword.operator.vane-right.apl'},
{match: '⍇', name: 'keyword.operator.quad-arrow-left.apl'},
{match: '⍈', name: 'keyword.operator.quad-arrow-right.apl'},
{match: '⍊', name: 'keyword.operator.tack-down.apl'},
{match: '⍌', name: 'keyword.operator.quad-caret-down.apl'},
{match: '⍍', name: 'keyword.operator.quad-del-up.apl'},
{match: '⍏', name: 'keyword.operator.vane-up.apl'},
{match: '⍐', name: 'keyword.operator.quad-arrow-up.apl'},
{match: '⍑', name: 'keyword.operator.tack-up.apl'},
{match: '⍓', name: 'keyword.operator.quad-caret-up.apl'},
{match: '⍔', name: 'keyword.operator.quad-del-down.apl'},
{match: '⍖', name: 'keyword.operator.vane-down.apl'},
{match: '⍗', name: 'keyword.operator.quad-arrow-down.apl'},
{match: '⍘', name: 'keyword.operator.underbar-quote.apl'},
{match: '⍚', name: 'keyword.operator.underbar-diamond.apl'},
{match: '⍛', name: 'keyword.operator.underbar-jot.apl'},
{match: '⍜', name: 'keyword.operator.underbar-circle.apl'},
{match: '⍞', name: 'keyword.operator.quad-quote.apl'},
{match: '⍡', name: 'keyword.operator.dotted-tack-up.apl'},
{match: '⍢', name: 'keyword.operator.dotted-del.apl'},
{match: '⍥', name: 'keyword.operator.dotted-circle.apl'},
{match: '⍦', name: 'keyword.operator.stile-shoe-up.apl'},
{match: '⍧', name: 'keyword.operator.stile-shoe-left.apl'},
{match: '⍩', name: 'keyword.operator.dotted-greater.apl'},
{match: '⍭', name: 'keyword.operator.stile-tilde.apl'},
{match: '⍮', name: 'keyword.operator.underbar-semicolon.apl'},
{match: '⍯', name: 'keyword.operator.quad-not-equal.apl'},
{match: '⍰', name: 'keyword.operator.quad-question.apl'}
]
},
sysvars: {
captures: {
1: {name: 'punctuation.definition.quad.apl'},
2: {name: 'punctuation.definition.quad-quote.apl'}
},
match: '(?:(⎕)|(⍞))[A-Za-z]*',
name: 'support.system.variable.apl'
}
},
scopeName: 'source.apl'
}
export default grammar