@exercism/codemirror-lang-idris 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +98 -2
- package/dist/index.cjs +1039 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +1032 -0
- package/package.json +51 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,1032 @@
|
|
|
1
|
+
import { ExternalTokenizer, ContextTracker, LRParser } from '@lezer/lr';
|
|
2
|
+
import { syntaxTree, indentService, LRLanguage, foldNodeProp, LanguageSupport } from '@codemirror/language';
|
|
3
|
+
import { styleTags, tags } from '@lezer/highlight';
|
|
4
|
+
import { snippetCompletion, completeFromList, ifNotIn } from '@codemirror/autocomplete';
|
|
5
|
+
import { NodeWeakMap } from '@lezer/common';
|
|
6
|
+
|
|
7
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
8
|
+
const LineComment = 1,
|
|
9
|
+
BlockComment = 2,
|
|
10
|
+
DocComment = 3,
|
|
11
|
+
Pragma = 4,
|
|
12
|
+
blockOpen = 164,
|
|
13
|
+
blockEnd = 165,
|
|
14
|
+
blockSep = 166,
|
|
15
|
+
braceOpen = 167,
|
|
16
|
+
braceEnd = 168,
|
|
17
|
+
Qualifier = 5,
|
|
18
|
+
OperatorQualifier = 6,
|
|
19
|
+
DeclName = 7,
|
|
20
|
+
bangPrefix = 169,
|
|
21
|
+
comma = 32,
|
|
22
|
+
closeParen = 38,
|
|
23
|
+
String$1 = 46,
|
|
24
|
+
closeBracket = 55,
|
|
25
|
+
closeBrace = 58,
|
|
26
|
+
where = 66,
|
|
27
|
+
idiomEnd = 76,
|
|
28
|
+
_in = 96,
|
|
29
|
+
then = 99,
|
|
30
|
+
_else = 100,
|
|
31
|
+
of = 104;
|
|
32
|
+
|
|
33
|
+
// The tokenizers for what the grammar can't say by itself. The layout
|
|
34
|
+
// tokenizer, the comment reader and the name lookahead are adapted from the
|
|
35
|
+
// Haskell grammar by CodinCod
|
|
36
|
+
// (https://codeberg.org/reeven/codemirror-lang-haskell, MIT).
|
|
37
|
+
// A line indented further than this is read as a continuation, because the
|
|
38
|
+
// tokenizer only looks this far back to find a line's start.
|
|
39
|
+
const maxIndentation = 400;
|
|
40
|
+
function isSpace(ch) {
|
|
41
|
+
return (ch == 32 /* Ch.Space */ ||
|
|
42
|
+
ch == 9 /* Ch.Tab */ ||
|
|
43
|
+
ch == 10 /* Ch.Newline */ ||
|
|
44
|
+
ch == 13 /* Ch.Return */ ||
|
|
45
|
+
ch == 12 /* Ch.FormFeed */ ||
|
|
46
|
+
ch == 11 /* Ch.VerticalTab */ ||
|
|
47
|
+
ch == 65279 /* Ch.ByteOrderMark */);
|
|
48
|
+
}
|
|
49
|
+
function isDigit(ch) {
|
|
50
|
+
return ch >= 48 /* Ch.Zero */ && ch <= 57 /* Ch.Nine */;
|
|
51
|
+
}
|
|
52
|
+
function isUpper(ch) {
|
|
53
|
+
return ch >= 65 /* Ch.UpperA */ && ch <= 90 /* Ch.UpperZ */;
|
|
54
|
+
}
|
|
55
|
+
function isLower(ch) {
|
|
56
|
+
return ((ch >= 97 /* Ch.LowerA */ && ch <= 122 /* Ch.LowerZ */) ||
|
|
57
|
+
ch == 95 /* Ch.Underscore */ ||
|
|
58
|
+
(ch >= 161 /* Ch.Latin1 */ && ch < 8592 /* Ch.ArrowsFrom */) ||
|
|
59
|
+
(ch >= 9312 /* Ch.LettersAgain */ && ch != 65279 /* Ch.ByteOrderMark */));
|
|
60
|
+
}
|
|
61
|
+
function isIdentifierStart(ch) {
|
|
62
|
+
return isLower(ch) || isUpper(ch);
|
|
63
|
+
}
|
|
64
|
+
function isIdentifierChar(ch) {
|
|
65
|
+
return isIdentifierStart(ch) || isDigit(ch) || ch == 39 /* Ch.Apostrophe */;
|
|
66
|
+
}
|
|
67
|
+
function isSymbol(ch) {
|
|
68
|
+
switch (ch) {
|
|
69
|
+
case 33 /* Ch.Bang */:
|
|
70
|
+
case 35 /* Ch.Hash */:
|
|
71
|
+
case 36 /* Ch.Dollar */:
|
|
72
|
+
case 37 /* Ch.Percent */:
|
|
73
|
+
case 38 /* Ch.Ampersand */:
|
|
74
|
+
case 42 /* Ch.Star */:
|
|
75
|
+
case 43 /* Ch.Plus */:
|
|
76
|
+
case 46 /* Ch.Dot */:
|
|
77
|
+
case 47 /* Ch.Slash */:
|
|
78
|
+
case 60 /* Ch.Less */:
|
|
79
|
+
case 61 /* Ch.Equals */:
|
|
80
|
+
case 62 /* Ch.Greater */:
|
|
81
|
+
case 63 /* Ch.Question */:
|
|
82
|
+
case 64 /* Ch.At */:
|
|
83
|
+
case 92 /* Ch.Backslash */:
|
|
84
|
+
case 94 /* Ch.Caret */:
|
|
85
|
+
case 124 /* Ch.Pipe */:
|
|
86
|
+
case 45 /* Ch.Minus */:
|
|
87
|
+
case 126 /* Ch.Tilde */:
|
|
88
|
+
case 58 /* Ch.Colon */:
|
|
89
|
+
return true;
|
|
90
|
+
default:
|
|
91
|
+
return ch >= 8592 /* Ch.ArrowsFrom */ && ch <= 8959 /* Ch.OperatorsTo */;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function isLineStart(ch) {
|
|
95
|
+
return ch == -1 /* Ch.EOF */ || ch == 10 /* Ch.Newline */ || ch == 13 /* Ch.Return */;
|
|
96
|
+
}
|
|
97
|
+
// The word that starts `offset` characters ahead, or "" if no word starts there.
|
|
98
|
+
function wordAt(input, offset) {
|
|
99
|
+
let word = "";
|
|
100
|
+
for (let pos = offset; isIdentifierChar(input.peek(pos)); pos++) {
|
|
101
|
+
word += String.fromCharCode(input.peek(pos));
|
|
102
|
+
}
|
|
103
|
+
return word;
|
|
104
|
+
}
|
|
105
|
+
// `%default total` and the other directives start with `%` and a word, and
|
|
106
|
+
// they stand on a line of their own.
|
|
107
|
+
function startsPragma(input, offset = 0) {
|
|
108
|
+
if (input.peek(offset) != 37 /* Ch.Percent */ || !isIdentifierStart(input.peek(offset + 1)))
|
|
109
|
+
return false;
|
|
110
|
+
for (let pos = offset - 1;; pos--) {
|
|
111
|
+
const ch = input.peek(pos);
|
|
112
|
+
if (isLineStart(ch))
|
|
113
|
+
return true;
|
|
114
|
+
if (ch != 32 /* Ch.Space */ && ch != 9 /* Ch.Tab */)
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// `|||` starts a documentation comment.
|
|
119
|
+
function startsDocComment(input, offset = 0) {
|
|
120
|
+
return (input.peek(offset) == 124 /* Ch.Pipe */ &&
|
|
121
|
+
input.peek(offset + 1) == 124 /* Ch.Pipe */ &&
|
|
122
|
+
input.peek(offset + 2) == 124 /* Ch.Pipe */ &&
|
|
123
|
+
!isSymbol(input.peek(offset + 3)));
|
|
124
|
+
}
|
|
125
|
+
// A line comment is two or more dashes with no other symbol after them, which
|
|
126
|
+
// keeps `-->` an operator.
|
|
127
|
+
function startsComment(input, offset = 0) {
|
|
128
|
+
const next = input.peek(offset);
|
|
129
|
+
if (next == 123 /* Ch.BraceL */)
|
|
130
|
+
return input.peek(offset + 1) == 45 /* Ch.Minus */;
|
|
131
|
+
if (startsDocComment(input, offset))
|
|
132
|
+
return true;
|
|
133
|
+
if (next != 45 /* Ch.Minus */ || input.peek(offset + 1) != 45 /* Ch.Minus */)
|
|
134
|
+
return false;
|
|
135
|
+
let pos = offset + 2;
|
|
136
|
+
while (input.peek(pos) == 45 /* Ch.Minus */)
|
|
137
|
+
pos++;
|
|
138
|
+
return !isSymbol(input.peek(pos));
|
|
139
|
+
}
|
|
140
|
+
function startsSkipped(input, offset = 0) {
|
|
141
|
+
return startsComment(input, offset) || startsPragma(input, offset);
|
|
142
|
+
}
|
|
143
|
+
function toLineEnd(input, from) {
|
|
144
|
+
let pos = from;
|
|
145
|
+
while (!isLineStart(input.peek(pos)))
|
|
146
|
+
pos++;
|
|
147
|
+
return pos;
|
|
148
|
+
}
|
|
149
|
+
// ── Comments ──────────────────────────────────────────────────────────────────
|
|
150
|
+
/// Block comments nest, so `{- {- -} -}` is one comment. Counting the depth is
|
|
151
|
+
/// why comments are read here and not by a token rule. `|||` lines are
|
|
152
|
+
/// documentation, and `%default total` and the other directives are pragmas.
|
|
153
|
+
const comments = new ExternalTokenizer((input) => {
|
|
154
|
+
if (startsPragma(input)) {
|
|
155
|
+
input.acceptToken(Pragma, toLineEnd(input, 0));
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (startsDocComment(input)) {
|
|
159
|
+
input.acceptToken(DocComment, toLineEnd(input, 0));
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (input.next == 45 /* Ch.Minus */) {
|
|
163
|
+
if (!startsComment(input))
|
|
164
|
+
return;
|
|
165
|
+
input.acceptToken(LineComment, toLineEnd(input, 2));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (input.next != 123 /* Ch.BraceL */ || input.peek(1) != 45 /* Ch.Minus */)
|
|
169
|
+
return;
|
|
170
|
+
let depth = 0;
|
|
171
|
+
for (let pos = 0;; pos++) {
|
|
172
|
+
const ch = input.peek(pos);
|
|
173
|
+
if (ch == -1 /* Ch.EOF */) {
|
|
174
|
+
input.acceptToken(BlockComment, pos);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (ch == 123 /* Ch.BraceL */ && input.peek(pos + 1) == 45 /* Ch.Minus */) {
|
|
178
|
+
depth++;
|
|
179
|
+
pos++;
|
|
180
|
+
}
|
|
181
|
+
else if (ch == 45 /* Ch.Minus */ && input.peek(pos + 1) == 125 /* Ch.BraceR */) {
|
|
182
|
+
depth--;
|
|
183
|
+
pos++;
|
|
184
|
+
if (!depth) {
|
|
185
|
+
input.acceptToken(BlockComment, pos + 1);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
// ── Layout ────────────────────────────────────────────────────────────────────
|
|
192
|
+
/// One open block: the column its items line up on, and whether somebody wrote
|
|
193
|
+
/// the brace. A block with a written brace has no column.
|
|
194
|
+
class Layout {
|
|
195
|
+
constructor(parent, column, explicit) {
|
|
196
|
+
this.parent = parent;
|
|
197
|
+
this.column = column;
|
|
198
|
+
this.explicit = explicit;
|
|
199
|
+
this.hash = (parent ? parent.hash * 31 : 0) + column * 2 + (explicit ? 1 : 0);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const noLayout = new Layout(null, -1, false);
|
|
203
|
+
// The column of the current position, and whether only whitespace stands in
|
|
204
|
+
// front of it on its line. Idris counts a tab as one column, like any other
|
|
205
|
+
// character, and solutions that mix tabs and spaces line up that way.
|
|
206
|
+
function lineInfo(input) {
|
|
207
|
+
const before = [];
|
|
208
|
+
for (let offset = -1; offset > -maxIndentation; offset--) {
|
|
209
|
+
const ch = input.peek(offset);
|
|
210
|
+
if (isLineStart(ch))
|
|
211
|
+
break;
|
|
212
|
+
before.push(ch);
|
|
213
|
+
}
|
|
214
|
+
let column = 0, firstOnLine = true;
|
|
215
|
+
for (let pos = before.length - 1; pos >= 0; pos--) {
|
|
216
|
+
const ch = before[pos];
|
|
217
|
+
column++;
|
|
218
|
+
if (!isSpace(ch))
|
|
219
|
+
firstOnLine = false;
|
|
220
|
+
}
|
|
221
|
+
return { column, firstOnLine };
|
|
222
|
+
}
|
|
223
|
+
// A block also closes where the parser would otherwise fail. That ends the
|
|
224
|
+
// block in `let x = 1 in x`, where nothing is indented differently. These are
|
|
225
|
+
// the tokens that often stand behind a block, so the parser is asked whether it
|
|
226
|
+
// can take them.
|
|
227
|
+
function closesBlock(input, stack) {
|
|
228
|
+
switch (input.next) {
|
|
229
|
+
case 41 /* Ch.ParenR */:
|
|
230
|
+
return !stack.canShift(closeParen);
|
|
231
|
+
case 93 /* Ch.BracketR */:
|
|
232
|
+
return !stack.canShift(closeBracket);
|
|
233
|
+
case 125 /* Ch.BraceR */:
|
|
234
|
+
return !stack.canShift(closeBrace);
|
|
235
|
+
case 44 /* Ch.Comma */:
|
|
236
|
+
return !stack.canShift(comma);
|
|
237
|
+
case 124 /* Ch.Pipe */:
|
|
238
|
+
return input.peek(1) == 93 /* Ch.BracketR */ && !stack.canShift(idiomEnd);
|
|
239
|
+
}
|
|
240
|
+
if (!isIdentifierStart(input.next))
|
|
241
|
+
return false;
|
|
242
|
+
switch (wordAt(input, 0)) {
|
|
243
|
+
case "in":
|
|
244
|
+
return !stack.canShift(_in);
|
|
245
|
+
case "then":
|
|
246
|
+
return !stack.canShift(then);
|
|
247
|
+
case "else":
|
|
248
|
+
return !stack.canShift(_else);
|
|
249
|
+
case "of":
|
|
250
|
+
return !stack.canShift(of);
|
|
251
|
+
case "where":
|
|
252
|
+
return !stack.canShift(where);
|
|
253
|
+
default:
|
|
254
|
+
return false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/// The braces and semicolons Idris doesn't write. A block opens at the column
|
|
258
|
+
/// of its first token. A line that starts at that column starts a new item, and
|
|
259
|
+
/// the first line that starts further left ends the block. A block also ends
|
|
260
|
+
/// where the parser would fail, and at the end of the file.
|
|
261
|
+
///
|
|
262
|
+
/// If a block's first token stands no further right than the block around it,
|
|
263
|
+
/// the block is empty and closes where it opened. That lets a `where` with
|
|
264
|
+
/// nothing under it be followed by a declaration at the left margin.
|
|
265
|
+
const layout = new ExternalTokenizer((input, stack) => {
|
|
266
|
+
const cx = stack.context;
|
|
267
|
+
const implicit = cx.parent != null && !cx.explicit;
|
|
268
|
+
if (input.next == -1 /* Ch.EOF */) {
|
|
269
|
+
if (stack.canShift(blockOpen))
|
|
270
|
+
input.acceptToken(blockOpen);
|
|
271
|
+
else if (implicit && stack.canShift(blockEnd))
|
|
272
|
+
input.acceptToken(blockEnd);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (isSpace(input.next) || startsSkipped(input))
|
|
276
|
+
return;
|
|
277
|
+
if (input.next == 125 /* Ch.BraceR */ && cx.explicit && stack.canShift(braceEnd)) {
|
|
278
|
+
input.advance();
|
|
279
|
+
input.acceptToken(braceEnd);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (input.next == 123 /* Ch.BraceL */ && input.peek(1) != 45 /* Ch.Minus */ && stack.canShift(braceOpen)) {
|
|
283
|
+
input.advance();
|
|
284
|
+
input.acceptToken(braceOpen);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (stack.canShift(blockOpen)) {
|
|
288
|
+
// `failing "Mismatch"` names the error before its block opens.
|
|
289
|
+
if (input.next == 34 /* Ch.Quote */ && stack.canShift(String$1))
|
|
290
|
+
return;
|
|
291
|
+
input.acceptToken(blockOpen);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
if (!implicit)
|
|
295
|
+
return;
|
|
296
|
+
if (cx.column <= cx.parent.column && stack.canShift(blockEnd)) {
|
|
297
|
+
input.acceptToken(blockEnd);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (closesBlock(input, stack) && stack.canShift(blockEnd)) {
|
|
301
|
+
input.acceptToken(blockEnd);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
const { column, firstOnLine } = lineInfo(input);
|
|
305
|
+
if (!firstOnLine)
|
|
306
|
+
return;
|
|
307
|
+
if (column > cx.column)
|
|
308
|
+
return;
|
|
309
|
+
// No item in a block starts with `where`, so a `where` at the column of the
|
|
310
|
+
// items belongs to the declaration above it. If the declaration can take
|
|
311
|
+
// the `where` straight away, as one at the left margin can, the block goes
|
|
312
|
+
// on. Otherwise the `where` closes the block, which lets it line up with the
|
|
313
|
+
// alternatives of a `case`.
|
|
314
|
+
if (column == cx.column && wordAt(input, 0) == "where") {
|
|
315
|
+
if (!stack.canShift(where) && stack.canShift(blockEnd))
|
|
316
|
+
input.acceptToken(blockEnd);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (column < cx.column) {
|
|
320
|
+
if (stack.canShift(blockEnd))
|
|
321
|
+
input.acceptToken(blockEnd);
|
|
322
|
+
}
|
|
323
|
+
else if (stack.canShift(blockSep)) {
|
|
324
|
+
input.acceptToken(blockSep);
|
|
325
|
+
}
|
|
326
|
+
}, { contextual: true });
|
|
327
|
+
/// The stack of open blocks. Each block remembers the column it opened on, and
|
|
328
|
+
/// the tokenizer above compares every line with the block on top.
|
|
329
|
+
const trackLayout = new ContextTracker({
|
|
330
|
+
start: noLayout,
|
|
331
|
+
shift(context, term, stack, input) {
|
|
332
|
+
var _a;
|
|
333
|
+
if (term == blockOpen)
|
|
334
|
+
return new Layout(context, lineInfo(input).column, false);
|
|
335
|
+
if (term == braceOpen)
|
|
336
|
+
return new Layout(context, -1, true);
|
|
337
|
+
if (term == blockEnd || term == braceEnd)
|
|
338
|
+
return (_a = context.parent) !== null && _a !== void 0 ? _a : context;
|
|
339
|
+
return context;
|
|
340
|
+
},
|
|
341
|
+
hash: (context) => context.hash,
|
|
342
|
+
});
|
|
343
|
+
// ── Names ─────────────────────────────────────────────────────────────────────
|
|
344
|
+
/// The module part of a name. `Data.Vect.index` is one name, and its dots are
|
|
345
|
+
/// not the composition operator, so the module part is read here as its own
|
|
346
|
+
/// token.
|
|
347
|
+
const qualifiers = new ExternalTokenizer((input, stack) => {
|
|
348
|
+
if (!isUpper(input.next))
|
|
349
|
+
return;
|
|
350
|
+
let pos = 0, end = 0, operator = false;
|
|
351
|
+
for (;;) {
|
|
352
|
+
if (!isUpper(input.peek(pos)))
|
|
353
|
+
break;
|
|
354
|
+
while (isIdentifierChar(input.peek(pos)))
|
|
355
|
+
pos++;
|
|
356
|
+
if (input.peek(pos) != 46 /* Ch.Dot */)
|
|
357
|
+
break;
|
|
358
|
+
const after = input.peek(pos + 1);
|
|
359
|
+
if (!isIdentifierStart(after) && !isSymbol(after))
|
|
360
|
+
break;
|
|
361
|
+
pos++;
|
|
362
|
+
end = pos;
|
|
363
|
+
operator = isSymbol(after);
|
|
364
|
+
}
|
|
365
|
+
if (!end)
|
|
366
|
+
return;
|
|
367
|
+
const term = operator ? OperatorQualifier : Qualifier;
|
|
368
|
+
if (stack.canShift(term))
|
|
369
|
+
input.acceptToken(term, end);
|
|
370
|
+
});
|
|
371
|
+
const reserved = new Set([
|
|
372
|
+
"auto",
|
|
373
|
+
"case",
|
|
374
|
+
"constructor",
|
|
375
|
+
"covering",
|
|
376
|
+
"data",
|
|
377
|
+
"default",
|
|
378
|
+
"do",
|
|
379
|
+
"else",
|
|
380
|
+
"export",
|
|
381
|
+
"failing",
|
|
382
|
+
"forall",
|
|
383
|
+
"if",
|
|
384
|
+
"implementation",
|
|
385
|
+
"import",
|
|
386
|
+
"impossible",
|
|
387
|
+
"in",
|
|
388
|
+
"infix",
|
|
389
|
+
"infixl",
|
|
390
|
+
"infixr",
|
|
391
|
+
"interface",
|
|
392
|
+
"let",
|
|
393
|
+
"module",
|
|
394
|
+
"mutual",
|
|
395
|
+
"namespace",
|
|
396
|
+
"of",
|
|
397
|
+
"parameters",
|
|
398
|
+
"partial",
|
|
399
|
+
"private",
|
|
400
|
+
"proof",
|
|
401
|
+
"public",
|
|
402
|
+
"record",
|
|
403
|
+
"rewrite",
|
|
404
|
+
"then",
|
|
405
|
+
"total",
|
|
406
|
+
"where",
|
|
407
|
+
"with",
|
|
408
|
+
"_",
|
|
409
|
+
]);
|
|
410
|
+
/// The name a declaration declares. `f x = x` declares `f`, and so does
|
|
411
|
+
/// `f : Int -> Int`, but `xs ++ ys = ...` declares the operator between the two
|
|
412
|
+
/// names. Which one it is depends on what follows the name, so the tokenizer
|
|
413
|
+
/// looks one token ahead.
|
|
414
|
+
///
|
|
415
|
+
/// An operator after the name means the name isn't the one being declared,
|
|
416
|
+
/// except for `:` and `:=`, which start a signature or a body, and `=` and `|`,
|
|
417
|
+
/// which start a body or a `with` pattern. A backtick means somebody is
|
|
418
|
+
/// declaring an infix function. Anything else, such as another name, a literal,
|
|
419
|
+
/// a bracket or a comma, leaves the name a declaration.
|
|
420
|
+
const declNames = new ExternalTokenizer((input, stack) => {
|
|
421
|
+
if (!isLower(input.next) || !stack.canShift(DeclName))
|
|
422
|
+
return;
|
|
423
|
+
let pos = 0;
|
|
424
|
+
while (isIdentifierChar(input.peek(pos)))
|
|
425
|
+
pos++;
|
|
426
|
+
if (reserved.has(wordAt(input, 0)))
|
|
427
|
+
return;
|
|
428
|
+
if (input.peek(pos) == 46 /* Ch.Dot */)
|
|
429
|
+
return;
|
|
430
|
+
let scan = pos;
|
|
431
|
+
for (;;) {
|
|
432
|
+
if (isSpace(input.peek(scan))) {
|
|
433
|
+
scan++;
|
|
434
|
+
}
|
|
435
|
+
else if (startsComment(input, scan) && input.peek(scan) == 45 /* Ch.Minus */) {
|
|
436
|
+
scan = toLineEnd(input, scan);
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
const next = input.peek(scan);
|
|
443
|
+
if (next == 96 /* Ch.Backtick */)
|
|
444
|
+
return;
|
|
445
|
+
if (isSymbol(next) && !startsDocComment(input, scan)) {
|
|
446
|
+
const second = input.peek(scan + 1), third = input.peek(scan + 2);
|
|
447
|
+
const signature = next == 58 /* Ch.Colon */ && !isSymbol(second);
|
|
448
|
+
const assign = next == 58 /* Ch.Colon */ && second == 61 /* Ch.Equals */ && !isSymbol(third);
|
|
449
|
+
const body = (next == 61 /* Ch.Equals */ || next == 124 /* Ch.Pipe */) && !isSymbol(second);
|
|
450
|
+
if (!signature && !assign && !body)
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
input.acceptToken(DeclName, pos);
|
|
454
|
+
});
|
|
455
|
+
/// The `!` of bang notation, which runs an action inside an expression. It is
|
|
456
|
+
/// written against what follows it, and `a ! b` with spaces is an operator.
|
|
457
|
+
const bangs = new ExternalTokenizer((input, stack) => {
|
|
458
|
+
if (input.next != 33 /* Ch.Bang */ || !stack.canShift(bangPrefix))
|
|
459
|
+
return;
|
|
460
|
+
const before = input.peek(-1);
|
|
461
|
+
const opensBefore = before == -1 /* Ch.EOF */ ||
|
|
462
|
+
isSpace(before) ||
|
|
463
|
+
before == 40 /* Ch.ParenL */ ||
|
|
464
|
+
before == 91 /* Ch.BracketL */ ||
|
|
465
|
+
before == 123 /* Ch.BraceL */ ||
|
|
466
|
+
before == 44 /* Ch.Comma */ ||
|
|
467
|
+
before == 59 /* Ch.Semicolon */ ||
|
|
468
|
+
before == 36 /* Ch.Dollar */;
|
|
469
|
+
if (!opensBefore)
|
|
470
|
+
return;
|
|
471
|
+
const after = input.peek(1);
|
|
472
|
+
if (after == -1 /* Ch.EOF */ || isSpace(after) || isSymbol(after))
|
|
473
|
+
return;
|
|
474
|
+
if (after == 41 /* Ch.ParenR */ || after == 93 /* Ch.BracketR */ || after == 125 /* Ch.BraceR */ || after == 44 /* Ch.Comma */)
|
|
475
|
+
return;
|
|
476
|
+
input.acceptToken(bangPrefix, 1);
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
480
|
+
const spec_varid = {__proto__:null,public:20, export:22, private:24, total:26, partial:28, covering:30, module:34, import:40, as:43, infixl:46, infixr:48, infix:50, prefix:53, data:68, forall:88, _:90, auto:122, default:124, where:132, let:148, case:182, impossible:186, in:192, if:196, then:198, else:200, rewrite:204, of:208, do:212, record:226, constructor:232, interface:236, implementation:240, namespace:246, mutual:250, parameters:254, failing:258, with:268, proof:270};
|
|
481
|
+
const spec_varsym = {__proto__:null,"@":98, "=":100, "\\":102, "->":104, "=>":106, "|":128, "..":144, "<-":150, "$=":166};
|
|
482
|
+
const spec_consym = {__proto__:null,":":108, ":=":164};
|
|
483
|
+
const parser = LRParser.deserialize({
|
|
484
|
+
version: 14,
|
|
485
|
+
states: "!.`OcQsOOO$jQ!aO'#GOO$tQ!aO'#GOQOQqOOO%dQ!aO'#CeOOQg'#Cx'#CxO(_QqO'#CxOOQg'#Cy'#CyO(gQuO'#C{OOQg'#GT'#GTOOQg'#Dr'#DrO(rQqO'#DrOOQg'#D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W'Q'['a'n'x'}(R(T(W(Y(m(o(p(q)O)Q)R)V)X)Y)u)|*V*lS#PnuQ#WsR%X#XQ)j(]Q*c)hR*u*d^!ePQ{!f#n#p$sR&y$oQ!hQQ$r!fR&}$s",
|
|
488
|
+
nodeNames: "⚠ LineComment BlockComment DocComment Pragma Qualifier OperatorQualifier DeclName Module Modifiers public export private total partial covering ModuleHeader module ModuleName ImportDeclaration import as FixityDeclaration infixl infixr infix prefix Number Operator ConstructorOperator ` BacktickOperator , DataDeclaration data DataHead TypeConstructor TypeVariable ) ( ParenType Type TypeOperator TypeConstructorOperator forall Wildcard String Char Hole @ = \\ -> => : ] [ ListType } { BraceType auto default ConstructorDeclaration | WhereBlock where GadtSignature Constructor ParenExpression Variable ListExpression .. LetStatement let <- |] [| IdiomExpression BraceArgument FieldPath Projection := $= FieldExpression BangExpression AsPattern ApplyExpression Callee LambdaExpression Type case CaseAlternative impossible ; LetExpression in IfExpression if then else RewriteExpression rewrite CaseExpression of DoExpression do BindStatement OperatorExpression ApplyExpression ApplyExpression ApplyExpression RecordDeclaration record WhereBlock RecordConstructor constructor InterfaceDeclaration interface ImplementationDeclaration implementation ImplementationDeclaration NamespaceDeclaration namespace MutualDeclaration mutual ParametersDeclaration parameters FailingDeclaration failing TypeSignature Bind WithPattern WithClause with proof",
|
|
489
|
+
maxTerm: 210,
|
|
490
|
+
context: trackLayout,
|
|
491
|
+
nodeProps: [
|
|
492
|
+
["openedBy", 38,"(",55,"[",58,"{",76,"[|"],
|
|
493
|
+
["closedBy", 39,")",56,"]",59,"}",77,"|]"],
|
|
494
|
+
["isolate", 46,""]
|
|
495
|
+
],
|
|
496
|
+
skippedNodes: [0,1,2,3,4],
|
|
497
|
+
repeatNodeCount: 27,
|
|
498
|
+
tokenData: "9^~R!RXY$[YZ$[Z[$[[]$[]^$[pq$[qr$vrs&^st$vtu$vuv$vvw$vwx'gxy)dyz)iz{$v{|$v|})n}!O$v!O!P)s!P!Q$v!Q!R,k!R![.i![!]0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id[value] || -1},{term: 178, get: (value) => spec_varsym[value] || -1},{term: 179, get: (value) => spec_consym[value] || -1}],
|
|
502
|
+
tokenPrec: 4067
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
// The scoped completion is adapted from the Haskell grammar by CodinCod
|
|
506
|
+
// (https://codeberg.org/reeven/codemirror-lang-haskell, MIT), which follows
|
|
507
|
+
// `@codemirror/lang-go`'s `localCompletionSource`.
|
|
508
|
+
/// Snippets for the constructs people write most often in Idris.
|
|
509
|
+
const snippets = [
|
|
510
|
+
snippetCompletion("${name} : ${Type}\n${name} ${args} = ${}", {
|
|
511
|
+
label: "fun",
|
|
512
|
+
detail: "function with signature",
|
|
513
|
+
type: "keyword",
|
|
514
|
+
}),
|
|
515
|
+
snippetCompletion("case ${expression} of\n\t${pattern} => ${}", {
|
|
516
|
+
label: "case",
|
|
517
|
+
detail: "expression",
|
|
518
|
+
type: "keyword",
|
|
519
|
+
}),
|
|
520
|
+
snippetCompletion("if ${condition} then ${} else ${}", {
|
|
521
|
+
label: "if",
|
|
522
|
+
detail: "then else",
|
|
523
|
+
type: "keyword",
|
|
524
|
+
}),
|
|
525
|
+
snippetCompletion("let ${name} = ${value} in ${}", {
|
|
526
|
+
label: "let",
|
|
527
|
+
detail: "in",
|
|
528
|
+
type: "keyword",
|
|
529
|
+
}),
|
|
530
|
+
snippetCompletion("where\n\t${name} : ${Type}\n\t${name} = ${}", {
|
|
531
|
+
label: "where",
|
|
532
|
+
detail: "block",
|
|
533
|
+
type: "keyword",
|
|
534
|
+
}),
|
|
535
|
+
snippetCompletion("do\n\t${}", {
|
|
536
|
+
label: "do",
|
|
537
|
+
detail: "block",
|
|
538
|
+
type: "keyword",
|
|
539
|
+
}),
|
|
540
|
+
snippetCompletion("\\${x} => ${}", {
|
|
541
|
+
label: "\\",
|
|
542
|
+
detail: "lambda",
|
|
543
|
+
type: "keyword",
|
|
544
|
+
}),
|
|
545
|
+
snippetCompletion("with (${expression})\n\t_ | ${pattern} = ${}", {
|
|
546
|
+
label: "with",
|
|
547
|
+
detail: "match on an expression",
|
|
548
|
+
type: "keyword",
|
|
549
|
+
}),
|
|
550
|
+
snippetCompletion("data ${Name} = ${Constructor}", {
|
|
551
|
+
label: "data",
|
|
552
|
+
detail: "type definition",
|
|
553
|
+
type: "keyword",
|
|
554
|
+
}),
|
|
555
|
+
snippetCompletion("data ${Name} : ${Type} where\n\t${Constructor} : ${Name}", {
|
|
556
|
+
label: "data",
|
|
557
|
+
detail: "with constructor signatures",
|
|
558
|
+
type: "keyword",
|
|
559
|
+
}),
|
|
560
|
+
snippetCompletion("record ${Name} where\n\tconstructor Mk${Name}\n\t${field} : ${Type}", {
|
|
561
|
+
label: "record",
|
|
562
|
+
detail: "definition",
|
|
563
|
+
type: "keyword",
|
|
564
|
+
}),
|
|
565
|
+
snippetCompletion("interface ${Name} ${a} where\n\t${method} : ${a} -> ${}", {
|
|
566
|
+
label: "interface",
|
|
567
|
+
detail: "definition",
|
|
568
|
+
type: "keyword",
|
|
569
|
+
}),
|
|
570
|
+
snippetCompletion("implementation ${Interface} ${Type} where\n\t${method} = ${}", {
|
|
571
|
+
label: "implementation",
|
|
572
|
+
detail: "definition",
|
|
573
|
+
type: "keyword",
|
|
574
|
+
}),
|
|
575
|
+
snippetCompletion("public export\n${name} : ${Type}\n${name} = ${}", {
|
|
576
|
+
label: "public export",
|
|
577
|
+
detail: "exported function",
|
|
578
|
+
type: "keyword",
|
|
579
|
+
}),
|
|
580
|
+
snippetCompletion("import ${Data.List}", {
|
|
581
|
+
label: "import",
|
|
582
|
+
detail: "module",
|
|
583
|
+
type: "keyword",
|
|
584
|
+
}),
|
|
585
|
+
snippetCompletion("module ${Name}\n\n${}", {
|
|
586
|
+
label: "module",
|
|
587
|
+
detail: "header",
|
|
588
|
+
type: "keyword",
|
|
589
|
+
}),
|
|
590
|
+
];
|
|
591
|
+
const keywords = ("module import public export private namespace where let in do case of if then else " +
|
|
592
|
+
"data record constructor interface implementation with proof rewrite impossible " +
|
|
593
|
+
"mutual parameters failing total partial covering auto default forall infix infixl infixr prefix")
|
|
594
|
+
.split(" ")
|
|
595
|
+
.map((label) => ({ label, type: "keyword" }));
|
|
596
|
+
// The Prelude is in scope in every file. The base names below come from the
|
|
597
|
+
// modules Exercism's Idris solutions import most, such as `Data.List`,
|
|
598
|
+
// `Data.Vect`, `Data.String` and `Data.Maybe`.
|
|
599
|
+
const functions = [
|
|
600
|
+
// Prelude
|
|
601
|
+
"abs", "all", "and", "any", "assert_total", "believe_me", "cast", "chr", "compare",
|
|
602
|
+
"concat", "concatMap", "cong", "const", "curry", "decEq", "div", "divNatNZ", "drop",
|
|
603
|
+
"either", "elem", "filter", "finToNat", "flip", "foldl", "foldMap", "foldr", "for",
|
|
604
|
+
"for_", "fromInteger", "fromMaybe", "fst", "getLine", "head", "id", "idris_crash",
|
|
605
|
+
"ignore", "integerToNat", "isAlpha", "isAlphaNum", "isCons", "isDigit", "isJust",
|
|
606
|
+
"isLower", "isNil", "isNothing", "isSpace", "isUpper", "join", "length", "lines",
|
|
607
|
+
"lookup", "map", "mapMaybe", "max", "maybe", "min", "minus", "mod", "mult",
|
|
608
|
+
"natToInteger", "negate", "not", "null", "or", "ord", "pack", "plus", "pred", "print",
|
|
609
|
+
"printLn", "product", "pure", "putStr", "putStrLn", "recip", "replace", "replicate",
|
|
610
|
+
"reverse", "show", "snd", "sqrt", "succ", "sum", "sym", "tail", "take", "the",
|
|
611
|
+
"toLower", "toUpper", "trans", "traverse", "traverse_", "uncurry", "unlines", "unpack",
|
|
612
|
+
"unwords", "unzip", "void", "absurd", "when", "words", "zip", "zip3", "zipWith",
|
|
613
|
+
"zipWith3", "pow", "floor", "ceiling", "round", "exp", "log", "sin", "cos", "tan",
|
|
614
|
+
"uninhabited", "plusZeroRightNeutral", "plusCommutative", "plusAssociative",
|
|
615
|
+
"plusSuccRightSucc", "multCommutative", "multZeroRightZero", "multOneRightNeutral",
|
|
616
|
+
// Data.List
|
|
617
|
+
"break", "catMaybes", "deleteBy", "delete", "elemIndex", "find", "findIndex", "group",
|
|
618
|
+
"groupBy", "head'", "init", "inits", "intercalate", "intersperse", "isInfixOf",
|
|
619
|
+
"isPrefixOf", "isSuffixOf", "iterateN", "last", "last'", "nub", "nubBy", "partition",
|
|
620
|
+
"sort", "sortBy", "sortOn", "span", "splitAt", "tail'", "tails", "transpose",
|
|
621
|
+
"dropWhile", "takeWhile", "index'", "insertBy", "union", "intersect", "lookupBy",
|
|
622
|
+
// Data.Vect and Data.Fin
|
|
623
|
+
"index", "natToFin", "weaken", "fromList", "toList", "updateAt", "replaceAt",
|
|
624
|
+
"rangeFromTo",
|
|
625
|
+
// Data.String
|
|
626
|
+
"trim", "ltrim", "rtrim", "split", "singleton", "strLength", "strCons", "strHead",
|
|
627
|
+
"strTail", "substr", "fastConcat", "fastPack", "fastUnpack", "isPrefixOf", "parseInteger",
|
|
628
|
+
"parsePositive", "padLeft", "padRight", "indent",
|
|
629
|
+
// Data.Maybe and Data.Either
|
|
630
|
+
"toMaybe", "fromJust", "lefts", "rights", "partitionEithers",
|
|
631
|
+
].map((label) => ({ label, type: "function" }));
|
|
632
|
+
const types = [
|
|
633
|
+
"Bits8", "Bits16", "Bits32", "Bits64", "Bool", "Char", "Dec", "DPair", "Double",
|
|
634
|
+
"Either", "Equal", "Fin", "Inf", "Int", "Int8", "Int16", "Int32", "Int64", "Integer",
|
|
635
|
+
"IO", "Lazy", "List", "List1", "LTE", "Maybe", "Nat", "Ordering", "Pair", "SnocList",
|
|
636
|
+
"So", "Stream", "String", "Type", "Unit", "Vect", "Void", "Elem", "SortedMap",
|
|
637
|
+
].map((label) => ({ label, type: "type" }));
|
|
638
|
+
const interfaces = [
|
|
639
|
+
"Alternative", "Applicative", "Cast", "DecEq", "Eq", "Foldable", "Fractional", "Functor",
|
|
640
|
+
"Integral", "Monad", "Monoid", "Neg", "Num", "Ord", "Semigroup", "Show", "Traversable",
|
|
641
|
+
"Uninhabited", "Abs",
|
|
642
|
+
].map((label) => ({ label, type: "class" }));
|
|
643
|
+
const constructors = [
|
|
644
|
+
"True", "False", "Nothing", "Just", "Left", "Right", "Z", "S", "Nil", "Yes", "No", "LT",
|
|
645
|
+
"EQ", "GT", "MkPair", "Refl", "FZ", "FS", "Here", "There", "Oh", "LTEZero", "LTESucc",
|
|
646
|
+
"MkDPair",
|
|
647
|
+
].map((label) => ({ label, type: "constant" }));
|
|
648
|
+
const dontComplete = ["String", "Char", "Number", "LineComment", "BlockComment", "DocComment", "Pragma"];
|
|
649
|
+
/// Completion for Idris's keywords, the snippets, and the Prelude and base
|
|
650
|
+
/// names. It offers nothing inside strings and comments.
|
|
651
|
+
const idrisCompletion = outsideLiterals(completeFromList([...snippets, ...keywords, ...functions, ...types, ...interfaces, ...constructors]));
|
|
652
|
+
// Each of these nodes opens a scope: the names it binds are visible inside it
|
|
653
|
+
// and nowhere else. A `where` block belongs to the binding it stands under.
|
|
654
|
+
const ScopeNodes = new Set([
|
|
655
|
+
"Module",
|
|
656
|
+
"Bind",
|
|
657
|
+
"LambdaExpression",
|
|
658
|
+
"CaseAlternative",
|
|
659
|
+
"DoExpression",
|
|
660
|
+
"LetExpression",
|
|
661
|
+
"ListExpression",
|
|
662
|
+
]);
|
|
663
|
+
// A pattern is written as an expression, so its variables are the unqualified
|
|
664
|
+
// `Variable` nodes in it. `{n = Z}` names an implicit argument before its `=`,
|
|
665
|
+
// and that name binds nothing. Types and lambdas inside a pattern bind their
|
|
666
|
+
// own names, or none.
|
|
667
|
+
const notPattern = new Set([
|
|
668
|
+
"Callee",
|
|
669
|
+
"Type",
|
|
670
|
+
"FieldExpression",
|
|
671
|
+
"LambdaExpression",
|
|
672
|
+
"CaseExpression",
|
|
673
|
+
"DoExpression",
|
|
674
|
+
"LetExpression",
|
|
675
|
+
]);
|
|
676
|
+
function patternVariables(node, def) {
|
|
677
|
+
var _a;
|
|
678
|
+
if (node.name == "Variable") {
|
|
679
|
+
if (!node.getChild("Qualifier"))
|
|
680
|
+
def(node, "variable");
|
|
681
|
+
}
|
|
682
|
+
else if (node.name == "FieldPath") {
|
|
683
|
+
const assigned = ((_a = node.nextSibling) === null || _a === void 0 ? void 0 : _a.name) == "=";
|
|
684
|
+
const name = node.firstChild;
|
|
685
|
+
if (!assigned && (name === null || name === void 0 ? void 0 : name.name) == "Variable" && !name.nextSibling)
|
|
686
|
+
def(name, "variable");
|
|
687
|
+
}
|
|
688
|
+
else if (!notPattern.has(node.name)) {
|
|
689
|
+
for (let ch = node.firstChild; ch; ch = ch.nextSibling)
|
|
690
|
+
patternVariables(ch, def);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
const rhsNames = new Set(["=", ":=", "WhereBlock", "WithClause", "WithPattern", "impossible"]);
|
|
694
|
+
function isRhs(node) {
|
|
695
|
+
return rhsNames.has(node.name);
|
|
696
|
+
}
|
|
697
|
+
// `xs ++ ys = ...` defines an operator, and its operands are its parameters.
|
|
698
|
+
function definesOperator(lhs) {
|
|
699
|
+
if (lhs.name != "OperatorExpression")
|
|
700
|
+
return false;
|
|
701
|
+
for (let ch = lhs.firstChild; ch; ch = ch.nextSibling)
|
|
702
|
+
if (ch.name == "Operator" || ch.name == "BacktickOperator")
|
|
703
|
+
return true;
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
// The type an interface declares is the first constructor in its head after
|
|
707
|
+
// any constraints. `interface Eq a => Ord a` declares `Ord`.
|
|
708
|
+
function declaredType(type) {
|
|
709
|
+
if (!type)
|
|
710
|
+
return null;
|
|
711
|
+
let found = null;
|
|
712
|
+
for (let ch = type.firstChild; ch; ch = ch.nextSibling) {
|
|
713
|
+
if (ch.name == "=>")
|
|
714
|
+
found = null;
|
|
715
|
+
else if (ch.name == "TypeConstructor" && !found)
|
|
716
|
+
found = ch;
|
|
717
|
+
}
|
|
718
|
+
return found;
|
|
719
|
+
}
|
|
720
|
+
function signatures(block, def, type) {
|
|
721
|
+
if (!block)
|
|
722
|
+
return;
|
|
723
|
+
for (const sig of block.getChildren("TypeSignature"))
|
|
724
|
+
for (const n of sig.getChildren("DeclName"))
|
|
725
|
+
def(n, type);
|
|
726
|
+
}
|
|
727
|
+
// What a node declares into the scope around it. Returning true stops the walk
|
|
728
|
+
// going into the node.
|
|
729
|
+
const gatherers = {
|
|
730
|
+
Bind(node, def) {
|
|
731
|
+
const first = node.firstChild;
|
|
732
|
+
if ((first === null || first === void 0 ? void 0 : first.name) == "DeclName") {
|
|
733
|
+
const hasParams = first.nextSibling && !isRhs(first.nextSibling);
|
|
734
|
+
def(first, hasParams ? "function" : "variable");
|
|
735
|
+
}
|
|
736
|
+
else if (first && !definesOperator(first)) {
|
|
737
|
+
patternVariables(first, def);
|
|
738
|
+
}
|
|
739
|
+
return true;
|
|
740
|
+
},
|
|
741
|
+
TypeSignature(node, def) {
|
|
742
|
+
var _a;
|
|
743
|
+
const isFunction = !!((_a = node.getChild("Type")) === null || _a === void 0 ? void 0 : _a.getChild("->"));
|
|
744
|
+
for (const n of node.getChildren("DeclName"))
|
|
745
|
+
def(n, isFunction ? "function" : "variable");
|
|
746
|
+
for (const n of node.getChildren("Constructor"))
|
|
747
|
+
def(n, "type");
|
|
748
|
+
return true;
|
|
749
|
+
},
|
|
750
|
+
DataDeclaration(node, def) {
|
|
751
|
+
var _a, _b;
|
|
752
|
+
const name = (_a = node.getChild("DataHead")) === null || _a === void 0 ? void 0 : _a.getChild("TypeConstructor");
|
|
753
|
+
if (name)
|
|
754
|
+
def(name, "type");
|
|
755
|
+
for (const con of node.getChildren("ConstructorDeclaration")) {
|
|
756
|
+
const conName = (_b = con.getChild("Type")) === null || _b === void 0 ? void 0 : _b.getChild("TypeConstructor");
|
|
757
|
+
if (conName)
|
|
758
|
+
def(conName, "constant");
|
|
759
|
+
}
|
|
760
|
+
for (const block of node.getChildren("WhereBlock"))
|
|
761
|
+
for (const sig of block.getChildren("GadtSignature"))
|
|
762
|
+
for (const n of sig.getChildren("Constructor"))
|
|
763
|
+
def(n, "constant");
|
|
764
|
+
return true;
|
|
765
|
+
},
|
|
766
|
+
RecordDeclaration(node, def) {
|
|
767
|
+
var _a, _b;
|
|
768
|
+
const name = (_a = node.getChild("DataHead")) === null || _a === void 0 ? void 0 : _a.getChild("TypeConstructor");
|
|
769
|
+
if (name)
|
|
770
|
+
def(name, "type");
|
|
771
|
+
const block = node.getChild("WhereBlock");
|
|
772
|
+
for (const con of (_b = block === null || block === void 0 ? void 0 : block.getChildren("RecordConstructor")) !== null && _b !== void 0 ? _b : []) {
|
|
773
|
+
const conName = con.getChild("Constructor");
|
|
774
|
+
if (conName)
|
|
775
|
+
def(conName, "constant");
|
|
776
|
+
}
|
|
777
|
+
signatures(block, def, "property");
|
|
778
|
+
return true;
|
|
779
|
+
},
|
|
780
|
+
InterfaceDeclaration(node, def) {
|
|
781
|
+
const name = declaredType(node.getChild("Type"));
|
|
782
|
+
if (name)
|
|
783
|
+
def(name, "class");
|
|
784
|
+
signatures(node.getChild("WhereBlock"), def, "function");
|
|
785
|
+
return true;
|
|
786
|
+
},
|
|
787
|
+
ImplementationDeclaration() {
|
|
788
|
+
return true;
|
|
789
|
+
},
|
|
790
|
+
NamespaceDeclaration(node, def) {
|
|
791
|
+
const name = node.getChild("ModuleName");
|
|
792
|
+
if (name)
|
|
793
|
+
def(name, "namespace");
|
|
794
|
+
return false;
|
|
795
|
+
},
|
|
796
|
+
BindStatement(node, def) {
|
|
797
|
+
if (node.firstChild)
|
|
798
|
+
patternVariables(node.firstChild, def);
|
|
799
|
+
return false;
|
|
800
|
+
},
|
|
801
|
+
ImportDeclaration(node, def) {
|
|
802
|
+
var _a;
|
|
803
|
+
const alias = (_a = node.getChild("as")) === null || _a === void 0 ? void 0 : _a.nextSibling;
|
|
804
|
+
if ((alias === null || alias === void 0 ? void 0 : alias.name) == "ModuleName")
|
|
805
|
+
def(alias, "namespace");
|
|
806
|
+
return true;
|
|
807
|
+
},
|
|
808
|
+
};
|
|
809
|
+
// The names a scope node binds itself: a function's parameters and `with`
|
|
810
|
+
// patterns, a lambda's arguments, a `case` pattern, or a generator's pattern.
|
|
811
|
+
function ownBindings(node, def) {
|
|
812
|
+
var _a;
|
|
813
|
+
switch (node.name) {
|
|
814
|
+
case "Bind": {
|
|
815
|
+
const first = node.firstChild;
|
|
816
|
+
if ((first === null || first === void 0 ? void 0 : first.name) == "DeclName") {
|
|
817
|
+
for (let ch = first.nextSibling; ch && !isRhs(ch); ch = ch.nextSibling)
|
|
818
|
+
patternVariables(ch, def);
|
|
819
|
+
}
|
|
820
|
+
else if (first && definesOperator(first)) {
|
|
821
|
+
patternVariables(first, def);
|
|
822
|
+
}
|
|
823
|
+
for (const pattern of node.getChildren("WithPattern"))
|
|
824
|
+
patternVariables(pattern, def);
|
|
825
|
+
break;
|
|
826
|
+
}
|
|
827
|
+
case "LambdaExpression":
|
|
828
|
+
for (let ch = (_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.nextSibling; ch && ch.name != "=>" && ch.name != ":"; ch = ch.nextSibling)
|
|
829
|
+
patternVariables(ch, def);
|
|
830
|
+
break;
|
|
831
|
+
case "CaseAlternative":
|
|
832
|
+
if (node.firstChild)
|
|
833
|
+
patternVariables(node.firstChild, def);
|
|
834
|
+
break;
|
|
835
|
+
case "ListExpression":
|
|
836
|
+
for (let ch = node.firstChild; ch; ch = ch.nextSibling)
|
|
837
|
+
if (ch.name == "<-" && ch.prevSibling)
|
|
838
|
+
patternVariables(ch.prevSibling, def);
|
|
839
|
+
break;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
const cache = new NodeWeakMap();
|
|
843
|
+
function getScope(doc, node) {
|
|
844
|
+
const cached = cache.get(node);
|
|
845
|
+
if (cached)
|
|
846
|
+
return cached;
|
|
847
|
+
const completions = [];
|
|
848
|
+
const seen = new Set();
|
|
849
|
+
const def = (n, type) => {
|
|
850
|
+
const label = doc.sliceString(n.from, n.to);
|
|
851
|
+
if (!label || seen.has(label))
|
|
852
|
+
return;
|
|
853
|
+
seen.add(label);
|
|
854
|
+
completions.push({ label, type });
|
|
855
|
+
};
|
|
856
|
+
ownBindings(node, def);
|
|
857
|
+
const walk = (parent) => {
|
|
858
|
+
for (let ch = parent.firstChild; ch; ch = ch.nextSibling) {
|
|
859
|
+
const gather = gatherers[ch.name];
|
|
860
|
+
if (gather && gather(ch, def))
|
|
861
|
+
continue;
|
|
862
|
+
if (!ScopeNodes.has(ch.name))
|
|
863
|
+
walk(ch);
|
|
864
|
+
}
|
|
865
|
+
};
|
|
866
|
+
walk(node);
|
|
867
|
+
cache.set(node, completions);
|
|
868
|
+
return completions;
|
|
869
|
+
}
|
|
870
|
+
// The record fields declared anywhere in the file, offered after a `.` that
|
|
871
|
+
// reads a field.
|
|
872
|
+
function fieldsOf(doc, top) {
|
|
873
|
+
const fields = [];
|
|
874
|
+
const seen = new Set();
|
|
875
|
+
top.cursor().iterate((n) => {
|
|
876
|
+
var _a;
|
|
877
|
+
if (n.name != "RecordDeclaration")
|
|
878
|
+
return;
|
|
879
|
+
const block = n.node.getChild("WhereBlock");
|
|
880
|
+
for (const sig of (_a = block === null || block === void 0 ? void 0 : block.getChildren("TypeSignature")) !== null && _a !== void 0 ? _a : [])
|
|
881
|
+
for (const name of sig.getChildren("DeclName")) {
|
|
882
|
+
const label = doc.sliceString(name.from, name.to);
|
|
883
|
+
if (!seen.has(label)) {
|
|
884
|
+
seen.add(label);
|
|
885
|
+
fields.push({ label, type: "property" });
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
return false;
|
|
889
|
+
});
|
|
890
|
+
return fields;
|
|
891
|
+
}
|
|
892
|
+
const Identifier = /^[\w'\xa1-\uffff]*$/;
|
|
893
|
+
/// Completes the names declared in the file that are in scope at the cursor:
|
|
894
|
+
/// top-level functions, types, constructors and interfaces, parameters, pattern
|
|
895
|
+
/// variables, and the bindings of `let`, `where` and `do`. After a `.` that
|
|
896
|
+
/// reads a field, it offers the file's record fields.
|
|
897
|
+
const localCompletionSource = (context) => {
|
|
898
|
+
const tree = syntaxTree(context.state);
|
|
899
|
+
const inner = tree.resolveInner(context.pos, -1);
|
|
900
|
+
if (dontComplete.includes(inner.name))
|
|
901
|
+
return null;
|
|
902
|
+
const word = context.matchBefore(/[\w'\xa1-\uffff]+/);
|
|
903
|
+
const from = word ? word.from : context.pos;
|
|
904
|
+
const afterDot = context.state.sliceDoc(Math.max(0, from - 1), from) == ".";
|
|
905
|
+
if (!word && !afterDot && !context.explicit)
|
|
906
|
+
return null;
|
|
907
|
+
if (afterDot) {
|
|
908
|
+
// `Vect.index` asks for a name out of another module, which this file
|
|
909
|
+
// doesn't declare. `person.name` asks for a record field.
|
|
910
|
+
if (/[A-Z]/.test(qualifierStart(context, from - 1)))
|
|
911
|
+
return null;
|
|
912
|
+
return { options: fieldsOf(context.state.doc, tree.topNode), from, validFor: Identifier };
|
|
913
|
+
}
|
|
914
|
+
let options = [];
|
|
915
|
+
for (let pos = inner; pos; pos = pos.parent)
|
|
916
|
+
if (ScopeNodes.has(pos.name))
|
|
917
|
+
options = options.concat(getScope(context.state.doc, pos));
|
|
918
|
+
return { options, from, validFor: Identifier };
|
|
919
|
+
};
|
|
920
|
+
// The first letter of the word that ends at `dot`, which says whether the dot
|
|
921
|
+
// follows a module name or a value.
|
|
922
|
+
function qualifierStart(context, dot) {
|
|
923
|
+
const line = context.state.doc.lineAt(dot);
|
|
924
|
+
const text = line.text.slice(0, dot - line.from);
|
|
925
|
+
const match = /[\w']+$/.exec(text);
|
|
926
|
+
return match ? match[0][0] : "";
|
|
927
|
+
}
|
|
928
|
+
/// Wraps a completion source so it says nothing in strings and comments.
|
|
929
|
+
function outsideLiterals(source) {
|
|
930
|
+
return ifNotIn(dontComplete, source);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
// Folding a declaration or block keeps its first line in view, which is the
|
|
934
|
+
// line that says what was folded away.
|
|
935
|
+
function foldBody(node, state) {
|
|
936
|
+
const line = state.doc.lineAt(node.from);
|
|
937
|
+
return node.to > line.to ? { from: line.to, to: node.to } : null;
|
|
938
|
+
}
|
|
939
|
+
// The tree can't say where a new line belongs, because a block ends at its last
|
|
940
|
+
// token and the new line is past that. So the line above decides. A line that
|
|
941
|
+
// opens a block or leaves an expression unfinished is followed by one indented
|
|
942
|
+
// under it, and any other line is followed by one at its own indentation.
|
|
943
|
+
const opensBlock = /(^|[^\w'])(do|where|of|let|mutual)$|^\s*(namespace|parameters)\b|\bwith\s*\(.*\)$/;
|
|
944
|
+
const continuesLine = /(=|:=|->|<-|=>|\$|\||,|\(|\[|\{|:|\bif|\bthen|\belse|\bin)$/;
|
|
945
|
+
const wantsIndent = /^\s*(where|then|else)\b/;
|
|
946
|
+
const indentIdris = indentService.of((context, pos) => {
|
|
947
|
+
const inside = syntaxTree(context.state).resolveInner(pos, -1).name;
|
|
948
|
+
if (inside == "BlockComment" || inside == "String")
|
|
949
|
+
return null;
|
|
950
|
+
let line = context.lineAt(pos, -1);
|
|
951
|
+
while (!/\S/.test(line.text) && line.from > 0)
|
|
952
|
+
line = context.lineAt(line.from - 1, -1);
|
|
953
|
+
if (!/\S/.test(line.text))
|
|
954
|
+
return 0;
|
|
955
|
+
const code = line.text.replace(/\s*--(\s.*|-*)$/, "").trimEnd();
|
|
956
|
+
const base = context.lineIndent(line.from);
|
|
957
|
+
if (opensBlock.test(code) || continuesLine.test(code))
|
|
958
|
+
return base + context.unit;
|
|
959
|
+
if (wantsIndent.test(context.state.doc.sliceString(pos, pos + 20)))
|
|
960
|
+
return base + context.unit;
|
|
961
|
+
return base;
|
|
962
|
+
});
|
|
963
|
+
const idrisLanguage = LRLanguage.define({
|
|
964
|
+
name: "idris",
|
|
965
|
+
parser: parser.configure({
|
|
966
|
+
props: [
|
|
967
|
+
foldNodeProp.add({
|
|
968
|
+
"WhereBlock DoExpression CaseExpression LetExpression LetStatement WithClause": foldBody,
|
|
969
|
+
"DataDeclaration RecordDeclaration InterfaceDeclaration ImplementationDeclaration": foldBody,
|
|
970
|
+
"NamespaceDeclaration MutualDeclaration ParametersDeclaration FailingDeclaration Bind": foldBody,
|
|
971
|
+
BlockComment: foldBody,
|
|
972
|
+
}),
|
|
973
|
+
styleTags({
|
|
974
|
+
"module import namespace": tags.moduleKeyword,
|
|
975
|
+
"data record interface implementation constructor where mutual parameters failing": tags.definitionKeyword,
|
|
976
|
+
"let in": tags.definitionKeyword,
|
|
977
|
+
"case of if then else do with rewrite impossible proof": tags.controlKeyword,
|
|
978
|
+
"public export private total partial covering auto default forall": tags.modifier,
|
|
979
|
+
"infix infixl infixr prefix as": tags.keyword,
|
|
980
|
+
Number: tags.number,
|
|
981
|
+
String: tags.string,
|
|
982
|
+
Char: tags.character,
|
|
983
|
+
Wildcard: tags.atom,
|
|
984
|
+
Hole: tags.special(tags.variableName),
|
|
985
|
+
LineComment: tags.lineComment,
|
|
986
|
+
BlockComment: tags.blockComment,
|
|
987
|
+
DocComment: tags.docComment,
|
|
988
|
+
Pragma: tags.meta,
|
|
989
|
+
Qualifier: tags.namespace,
|
|
990
|
+
OperatorQualifier: tags.namespace,
|
|
991
|
+
ModuleName: tags.namespace,
|
|
992
|
+
"ModuleName/Qualifier": tags.namespace,
|
|
993
|
+
DeclName: tags.definition(tags.variableName),
|
|
994
|
+
"Bind/DeclName": tags.definition(tags.function(tags.variableName)),
|
|
995
|
+
"DataHead/TypeConstructor": tags.definition(tags.typeName),
|
|
996
|
+
"GadtSignature/Constructor RecordConstructor/Constructor": tags.definition(tags.className),
|
|
997
|
+
"Callee/Variable": tags.function(tags.variableName),
|
|
998
|
+
"Projection FieldPath/Variable": tags.propertyName,
|
|
999
|
+
Variable: tags.variableName,
|
|
1000
|
+
Constructor: tags.className,
|
|
1001
|
+
TypeConstructor: tags.typeName,
|
|
1002
|
+
TypeVariable: tags.typeName,
|
|
1003
|
+
"Operator ConstructorOperator BacktickOperator": tags.operator,
|
|
1004
|
+
"TypeOperator TypeConstructorOperator": tags.typeOperator,
|
|
1005
|
+
"= := <- $=": tags.definitionOperator,
|
|
1006
|
+
": -> =>": tags.typeOperator,
|
|
1007
|
+
"| .. @ \\": tags.operator,
|
|
1008
|
+
"[| |]": tags.squareBracket,
|
|
1009
|
+
"` ; ,": tags.separator,
|
|
1010
|
+
"( )": tags.paren,
|
|
1011
|
+
"[ ]": tags.squareBracket,
|
|
1012
|
+
"{ }": tags.brace,
|
|
1013
|
+
}),
|
|
1014
|
+
],
|
|
1015
|
+
}),
|
|
1016
|
+
languageData: {
|
|
1017
|
+
commentTokens: { line: "--", block: { open: "{-", close: "-}" } },
|
|
1018
|
+
closeBrackets: { brackets: ["(", "[", "{", '"'] },
|
|
1019
|
+
indentOnInput: /^\s*(where|in|then|else|of)$/,
|
|
1020
|
+
},
|
|
1021
|
+
});
|
|
1022
|
+
/// Idris 2 language support, with completion for keywords, snippets, Prelude
|
|
1023
|
+
/// and base names, and the names declared in the file.
|
|
1024
|
+
function idris() {
|
|
1025
|
+
return new LanguageSupport(idrisLanguage, [
|
|
1026
|
+
indentIdris,
|
|
1027
|
+
idrisLanguage.data.of({ autocomplete: idrisCompletion }),
|
|
1028
|
+
idrisLanguage.data.of({ autocomplete: localCompletionSource }),
|
|
1029
|
+
]);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
export { idris, idrisCompletion, idrisLanguage, localCompletionSource, parser, snippets };
|