@exercism/codemirror-lang-futhark 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 +127 -2
- package/dist/index.cjs +615 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +605 -0
- package/package.json +51 -4
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var lr = require('@lezer/lr');
|
|
4
|
+
var language = require('@codemirror/language');
|
|
5
|
+
var highlight = require('@lezer/highlight');
|
|
6
|
+
var autocomplete = require('@codemirror/autocomplete');
|
|
7
|
+
|
|
8
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
9
|
+
const IndexOpen = 1,
|
|
10
|
+
PipeRightOp = 2,
|
|
11
|
+
PipeLeftOp = 3,
|
|
12
|
+
OrOp = 4,
|
|
13
|
+
AndOp = 5,
|
|
14
|
+
CompareOp = 6,
|
|
15
|
+
BitOp = 7,
|
|
16
|
+
ShiftOp = 8,
|
|
17
|
+
PlusOp = 9,
|
|
18
|
+
TimesOp = 10,
|
|
19
|
+
PowerOp = 11;
|
|
20
|
+
|
|
21
|
+
const bracket = 91; // [
|
|
22
|
+
// A name may end in a prime, as in `acc'`, and a string can be indexed too.
|
|
23
|
+
function endsAtom(ch) {
|
|
24
|
+
return ((ch >= 48 && ch <= 57) || // 0-9
|
|
25
|
+
(ch >= 65 && ch <= 90) || // A-Z
|
|
26
|
+
(ch >= 97 && ch <= 122) || // a-z
|
|
27
|
+
ch == 95 || // _
|
|
28
|
+
ch == 39 || // '
|
|
29
|
+
ch == 41 || // )
|
|
30
|
+
ch == 93 || // ]
|
|
31
|
+
ch == 34 // "
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
/// `xs[i]` indexes `xs`, and `f [1, 2]` applies `f` to an array. The only
|
|
35
|
+
/// difference is the space, so a `[` straight after a name or a closing bracket
|
|
36
|
+
/// is an index wherever an index may go.
|
|
37
|
+
const indexOpen = new lr.ExternalTokenizer((input, stack) => {
|
|
38
|
+
if (input.next != bracket || !endsAtom(input.peek(-1)))
|
|
39
|
+
return;
|
|
40
|
+
if (stack.canShift(IndexOpen))
|
|
41
|
+
input.acceptToken(IndexOpen, 1);
|
|
42
|
+
});
|
|
43
|
+
const operatorChars = "+-*/%=!><|&^";
|
|
44
|
+
function isOperatorChar(ch) {
|
|
45
|
+
return ch >= 0 && operatorChars.includes(String.fromCharCode(ch));
|
|
46
|
+
}
|
|
47
|
+
// Futhark gives an operator the precedence of its first characters, so
|
|
48
|
+
// `+++` binds like `+` and `==>` binds like `==`.
|
|
49
|
+
function classify(op) {
|
|
50
|
+
if (op == "|>")
|
|
51
|
+
return PipeRightOp;
|
|
52
|
+
if (op == "<|")
|
|
53
|
+
return PipeLeftOp;
|
|
54
|
+
if (op.startsWith("||"))
|
|
55
|
+
return OrOp;
|
|
56
|
+
if (op.startsWith("&&"))
|
|
57
|
+
return AndOp;
|
|
58
|
+
if (op.startsWith("**"))
|
|
59
|
+
return PowerOp;
|
|
60
|
+
if (op.startsWith("<<") || op.startsWith(">>"))
|
|
61
|
+
return ShiftOp;
|
|
62
|
+
switch (op[0]) {
|
|
63
|
+
case "+":
|
|
64
|
+
case "-":
|
|
65
|
+
return PlusOp;
|
|
66
|
+
case "*":
|
|
67
|
+
case "/":
|
|
68
|
+
case "%":
|
|
69
|
+
return TimesOp;
|
|
70
|
+
case "&":
|
|
71
|
+
case "^":
|
|
72
|
+
case "|":
|
|
73
|
+
return BitOp;
|
|
74
|
+
default:
|
|
75
|
+
return CompareOp;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// The grammar reads these itself: `=` binds, `->` maps, and `-` and `!` may
|
|
79
|
+
// also stand before an expression.
|
|
80
|
+
const reserved = new Set(["=", "->", "-", "!"]);
|
|
81
|
+
/// Reads a run of operator characters as one operator. A `|` in a sum type, a
|
|
82
|
+
/// `*` before a unique type and the `<` in `for i < n` are left to the grammar,
|
|
83
|
+
/// because an operator can't go there.
|
|
84
|
+
const operators = new lr.ExternalTokenizer((input, stack) => {
|
|
85
|
+
if (!isOperatorChar(input.next))
|
|
86
|
+
return;
|
|
87
|
+
let op = "";
|
|
88
|
+
for (let i = 0; isOperatorChar(input.peek(i)); i++)
|
|
89
|
+
op += String.fromCharCode(input.peek(i));
|
|
90
|
+
if (op.startsWith("--") || reserved.has(op))
|
|
91
|
+
return;
|
|
92
|
+
const term = classify(op);
|
|
93
|
+
if (stack.canShift(term))
|
|
94
|
+
input.acceptToken(term, op.length);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
98
|
+
const spec_identifier = {__proto__:null,def:32, let:34, entry:36, _:372, true:84, false:86, assert:166, in:172, if:176, then:178, else:180, loop:184, for:186, while:190, do:192, match:196, case:200, with:228, type:258, import:268, open:272, val:282, include:286, module:290, local:306};
|
|
99
|
+
const parser = lr.LRParser.deserialize({
|
|
100
|
+
version: 14,
|
|
101
|
+
states: "!/nQ]QSOOOOQO'#GX'#GXOOQO'#Fl'#FlQ]QSOOOzQSO'#CkO!SQSO'#FQO!_QSO'#FVO!dQSO'#F`O!oQSO'#FXO!}QSO'#FgO]QSO'#FjOOQO-E9j-E9jOOQO'#Co'#CoO#wQUO'#CrO$mQSO,59VOOQO'#FU'#FUO$tQSO,5;lO!YQSO,5;lOOQO,5;q,5;qO%uQSO'#D_O'VQSO'#F]OOQO'#Gu'#GuO!dQSO'#GuO'hQSO,5;zO(cQSO'#FZOOQO'#Gt'#GtO!oQSO'#GtO(jQSO,5;sOOQO'#Gs'#GsO)hQSO'#F[OOQO'#Fd'#FdO)mQSO,5<RO#QQSO,5<TOOQO,5<U,5<UOOQR'#GZ'#GZO)xQSO,59^OOQO'#Cu'#CuO)}QSO'#CyOOQO'#G['#G[OOQO'#Fm'#FmO*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XQ(v&]R*V(u[lWj!j$X&](u]!ek!d$Z&Z(v*VQgVQ!`fQ$[!kQ&X$UQ&[$YQ&^$]Q(m&SR(t&YT!Zd![",
|
|
104
|
+
nodeNames: "⚠ IndexOpen PipeRightOp PipeLeftOp OrOp AndOp CompareOp BitOp ShiftOp PlusOp TimesOp PowerOp LineComment Attribute Program ValueDeclaration def let entry DefName ) ( OperatorName - ! TypeParameter TypeVariable ] [ SizeParameter SizeName VariableDefinition Wildcard Unit ParenthesizedPattern ConstructorPattern Constructor Number Float Char String Boolean true false NegativeLiteral TypedPattern : TypeName QualifiedType ModuleName . TupleType , } { RecordType RecordTypeField FieldName ParenthesizedType TypeApplication VariableName ParenthesizedExpression Tuple Record RecordField = ArrayExpression IndexExpression Slice FieldExpression FieldNumber QualifiedOperator LocalOpen OperatorSection LeftSection ` RightSection ProjectionSection Hole ??? Application Callee AssertExpression assert LetExpression ReturnType in IfExpression if then else LoopExpression loop for < while do MatchExpression match MatchCase case -> LambdaExpression \\ UnaryExpression BinaryExpression Coercion :> RangeExpression .. ... ..< ..> WithExpression with ArrayType UniqueType * ExistentialType ? FunctionType SumType Variant | NamedParameter TuplePattern RecordPattern RecordPatternField TypeDeclaration type ^ ~ TypeDefinition ImportDeclaration import OpenDeclaration open ModuleBody ModuleImport SignatureBody ValueSpecification val IncludeDeclaration include ModuleSpecification module ModuleDefinition SignatureRefinement ModuleApplication ModuleDeclaration ModuleParameter ModuleTypeDeclaration LocalDeclaration local",
|
|
105
|
+
maxTerm: 210,
|
|
106
|
+
nodeProps: [
|
|
107
|
+
["openedBy", 20,"(",27,"[",53,"{"],
|
|
108
|
+
["closedBy", 21,")",28,"]",54,"}"]
|
|
109
|
+
],
|
|
110
|
+
skippedNodes: [0,12,13],
|
|
111
|
+
repeatNodeCount: 24,
|
|
112
|
+
tokenData: "<s~RvX^#ipq#iqr$^rs$cst+Wwx,jxy1uyz1zz{2P|}2U}!O2Z!O!P3S!Q!R3y!R![6t![!]:d!^!_:q!_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R!Q![9{!c!i9{#R#S9{#T#Z9{#]#^8S#i#j8S~:iP!O~!`!a:l~:qO#_~~:vO#Q~~:{O!c~R;QP#kP!a!b;TQ;WP!a!b;ZQ;`O!qQ~;eT$|~wx;`!Q![;`!c!};`#R#S;`#T#o;`~;yOl~~<OO#Z~~<TOk~~<YO#v~~<_O!m~~<dO!W~~<iO#o~~<nO!V~~<sO#w~",
|
|
113
|
+
tokenizers: [indexOpen, operators, 0, 1, 2],
|
|
114
|
+
topRules: {"Program":[0,14]},
|
|
115
|
+
specialized: [{term: 182, get: (value) => spec_identifier[value] || -1}],
|
|
116
|
+
tokenPrec: 6085
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// The names Futhark's prelude puts in scope in every file, taken from
|
|
120
|
+
// https://github.com/diku-dk/futhark/tree/master/prelude.
|
|
121
|
+
/// Second-order array combinators, the functions that do the parallel work.
|
|
122
|
+
const soacs = [
|
|
123
|
+
"map", "map1", "map2", "map3", "map4", "map5",
|
|
124
|
+
"reduce", "reduce_comm", "reduce_by_index", "reduce_by_index_2d", "reduce_by_index_3d",
|
|
125
|
+
"hist", "scan", "exscan", "filter", "partition", "partition2",
|
|
126
|
+
"scatter", "scatter_2d", "scatter_3d", "spread", "flatmap", "all", "any",
|
|
127
|
+
];
|
|
128
|
+
const preludeFunctions = [
|
|
129
|
+
// array.fut
|
|
130
|
+
"length", "null", "head", "last", "tail", "init", "take", "drop", "sized", "split",
|
|
131
|
+
"reverse", "concat", "iota", "indices", "rotate", "replicate", "rep", "copy", "manifest",
|
|
132
|
+
"flatten", "flatten_3d", "flatten_4d", "unflatten", "unflatten_3d", "unflatten_4d",
|
|
133
|
+
"transpose", "and", "or", "foldl", "foldr", "tabulate", "tabulate_2d", "tabulate_3d",
|
|
134
|
+
// zip.fut
|
|
135
|
+
"zip", "zip2", "zip3", "zip4", "zip5", "unzip", "unzip2", "unzip3", "unzip4", "unzip5",
|
|
136
|
+
// functional.fut
|
|
137
|
+
"flip", "curry", "uncurry", "const", "id", "iterate", "iterate_until", "iterate_while",
|
|
138
|
+
// ad.fut
|
|
139
|
+
"jvp", "vjp", "jvp2", "vjp2",
|
|
140
|
+
// prelude.fut
|
|
141
|
+
"r32", "t32", "r64", "t64", "not", "opaque", "trace", "break",
|
|
142
|
+
];
|
|
143
|
+
const primitiveTypes = [
|
|
144
|
+
"i8", "i16", "i32", "i64", "u8", "u16", "u32", "u64", "f16", "f32", "f64", "bool",
|
|
145
|
+
];
|
|
146
|
+
const fromPrim = ["i8", "i16", "i32", "i64", "u8", "u16", "u32", "u64", "f16", "f32", "f64", "bool"];
|
|
147
|
+
const numeric = [
|
|
148
|
+
...fromPrim,
|
|
149
|
+
"to_i64", "neg", "max", "min", "abs", "sgn", "highest", "lowest",
|
|
150
|
+
"sum", "product", "maximum", "minimum",
|
|
151
|
+
];
|
|
152
|
+
const integral = [
|
|
153
|
+
...numeric,
|
|
154
|
+
"not", "num_bits", "get_bit", "set_bit", "popc", "mul_hi", "mad_hi", "clz", "ctz",
|
|
155
|
+
];
|
|
156
|
+
const float = [
|
|
157
|
+
...numeric,
|
|
158
|
+
"recip", "from_fraction", "to_f64", "sqrt", "rsqrt", "cbrt", "exp",
|
|
159
|
+
"sin", "cos", "tan", "sinpi", "cospi", "tanpi", "asin", "acos", "atan",
|
|
160
|
+
"asinpi", "acospi", "atanpi", "sinh", "cosh", "tanh", "asinh", "acosh", "atanh",
|
|
161
|
+
"atan2", "atan2pi", "hypot", "gamma", "lgamma", "erf", "erfc", "lerp",
|
|
162
|
+
"log", "log2", "log10", "log1p", "ceil", "floor", "trunc", "round", "mad", "fma",
|
|
163
|
+
"isinf", "isnan", "inf", "nan", "pi", "e",
|
|
164
|
+
"from_bits", "to_bits", "num_bits", "get_bit", "set_bit", "epsilon", "nextafter",
|
|
165
|
+
"ldexp", "copysign",
|
|
166
|
+
];
|
|
167
|
+
/// The members of each numeric module, as in `i32.sum` and `f64.sqrt`.
|
|
168
|
+
const moduleMembers = {
|
|
169
|
+
i8: integral, i16: integral, i32: integral, i64: integral,
|
|
170
|
+
u8: integral, u16: integral, u32: integral, u64: integral,
|
|
171
|
+
f16: float, f32: float, f64: float,
|
|
172
|
+
bool: fromPrim,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/// Snippets for the constructs people write most often in Futhark.
|
|
176
|
+
const snippets = [
|
|
177
|
+
autocomplete.snippetCompletion("def ${name} (${x}: ${i32}): ${i32} =\n\t${}", {
|
|
178
|
+
label: "def",
|
|
179
|
+
detail: "function",
|
|
180
|
+
type: "keyword",
|
|
181
|
+
}),
|
|
182
|
+
autocomplete.snippetCompletion("entry ${main} (${x}: ${i32}): ${i32} =\n\t${}", {
|
|
183
|
+
label: "entry",
|
|
184
|
+
detail: "entry point",
|
|
185
|
+
type: "keyword",
|
|
186
|
+
}),
|
|
187
|
+
autocomplete.snippetCompletion("let ${x} = ${value}\nin ${}", {
|
|
188
|
+
label: "let",
|
|
189
|
+
detail: "in",
|
|
190
|
+
type: "keyword",
|
|
191
|
+
}),
|
|
192
|
+
autocomplete.snippetCompletion("loop ${acc} = ${init} for ${i} < ${n} do\n\t${}", {
|
|
193
|
+
label: "loop",
|
|
194
|
+
detail: "for i < n",
|
|
195
|
+
type: "keyword",
|
|
196
|
+
}),
|
|
197
|
+
autocomplete.snippetCompletion("loop ${acc} = ${init} for ${x} in ${xs} do\n\t${}", {
|
|
198
|
+
label: "loop",
|
|
199
|
+
detail: "for x in xs",
|
|
200
|
+
type: "keyword",
|
|
201
|
+
}),
|
|
202
|
+
autocomplete.snippetCompletion("loop ${x} = ${init} while ${condition} do\n\t${}", {
|
|
203
|
+
label: "loop",
|
|
204
|
+
detail: "while",
|
|
205
|
+
type: "keyword",
|
|
206
|
+
}),
|
|
207
|
+
autocomplete.snippetCompletion("if ${condition} then ${} else ${}", {
|
|
208
|
+
label: "if",
|
|
209
|
+
detail: "then else",
|
|
210
|
+
type: "keyword",
|
|
211
|
+
}),
|
|
212
|
+
autocomplete.snippetCompletion("match ${x}\ncase ${pattern} -> ${}\ncase _ -> ${}", {
|
|
213
|
+
label: "match",
|
|
214
|
+
detail: "case",
|
|
215
|
+
type: "keyword",
|
|
216
|
+
}),
|
|
217
|
+
autocomplete.snippetCompletion("\\${x} -> ${}", {
|
|
218
|
+
label: "\\",
|
|
219
|
+
detail: "lambda",
|
|
220
|
+
type: "keyword",
|
|
221
|
+
}),
|
|
222
|
+
autocomplete.snippetCompletion("type ${name} = ${}", {
|
|
223
|
+
label: "type",
|
|
224
|
+
detail: "definition",
|
|
225
|
+
type: "keyword",
|
|
226
|
+
}),
|
|
227
|
+
autocomplete.snippetCompletion("module ${name} = {\n\t${}\n}", {
|
|
228
|
+
label: "module",
|
|
229
|
+
detail: "definition",
|
|
230
|
+
type: "keyword",
|
|
231
|
+
}),
|
|
232
|
+
];
|
|
233
|
+
const keywords = ("def let in if then else loop for while do match case type module open import " +
|
|
234
|
+
"include local entry val with assert true false")
|
|
235
|
+
.split(" ")
|
|
236
|
+
.map((label) => ({ label, type: "keyword" }));
|
|
237
|
+
const builtins = [
|
|
238
|
+
...soacs.map((label) => ({ label, type: "function", detail: "SOAC" })),
|
|
239
|
+
...preludeFunctions.map((label) => ({ label, type: "function" })),
|
|
240
|
+
...primitiveTypes.map((label) => ({ label, type: "type" })),
|
|
241
|
+
];
|
|
242
|
+
const dontComplete = ["String", "Char", "LineComment", "Attribute"];
|
|
243
|
+
const Identifier = /^[\w']*$/;
|
|
244
|
+
// A word straight after a dot names a member of a module or a field of a
|
|
245
|
+
// record, and the sources for bare names have nothing useful to say there.
|
|
246
|
+
function afterDot(context) {
|
|
247
|
+
const word = context.matchBefore(/[\w']*/);
|
|
248
|
+
const from = word ? word.from : context.pos;
|
|
249
|
+
return from > 0 && context.state.sliceDoc(from - 1, from) == ".";
|
|
250
|
+
}
|
|
251
|
+
function afterHash(context) {
|
|
252
|
+
const word = context.matchBefore(/[\w']*/);
|
|
253
|
+
const from = word ? word.from : context.pos;
|
|
254
|
+
return from > 0 && context.state.sliceDoc(from - 1, from) == "#";
|
|
255
|
+
}
|
|
256
|
+
const fixedNames = autocomplete.completeFromList([...snippets, ...keywords, ...builtins]);
|
|
257
|
+
/// Keywords, snippets, the prelude's functions and the primitive types. It
|
|
258
|
+
/// offers nothing inside strings and comments, or after a dot.
|
|
259
|
+
const futharkCompletion = autocomplete.ifNotIn(dontComplete, (context) => afterDot(context) || afterHash(context) ? null : fixedNames(context));
|
|
260
|
+
/// The members of a numeric module after its name and a dot: `i32.` offers
|
|
261
|
+
/// `sum` and `max`, and `f64.` offers `sqrt` too.
|
|
262
|
+
const moduleCompletionSource = autocomplete.ifNotIn(dontComplete, (context) => {
|
|
263
|
+
const match = context.matchBefore(/\b[a-z][\w']*\.[\w']*/);
|
|
264
|
+
if (!match)
|
|
265
|
+
return null;
|
|
266
|
+
const dot = match.text.indexOf(".");
|
|
267
|
+
const members = moduleMembers[match.text.slice(0, dot)];
|
|
268
|
+
if (!members)
|
|
269
|
+
return null;
|
|
270
|
+
return {
|
|
271
|
+
from: match.from + dot + 1,
|
|
272
|
+
options: members.map((label) => ({ label, type: "function" })),
|
|
273
|
+
validFor: Identifier,
|
|
274
|
+
};
|
|
275
|
+
});
|
|
276
|
+
/// The field names written in the file, after a record and a dot, as in
|
|
277
|
+
/// `queen.` or `(.` in a projection.
|
|
278
|
+
const fieldCompletionSource = autocomplete.ifNotIn(dontComplete, (context) => {
|
|
279
|
+
const match = context.matchBefore(/([\w')\]]|^|\()\.[\w']*/);
|
|
280
|
+
if (!match)
|
|
281
|
+
return null;
|
|
282
|
+
const before = context.state.doc.sliceString(0, match.from + match.text.indexOf("."));
|
|
283
|
+
const qualifier = /([a-z][\w']*)$/.exec(before);
|
|
284
|
+
if (qualifier && moduleMembers[qualifier[1]])
|
|
285
|
+
return null;
|
|
286
|
+
const from = match.from + match.text.indexOf(".") + 1;
|
|
287
|
+
const doc = context.state.doc;
|
|
288
|
+
const seen = new Set();
|
|
289
|
+
const options = [];
|
|
290
|
+
language.syntaxTree(context.state).iterate({
|
|
291
|
+
enter(node) {
|
|
292
|
+
if (node.name != "FieldName" || node.to == context.pos)
|
|
293
|
+
return;
|
|
294
|
+
const label = doc.sliceString(node.from, node.to);
|
|
295
|
+
if (seen.has(label))
|
|
296
|
+
return;
|
|
297
|
+
seen.add(label);
|
|
298
|
+
options.push({ label, type: "property" });
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
return options.length ? { from, options, validFor: Identifier } : null;
|
|
302
|
+
});
|
|
303
|
+
/// The constructors written in the file's sum types, after a `#`.
|
|
304
|
+
const constructorCompletionSource = autocomplete.ifNotIn(dontComplete, (context) => {
|
|
305
|
+
const match = context.matchBefore(/#[\w']*/);
|
|
306
|
+
if (!match)
|
|
307
|
+
return null;
|
|
308
|
+
const doc = context.state.doc;
|
|
309
|
+
const seen = new Set();
|
|
310
|
+
const options = [];
|
|
311
|
+
language.syntaxTree(context.state).iterate({
|
|
312
|
+
enter(node) {
|
|
313
|
+
if (node.name != "Constructor" || node.to == context.pos)
|
|
314
|
+
return;
|
|
315
|
+
const label = doc.sliceString(node.from, node.to);
|
|
316
|
+
if (seen.has(label))
|
|
317
|
+
return;
|
|
318
|
+
seen.add(label);
|
|
319
|
+
options.push({ label, type: "enum" });
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
return options.length ? { from: match.from, options, validFor: /^#?[\w']*$/ } : null;
|
|
323
|
+
});
|
|
324
|
+
// The node names that hold a type. A name inside a type, such as the `x` in
|
|
325
|
+
// `(x: i64) -> [x]i32`, isn't a value in scope.
|
|
326
|
+
const typeNodes = new Set([
|
|
327
|
+
"ReturnType", "FunctionType", "ArrayType", "UniqueType", "ExistentialType", "TypeApplication",
|
|
328
|
+
"TupleType", "RecordType", "ParenthesizedType", "SumType", "TypeName", "QualifiedType",
|
|
329
|
+
]);
|
|
330
|
+
function patternVariables(node, def) {
|
|
331
|
+
if (node.name == "VariableDefinition")
|
|
332
|
+
def(node, "variable");
|
|
333
|
+
else if (typeNodes.has(node.name))
|
|
334
|
+
return;
|
|
335
|
+
else
|
|
336
|
+
for (let ch = node.firstChild; ch; ch = ch.nextSibling)
|
|
337
|
+
patternVariables(ch, def);
|
|
338
|
+
}
|
|
339
|
+
function child(node, name, after = node.from) {
|
|
340
|
+
for (let ch = node.firstChild; ch; ch = ch.nextSibling)
|
|
341
|
+
if (ch.name == name && ch.from >= after)
|
|
342
|
+
return ch;
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
// The parameters of a function, written between its name and its `=`.
|
|
346
|
+
function parameters(node, name, end, def) {
|
|
347
|
+
for (let ch = name.nextSibling; ch && ch.from < end; ch = ch.nextSibling) {
|
|
348
|
+
if (ch.name == "SizeParameter") {
|
|
349
|
+
const size = ch.getChild("SizeName");
|
|
350
|
+
if (size)
|
|
351
|
+
def(size, "variable");
|
|
352
|
+
}
|
|
353
|
+
else if (ch.name != "TypeParameter" && ch.name != "ReturnType") {
|
|
354
|
+
patternVariables(ch, def);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// What a declaration adds to the scope after it.
|
|
359
|
+
function declaration(node, def) {
|
|
360
|
+
var _a;
|
|
361
|
+
switch (node.name) {
|
|
362
|
+
case "LocalDeclaration":
|
|
363
|
+
if (node.lastChild)
|
|
364
|
+
declaration(node.lastChild, def);
|
|
365
|
+
break;
|
|
366
|
+
case "ValueDeclaration": {
|
|
367
|
+
const name = node.getChild("DefName");
|
|
368
|
+
const eq = child(node, "=");
|
|
369
|
+
if (!name)
|
|
370
|
+
break;
|
|
371
|
+
const takesArguments = !!eq && ((_a = name.nextSibling) === null || _a === void 0 ? void 0 : _a.from) != eq.from;
|
|
372
|
+
def(name, takesArguments ? "function" : "variable");
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
case "TypeDeclaration": {
|
|
376
|
+
const name = node.getChild("TypeDefinition");
|
|
377
|
+
if (name)
|
|
378
|
+
def(name, "type");
|
|
379
|
+
break;
|
|
380
|
+
}
|
|
381
|
+
case "ModuleDeclaration":
|
|
382
|
+
case "ModuleTypeDeclaration": {
|
|
383
|
+
const name = node.getChild("ModuleDefinition");
|
|
384
|
+
if (name)
|
|
385
|
+
def(name, "namespace");
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
// What a node puts in scope for a cursor at `pos` inside it.
|
|
391
|
+
function scope(node, pos, def) {
|
|
392
|
+
var _a, _b, _c, _d, _e;
|
|
393
|
+
switch (node.name) {
|
|
394
|
+
case "Program":
|
|
395
|
+
case "ModuleBody":
|
|
396
|
+
// Futhark has no forward references, so a declaration is in scope after
|
|
397
|
+
// it ends, and not inside itself.
|
|
398
|
+
for (let ch = node.firstChild; ch && ch.to <= pos; ch = ch.nextSibling)
|
|
399
|
+
declaration(ch, def);
|
|
400
|
+
break;
|
|
401
|
+
case "ValueDeclaration": {
|
|
402
|
+
const name = (_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.nextSibling;
|
|
403
|
+
const eq = child(node, "=");
|
|
404
|
+
if (name && eq && pos >= eq.to)
|
|
405
|
+
parameters(node, name, eq.from, def);
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
case "LetExpression": {
|
|
409
|
+
const eq = child(node, "=");
|
|
410
|
+
const value = eq === null || eq === void 0 ? void 0 : eq.nextSibling;
|
|
411
|
+
if (!eq || pos < eq.to)
|
|
412
|
+
break;
|
|
413
|
+
const name = node.getChild("DefName");
|
|
414
|
+
if (value && pos <= value.to) {
|
|
415
|
+
// Inside the value, a local function sees its parameters.
|
|
416
|
+
if (name)
|
|
417
|
+
parameters(node, name, eq.from, def);
|
|
418
|
+
}
|
|
419
|
+
else if (name) {
|
|
420
|
+
def(name, "function");
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
for (let ch = (_b = node.firstChild) === null || _b === void 0 ? void 0 : _b.nextSibling; ch && ch.from < eq.from; ch = ch.nextSibling)
|
|
424
|
+
if (ch.name != "VariableName")
|
|
425
|
+
patternVariables(ch, def);
|
|
426
|
+
}
|
|
427
|
+
break;
|
|
428
|
+
}
|
|
429
|
+
case "LambdaExpression":
|
|
430
|
+
case "MatchCase": {
|
|
431
|
+
const arrow = child(node, "->");
|
|
432
|
+
if (!arrow || pos < arrow.to)
|
|
433
|
+
break;
|
|
434
|
+
for (let ch = (_c = node.firstChild) === null || _c === void 0 ? void 0 : _c.nextSibling; ch && ch.from < arrow.from; ch = ch.nextSibling)
|
|
435
|
+
patternVariables(ch, def);
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
case "LoopExpression": {
|
|
439
|
+
const pattern = (_d = node.firstChild) === null || _d === void 0 ? void 0 : _d.nextSibling;
|
|
440
|
+
if (!pattern)
|
|
441
|
+
break;
|
|
442
|
+
const form = (_e = child(node, "for")) !== null && _e !== void 0 ? _e : child(node, "while");
|
|
443
|
+
if (form && pos >= form.from)
|
|
444
|
+
patternVariables(pattern, def);
|
|
445
|
+
const doKw = child(node, "do");
|
|
446
|
+
if (doKw && pos >= doKw.to) {
|
|
447
|
+
const forKw = child(node, "for");
|
|
448
|
+
const bound = forKw === null || forKw === void 0 ? void 0 : forKw.nextSibling;
|
|
449
|
+
if (bound)
|
|
450
|
+
patternVariables(bound, def);
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function namesInScope(doc, inner, pos) {
|
|
457
|
+
const completions = [];
|
|
458
|
+
const seen = new Set();
|
|
459
|
+
const def = (n, type) => {
|
|
460
|
+
const label = doc.sliceString(n.from, n.to);
|
|
461
|
+
if (!label || seen.has(label))
|
|
462
|
+
return;
|
|
463
|
+
seen.add(label);
|
|
464
|
+
completions.push({ label, type });
|
|
465
|
+
};
|
|
466
|
+
for (let node = inner; node; node = node.parent)
|
|
467
|
+
scope(node, pos, def);
|
|
468
|
+
return completions;
|
|
469
|
+
}
|
|
470
|
+
/// Completes the names declared in the file that are in scope at the cursor:
|
|
471
|
+
/// the definitions above it, the parameters of the function it is in, and the
|
|
472
|
+
/// names bound by `let`, `loop`, `case` and lambdas around it.
|
|
473
|
+
const localCompletionSource = (context) => {
|
|
474
|
+
const inner = language.syntaxTree(context.state).resolveInner(context.pos, -1);
|
|
475
|
+
if (dontComplete.includes(inner.name) || afterDot(context) || afterHash(context))
|
|
476
|
+
return null;
|
|
477
|
+
const word = context.matchBefore(/[\w']+/);
|
|
478
|
+
if (!word && !context.explicit)
|
|
479
|
+
return null;
|
|
480
|
+
let options = namesInScope(context.state.doc, inner, context.pos);
|
|
481
|
+
// The name being typed may be in the tree as a declaration of its own, and
|
|
482
|
+
// offering it back as its own completion helps nobody.
|
|
483
|
+
if (word)
|
|
484
|
+
options = options.filter((o) => o.label != word.text);
|
|
485
|
+
return { options, from: word ? word.from : context.pos, validFor: Identifier };
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
// Folding a declaration or block keeps its first line in view, which is the
|
|
489
|
+
// line that says what was folded away.
|
|
490
|
+
function foldBody(node, state) {
|
|
491
|
+
const line = state.doc.lineAt(node.from);
|
|
492
|
+
return node.to > line.to ? { from: line.to, to: node.to } : null;
|
|
493
|
+
}
|
|
494
|
+
// A line that ends by opening something is followed by one indented under it.
|
|
495
|
+
const opensBlock = /(=|->|\bthen|\belse|\bdo|\bin|\(|\[|\{|,|\|>|<\||\+\+|&&|\|\||[-+*\/%])$/;
|
|
496
|
+
// These words line up with the start of the expression they belong to: `in`
|
|
497
|
+
// with its `let`, `then` and `else` with their `if`, and `case` with its
|
|
498
|
+
// `match`.
|
|
499
|
+
const closers = {
|
|
500
|
+
in: "LetExpression",
|
|
501
|
+
then: "IfExpression",
|
|
502
|
+
else: "IfExpression",
|
|
503
|
+
case: "MatchExpression",
|
|
504
|
+
};
|
|
505
|
+
function columnOf(state, pos) {
|
|
506
|
+
return pos - state.doc.lineAt(pos).from;
|
|
507
|
+
}
|
|
508
|
+
const indentFuthark = language.indentService.of((context, pos) => {
|
|
509
|
+
const state = context.state;
|
|
510
|
+
const tree = language.syntaxTree(state);
|
|
511
|
+
const inside = tree.resolveInner(pos, -1).name;
|
|
512
|
+
if (inside == "String" || inside == "LineComment")
|
|
513
|
+
return null;
|
|
514
|
+
const rest = state.doc.sliceString(pos, Math.min(state.doc.length, pos + 40));
|
|
515
|
+
const word = /^\s*(in|then|else|case)\b/.exec(rest);
|
|
516
|
+
if (word) {
|
|
517
|
+
const at = pos + word[0].length - word[1].length;
|
|
518
|
+
let node = tree.resolveInner(at, 1);
|
|
519
|
+
while (node && (node.name != closers[word[1]] || node.from >= at))
|
|
520
|
+
node = node.parent;
|
|
521
|
+
if (node)
|
|
522
|
+
return word[1] == "in" ? columnOf(state, node.from) : context.lineIndent(node.from);
|
|
523
|
+
}
|
|
524
|
+
let line = context.lineAt(pos, -1);
|
|
525
|
+
while (!/\S/.test(line.text) && line.from > 0)
|
|
526
|
+
line = context.lineAt(line.from - 1, -1);
|
|
527
|
+
if (!/\S/.test(line.text))
|
|
528
|
+
return 0;
|
|
529
|
+
const code = line.text.replace(/\s*--.*$/, "").trimEnd();
|
|
530
|
+
const base = context.lineIndent(line.from);
|
|
531
|
+
if (opensBlock.test(code))
|
|
532
|
+
return base + context.unit;
|
|
533
|
+
return base;
|
|
534
|
+
});
|
|
535
|
+
const futharkLanguage = language.LRLanguage.define({
|
|
536
|
+
name: "futhark",
|
|
537
|
+
parser: parser.configure({
|
|
538
|
+
props: [
|
|
539
|
+
language.foldNodeProp.add({
|
|
540
|
+
"ValueDeclaration TypeDeclaration ModuleDeclaration ModuleTypeDeclaration": foldBody,
|
|
541
|
+
"LetExpression IfExpression LoopExpression MatchExpression MatchCase LambdaExpression": foldBody,
|
|
542
|
+
"ModuleBody SignatureBody Record RecordType RecordPattern ArrayExpression Tuple": language.foldInside,
|
|
543
|
+
}),
|
|
544
|
+
highlight.styleTags({
|
|
545
|
+
"def let entry val": highlight.tags.definitionKeyword,
|
|
546
|
+
"type module": highlight.tags.definitionKeyword,
|
|
547
|
+
"open import include local": highlight.tags.moduleKeyword,
|
|
548
|
+
"if then else match case loop for while do in with assert": highlight.tags.controlKeyword,
|
|
549
|
+
"true false": highlight.tags.bool,
|
|
550
|
+
Number: highlight.tags.integer,
|
|
551
|
+
Float: highlight.tags.float,
|
|
552
|
+
FieldNumber: highlight.tags.integer,
|
|
553
|
+
String: highlight.tags.string,
|
|
554
|
+
Char: highlight.tags.character,
|
|
555
|
+
LineComment: highlight.tags.lineComment,
|
|
556
|
+
Attribute: highlight.tags.meta,
|
|
557
|
+
"\"???\"": highlight.tags.keyword,
|
|
558
|
+
Wildcard: highlight.tags.atom,
|
|
559
|
+
DefName: highlight.tags.definition(highlight.tags.function(highlight.tags.variableName)),
|
|
560
|
+
"OperatorName/...": highlight.tags.definition(highlight.tags.operator),
|
|
561
|
+
VariableDefinition: highlight.tags.definition(highlight.tags.variableName),
|
|
562
|
+
"Callee/VariableName": highlight.tags.function(highlight.tags.variableName),
|
|
563
|
+
"Callee/FieldExpression/FieldName": highlight.tags.function(highlight.tags.variableName),
|
|
564
|
+
VariableName: highlight.tags.variableName,
|
|
565
|
+
FieldName: highlight.tags.propertyName,
|
|
566
|
+
"TypeName TypeVariable": highlight.tags.typeName,
|
|
567
|
+
TypeDefinition: highlight.tags.definition(highlight.tags.typeName),
|
|
568
|
+
SizeName: highlight.tags.variableName,
|
|
569
|
+
ModuleName: highlight.tags.namespace,
|
|
570
|
+
ModuleDefinition: highlight.tags.definition(highlight.tags.namespace),
|
|
571
|
+
Constructor: highlight.tags.className,
|
|
572
|
+
"PipeRightOp PipeLeftOp": highlight.tags.operator,
|
|
573
|
+
"OrOp AndOp": highlight.tags.logicOperator,
|
|
574
|
+
CompareOp: highlight.tags.compareOperator,
|
|
575
|
+
"BitOp ShiftOp": highlight.tags.bitwiseOperator,
|
|
576
|
+
"PlusOp TimesOp PowerOp": highlight.tags.arithmeticOperator,
|
|
577
|
+
"QualifiedOperator/...": highlight.tags.operator,
|
|
578
|
+
'"-" "!" "`" ".." "..." "..<" "..>" "\\\\" "|" "*" "?" "^" "~" "<"': highlight.tags.operator,
|
|
579
|
+
'"=" "->"': highlight.tags.definitionOperator,
|
|
580
|
+
'":" ":>"': highlight.tags.typeOperator,
|
|
581
|
+
'"," "."': highlight.tags.separator,
|
|
582
|
+
"( )": highlight.tags.paren,
|
|
583
|
+
"[ ] IndexOpen": highlight.tags.squareBracket,
|
|
584
|
+
"{ }": highlight.tags.brace,
|
|
585
|
+
}),
|
|
586
|
+
],
|
|
587
|
+
}),
|
|
588
|
+
languageData: {
|
|
589
|
+
commentTokens: { line: "--" },
|
|
590
|
+
closeBrackets: { brackets: ["(", "[", "{", '"'] },
|
|
591
|
+
indentOnInput: /^\s*(in|then|else|case)$/,
|
|
592
|
+
},
|
|
593
|
+
});
|
|
594
|
+
/// Futhark language support, with completion for keywords, snippets, the
|
|
595
|
+
/// prelude and the names declared in the file.
|
|
596
|
+
function futhark() {
|
|
597
|
+
return new language.LanguageSupport(futharkLanguage, [
|
|
598
|
+
indentFuthark,
|
|
599
|
+
futharkLanguage.data.of({ autocomplete: futharkCompletion }),
|
|
600
|
+
futharkLanguage.data.of({ autocomplete: moduleCompletionSource }),
|
|
601
|
+
futharkLanguage.data.of({ autocomplete: fieldCompletionSource }),
|
|
602
|
+
futharkLanguage.data.of({ autocomplete: constructorCompletionSource }),
|
|
603
|
+
futharkLanguage.data.of({ autocomplete: localCompletionSource }),
|
|
604
|
+
]);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
exports.constructorCompletionSource = constructorCompletionSource;
|
|
608
|
+
exports.fieldCompletionSource = fieldCompletionSource;
|
|
609
|
+
exports.futhark = futhark;
|
|
610
|
+
exports.futharkCompletion = futharkCompletion;
|
|
611
|
+
exports.futharkLanguage = futharkLanguage;
|
|
612
|
+
exports.localCompletionSource = localCompletionSource;
|
|
613
|
+
exports.moduleCompletionSource = moduleCompletionSource;
|
|
614
|
+
exports.parser = parser;
|
|
615
|
+
exports.snippets = snippets;
|