@exercism/codemirror-lang-batch 0.0.0-stage → 1.0.1

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/dist/index.js ADDED
@@ -0,0 +1,564 @@
1
+ import { ExternalTokenizer, LRParser } from '@lezer/lr';
2
+ import { syntaxTree, LRLanguage, indentNodeProp, delimitedIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language';
3
+ import { styleTags, tags } from '@lezer/highlight';
4
+ import { snippetCompletion, completeFromList } from '@codemirror/autocomplete';
5
+
6
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
7
+ const glue = 101, operandGlue = 102, LineComment = 1, LabelDefinition = 2, LabelComment = 3, gotoLabel = 4, callLabel = 5, kwElse = 6, Variable = 7, DelayedVariable = 8, ArgumentVariable = 9, ForVariable = 10, escapedPercent = 103, bangText = 104, VariableDefinition = 11, kwIf = 12, kwNot = 13, kwDefined = 14, kwExist = 15, kwErrorlevel = 16, kwCmdextversion = 17, kwEqu = 18, kwNeq = 19, kwLss = 20, kwLeq = 21, kwGtr = 22, kwGeq = 23, kwFor = 24, kwIn = 25, kwDo = 26, kwSet = 27, kwEcho = 28, kwGoto = 29, kwCall = 30, kwSetlocal = 31, kwEndlocal = 32, kwShift = 33, kwExit = 34, kwPause = 35, kwCls = 36, setArithmetic = 37, setPrompt = 38, Option = 39, Number = 40;
8
+
9
+ // The parts of batch that a Lezer token rule can't read: words that are
10
+ // keywords in some places only, labels and comments that depend on where
11
+ // the line starts, variables that run to the next % or !, and the glue
12
+ // between the pieces of one argument.
13
+ const newline = 10, carriageReturn = 13, space = 32, tab = 9;
14
+ const percent = 37, bang = 33, colon = 58, tilde = 126, star = 42;
15
+ function isSpace(ch) {
16
+ return ch == space || ch == tab || ch == carriageReturn;
17
+ }
18
+ function isEnd(ch) {
19
+ return ch < 0 || ch == newline;
20
+ }
21
+ function isLetter(ch) {
22
+ return (ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122);
23
+ }
24
+ function isDigit(ch) {
25
+ return ch >= 48 && ch <= 57;
26
+ }
27
+ function readsWord(input, word) {
28
+ for (let i = 0; i < word.length; i++) {
29
+ const ch = input.peek(i);
30
+ if (ch < 0 || String.fromCharCode(ch).toLowerCase() != word[i])
31
+ return false;
32
+ }
33
+ return true;
34
+ }
35
+ // A command such as "rem" ends where a space, a newline or a bracket follows.
36
+ function endsWord(ch) {
37
+ return isEnd(ch) || isSpace(ch) || ch == 40 /* ( */ || ch == 41 /* ) */;
38
+ }
39
+ // Characters that end a label name, as in ":loop" or "goto :eof".
40
+ const labelStops = new Set(Array.from(':+;,=&|<>()^"%!').map((c) => c.charCodeAt(0)));
41
+ function isLabelChar(ch) {
42
+ return !isEnd(ch) && !isSpace(ch) && !labelStops.has(ch);
43
+ }
44
+ function skipToLineEnd(input) {
45
+ while (!isEnd(input.next))
46
+ input.advance();
47
+ }
48
+ // Glue goes between two pieces with no space between them, so that
49
+ // "%name%.txt" reads as one argument and "echo %a% %b%" as two.
50
+ const argumentStops = new Set(Array.from("&|<>)").map((c) => c.charCodeAt(0)));
51
+ const operandStops = new Set(Array.from("&|<>)(=@").map((c) => c.charCodeAt(0)));
52
+ const glueTokens = new ExternalTokenizer((input, stack) => {
53
+ const before = input.peek(-1), next = input.next;
54
+ if (before < 0 || isSpace(before) || before == newline)
55
+ return;
56
+ if (isEnd(next) || isSpace(next))
57
+ return;
58
+ if (stack.canShift(glue) && !argumentStops.has(next))
59
+ input.acceptToken(glue);
60
+ else if (stack.canShift(operandGlue) && !operandStops.has(next))
61
+ input.acceptToken(operandGlue);
62
+ }, { contextual: true });
63
+ const comments = new ExternalTokenizer((input, stack) => {
64
+ const next = input.next;
65
+ if (isEnd(next) || isSpace(next))
66
+ return;
67
+ if (stack.canShift(kwElse) && readsWord(input, "else") && endsWord(input.peek(4))) {
68
+ input.acceptToken(kwElse, 4);
69
+ return;
70
+ }
71
+ // "goto:eof" and "call:sub" need no space before the colon.
72
+ for (const [word, term] of [["goto", kwGoto], ["call", kwCall]]) {
73
+ if (readsWord(input, word) && input.peek(4) == colon && stack.canShift(term)) {
74
+ input.acceptToken(term, 4);
75
+ return;
76
+ }
77
+ }
78
+ if (stack.canShift(LineComment)) {
79
+ if (next == colon && input.peek(1) == colon) {
80
+ skipToLineEnd(input);
81
+ input.acceptToken(LineComment);
82
+ return;
83
+ }
84
+ if (readsWord(input, "rem") && (endsWord(input.peek(3)) || input.peek(3) == 46 /* . */)) {
85
+ skipToLineEnd(input);
86
+ input.acceptToken(LineComment);
87
+ return;
88
+ }
89
+ }
90
+ if (next == colon && stack.canShift(LabelDefinition)) {
91
+ let length = 1;
92
+ while (isLabelChar(input.peek(length)))
93
+ length++;
94
+ if (length > 1) {
95
+ input.acceptToken(LabelDefinition, length);
96
+ return;
97
+ }
98
+ }
99
+ // Anything after a label's name is ignored, so it reads as a comment.
100
+ if (stack.canShift(LabelComment)) {
101
+ skipToLineEnd(input);
102
+ input.acceptToken(LabelComment);
103
+ return;
104
+ }
105
+ // "goto" takes a label with or without its colon. "call" needs the
106
+ // colon, because "call name" runs a command or another file.
107
+ const term = stack.canShift(gotoLabel) ? gotoLabel : stack.canShift(callLabel) ? callLabel : -1;
108
+ if (term >= 0) {
109
+ let length = 0;
110
+ if (next == colon)
111
+ length = 1;
112
+ else if (term == callLabel)
113
+ return;
114
+ while (isLabelChar(input.peek(length)))
115
+ length++;
116
+ if (length > (next == colon ? 1 : 0))
117
+ input.acceptToken(term, length);
118
+ }
119
+ }, { contextual: true });
120
+ // Reads %name%, %1, %~dp0, %%a and !name!. Batch pairs a % with the next %
121
+ // on the line, so "%x:a=b%" and "%phrase:-= %" are each one variable. A %
122
+ // or ! with no partner is plain text.
123
+ const variables = new ExternalTokenizer((input) => {
124
+ const next = input.next;
125
+ if (next == percent) {
126
+ const second = input.peek(1);
127
+ if (second == percent) {
128
+ const third = input.peek(2);
129
+ if (third == tilde) {
130
+ let length = 3;
131
+ while (isLetter(input.peek(length)) || input.peek(length) == 36 /* $ */ || input.peek(length) == colon)
132
+ length++;
133
+ if (length > 3) {
134
+ input.acceptToken(ForVariable, length);
135
+ return;
136
+ }
137
+ }
138
+ else if (isLetter(third)) {
139
+ input.acceptToken(ForVariable, 3);
140
+ return;
141
+ }
142
+ input.acceptToken(escapedPercent, 2);
143
+ return;
144
+ }
145
+ if (second == tilde) {
146
+ let length = 2;
147
+ while (isLetter(input.peek(length)) || input.peek(length) == 36 || input.peek(length) == colon)
148
+ length++;
149
+ if (isDigit(input.peek(length))) {
150
+ input.acceptToken(ArgumentVariable, length + 1);
151
+ return;
152
+ }
153
+ }
154
+ if (isDigit(second) || second == star) {
155
+ input.acceptToken(ArgumentVariable, 2);
156
+ return;
157
+ }
158
+ let length = 1;
159
+ while (!isEnd(input.peek(length)) && input.peek(length) != percent)
160
+ length++;
161
+ if (input.peek(length) == percent && length > 1)
162
+ input.acceptToken(Variable, length + 1);
163
+ else
164
+ input.acceptToken(escapedPercent, 1);
165
+ return;
166
+ }
167
+ if (next == bang) {
168
+ let length = 1;
169
+ while (!isEnd(input.peek(length)) && input.peek(length) != bang)
170
+ length++;
171
+ if (input.peek(length) == bang && length > 1)
172
+ input.acceptToken(DelayedVariable, length + 1);
173
+ else
174
+ input.acceptToken(bangText, 1);
175
+ }
176
+ });
177
+ // The name in "set name=value" runs up to the "=".
178
+ const setNameStops = new Set(Array.from('"%!^&|<>').map((c) => c.charCodeAt(0)));
179
+ const setNames = new ExternalTokenizer((input, stack) => {
180
+ if (!stack.canShift(VariableDefinition))
181
+ return;
182
+ let length = 0;
183
+ for (;;) {
184
+ const ch = input.peek(length);
185
+ if (ch == 61 /* = */)
186
+ break;
187
+ if (isEnd(ch) || isSpace(ch) || setNameStops.has(ch))
188
+ return;
189
+ length++;
190
+ }
191
+ if (length > 0)
192
+ input.acceptToken(VariableDefinition, length);
193
+ }, { contextual: true });
194
+ // Batch is case-insensitive, and its keywords are only keywords where they
195
+ // can be used. "in" is a keyword in a for loop, and a plain word in an echo.
196
+ const keywords = {
197
+ if: kwIf, not: kwNot, defined: kwDefined, exist: kwExist,
198
+ errorlevel: kwErrorlevel, cmdextversion: kwCmdextversion,
199
+ equ: kwEqu, neq: kwNeq, lss: kwLss, leq: kwLeq, gtr: kwGtr, geq: kwGeq,
200
+ for: kwFor, in: kwIn, do: kwDo, set: kwSet, echo: kwEcho,
201
+ goto: kwGoto, call: kwCall, setlocal: kwSetlocal, endlocal: kwEndlocal,
202
+ shift: kwShift, exit: kwExit, pause: kwPause, cls: kwCls,
203
+ "/a": setArithmetic, "/p": setPrompt,
204
+ };
205
+ function specializeWord(value, stack) {
206
+ const lower = value.toLowerCase();
207
+ const keyword = keywords[lower];
208
+ if (keyword != null && stack.canShift(keyword))
209
+ return keyword;
210
+ // "echo." and "echo:" print an empty line.
211
+ if (/^echo[.:\/\\\[\]+,;]/.test(lower) && stack.canShift(kwEcho))
212
+ return kwEcho;
213
+ if (/^\/[a-z?]+$/.test(lower) && stack.canShift(Option))
214
+ return Option;
215
+ if (/^[0-9]+$/.test(lower) && stack.canShift(Number))
216
+ return Number;
217
+ return -1;
218
+ }
219
+
220
+ // This file was generated by lezer-generator. You probably shouldn't edit it.
221
+ const parser = LRParser.deserialize({
222
+ version: 14,
223
+ states: "5rO!sQfOOO!zQbO'#DWOOQV'#DX'#DXOOQV'#Es'#EsO#YQdO'#DZOOQU'#DZ'#DZOOQU'#EY'#EYO$ZQfO'#EnO%nQfO'#DhO&vQdO'#DiO&}QdO'#DmO)VQnO'#DpO)gQfO'#D|O)nQfO'#D}O)xQfO'#EOO)gQfO'#EPOOQV'#ER'#ERO*SQgO'#EQO*^QbO'#EvOOQQ'#Ev'#EvOOQQ'#En'#EnO$ZQfO'#EnO+OQ`O'#EmOOQO'#El'#ElOOQU'#EX'#EXO+gQ`O'#EkO+rQfO'#EkQOQ`OOOOQO,59r,59rOOQV'#Et'#EtO+|OtO'#D`OOQV'#Ep'#EpO,hQdO'#DfOOQV'#Eo'#EoO,uQgO'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U!_!a!d!e!t!x!|#^#v#yS!OY!QY!on!S!q#{$[W#Z!V#W#]#}R$S#a|oSXZ[]_apwy{!U!_!a!d!e!t!x!|#^#v#yZ!on!S!q#{$[Q!ZZQ![[Q!^]Q!c_Q!faQ!spQ#c!_Q#e!aQ#h!eQ$R#^R$Y#yYdOW^j!jSuVeQ#O|Q#i!hQ#r!wQ$W#wQ$_$UQ$b$ZR$d$`T!PY!QX#[!V#W#]#}R!_]R!a^",
226
+ nodeNames: "⚠ LineComment LabelDefinition LabelComment LabelName LabelName else Variable DelayedVariable ArgumentVariable ForVariable VariableDefinition if not defined exist errorlevel cmdextversion equ neq lss leq gtr geq for in do set echo goto call setlocal endlocal shift exit pause cls Option Option Option Number Script Label At @ Redirect RedirectOp Argument Word \" String Escape = == ) ( ParenGroup DuplicateRedirect Block IfStatement Condition Operand CompareOp ForStatement ForVariableDefinition ForList SetStatement SetArithmetic ArithDefinition UpdateOp ArithName ArithNumber ArithOp ArithGroup , SetPrompt Assignment QuotedAssignment EchoStatement GotoStatement CallStatement BuiltinCommand Command CommandName ChainOp & && || |",
227
+ maxTerm: 127,
228
+ nodeProps: [
229
+ ["openedBy", 54, "("],
230
+ ["closedBy", 55, ")"]
231
+ ],
232
+ skippedNodes: [0],
233
+ repeatNodeCount: 11,
234
+ tokenData: "BO~RzOX#uXY%|YZ&sZ]#u]^%|^p#upq%|rs&xst&}tu&}vw)[wx#uxy+Syz+mz{,W{|,W|}-r}!O,W!O!P&}!P!Q,W!Q![/W![!^#u!^!_6i!_!`7z!`!a9U!a!b#u!b!c:i!c!}&}!}#O&}#O#P#u#P#Q&}#Q#R=m#R#S&}#S#T#u#T#o&}#o#p#u#p#q?Y#q#r#u#r#s@j#s;'S#u;'S;=`%v<%lO#uR#|c#fQ!QPOX#uXY%XZ]#u]^%X^p#upq%Xsu#uvw%Xwx#uxz%Xz!^#u!^!a%X!a#Q#u#Q#R%X#R#p#u#p#q%X#q;'S#u;'S;=`%v<%lO#uQ%^U#fQ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q>bqs>{su>buv>{v;'S>b;'S;=`?Q;=`<%l>{<%lO>bV>iU!TT#fQOY%XZq%Xsu%Xv;'S%X;'S;=`%p<%lO%XT?QO!TTV?VP!TT;=`<%l>bV?aY!zT#fQOY%XZq%Xsu%Xv!_%X!_!`*i!`#p%X#p#q@P#q;'S%X;'S;=`%p<%lO%XV@WU!yT#fQOY%XZq%Xsu%Xv;'S%X;'S;=`%p<%lO%XV@sc#oS#fQ!QPOX#uXY%XZ]#u]^%X^p#upq%Xsu#uvw%Xwx#uxz%Xz!^#u!^!a%X!a#Q#u#Q#R%X#R#p#u#p#q%X#q;'S#u;'S;=`%v<%lO#u",
235
+ tokenizers: [glueTokens, comments, variables, setNames, 0, 1, 2],
236
+ topRules: { "Script": [0, 41] },
237
+ specialized: [{ term: 48, get: (value, stack) => (specializeWord(value, stack) << 1), external: specializeWord }],
238
+ tokenPrec: 2009
239
+ });
240
+
241
+ const keywordNames = [
242
+ "call", "cls", "echo", "endlocal", "exit", "for", "goto", "if", "pause",
243
+ "rem", "set", "setlocal", "shift",
244
+ ];
245
+ // Common commands that batch solutions run, built into cmd.exe or shipped with Windows.
246
+ const commandNames = [
247
+ "cd", "choice", "cmd", "copy", "del", "dir", "find", "findstr", "md",
248
+ "more", "popd", "pushd", "sort", "start", "timeout", "title", "type", "ver",
249
+ "where",
250
+ ];
251
+ const commands = [
252
+ ...keywordNames.map((label) => ({ label, type: "keyword" })),
253
+ ...commandNames.map((label) => ({ label, type: "function", detail: "command" })),
254
+ ];
255
+ const snippets = [
256
+ snippetCompletion("@echo off\nsetlocal enabledelayedexpansion\n${}", {
257
+ label: "echo",
258
+ detail: "off, script header",
259
+ type: "keyword",
260
+ }),
261
+ snippetCompletion("setlocal enabledelayedexpansion", {
262
+ label: "setlocal",
263
+ detail: "enabledelayedexpansion",
264
+ type: "keyword",
265
+ }),
266
+ snippetCompletion("if ${condition} (\n\t${}\n)", {
267
+ label: "if",
268
+ detail: "block",
269
+ type: "keyword",
270
+ }),
271
+ snippetCompletion("if ${condition} (\n\t${}\n) else (\n\t${}\n)", {
272
+ label: "if",
273
+ detail: "/ else block",
274
+ type: "keyword",
275
+ }),
276
+ snippetCompletion("if not defined ${name} (\n\t${}\n)", {
277
+ label: "if",
278
+ detail: "not defined block",
279
+ type: "keyword",
280
+ }),
281
+ snippetCompletion("for %%${i} in (${list}) do (\n\t${}\n)", {
282
+ label: "for",
283
+ detail: "loop over a list",
284
+ type: "keyword",
285
+ }),
286
+ snippetCompletion("for /l %%${i} in (${start},${step},${end}) do (\n\t${}\n)", {
287
+ label: "for",
288
+ detail: "/l counting loop",
289
+ type: "keyword",
290
+ }),
291
+ snippetCompletion('for /f "tokens=${*}" %%${a} in (${input}) do (\n\t${}\n)', {
292
+ label: "for",
293
+ detail: "/f loop over lines",
294
+ type: "keyword",
295
+ }),
296
+ snippetCompletion(":${name}\n${}\nexit /b", {
297
+ label: ":label",
298
+ detail: "subroutine",
299
+ type: "keyword",
300
+ }),
301
+ snippetCompletion("call :${name} ${args}", {
302
+ label: "call",
303
+ detail: "subroutine",
304
+ type: "keyword",
305
+ }),
306
+ snippetCompletion("set /a ${name}=${expression}", {
307
+ label: "set",
308
+ detail: "/a arithmetic",
309
+ type: "keyword",
310
+ }),
311
+ snippetCompletion("set /p ${name}=${prompt}", {
312
+ label: "set",
313
+ detail: "/p read input",
314
+ type: "keyword",
315
+ }),
316
+ snippetCompletion('set "${name}=${value}"', {
317
+ label: "set",
318
+ detail: "quoted assignment",
319
+ type: "keyword",
320
+ }),
321
+ snippetCompletion("exit /b ${0}", {
322
+ label: "exit",
323
+ detail: "/b leave a subroutine",
324
+ type: "keyword",
325
+ }),
326
+ ];
327
+ const commandOptions = completeFromList([...snippets, ...commands]);
328
+ const conditionWords = [
329
+ { label: "not", type: "keyword" },
330
+ { label: "defined", type: "keyword" },
331
+ { label: "exist", type: "keyword" },
332
+ { label: "errorlevel", type: "keyword" },
333
+ { label: "/i", type: "keyword", detail: "ignore case" },
334
+ ];
335
+ const compareOperators = [
336
+ ["equ", "equal"], ["neq", "not equal"], ["lss", "less than"],
337
+ ["leq", "less or equal"], ["gtr", "greater than"], ["geq", "greater or equal"],
338
+ ].map(([label, detail]) => ({ label, detail, type: "operator" }));
339
+ const setOptions = [
340
+ { label: "/a", type: "keyword", detail: "arithmetic" },
341
+ { label: "/p", type: "keyword", detail: "read input" },
342
+ ];
343
+ // Variables that cmd.exe sets itself.
344
+ const dynamicVariables = ["errorlevel", "cd", "date", "time", "random"];
345
+ const argumentVariables = [
346
+ "%~1", "%~2", "%~3", "%1", "%2", "%*", "%~dp0",
347
+ ].map((label) => ({ label, type: "variable", detail: "argument" }));
348
+ const namesCache = new WeakMap();
349
+ // A name built from other variables, such as "nucleotide[!x!]", isn't offered.
350
+ const plainName = /^[A-Za-z_][\w.#$@-]*(\[[^\]%!]*\])?$/;
351
+ // Batch variables and labels belong to the whole file, because goto can
352
+ // jump anywhere, so every one set in the file is offered.
353
+ function namesIn(tree, doc) {
354
+ const cached = namesCache.get(tree);
355
+ if (cached)
356
+ return cached;
357
+ const variables = new Set(), labels = new Set();
358
+ tree.iterate({
359
+ enter(node) {
360
+ if (node.name == "VariableDefinition" || node.name == "ArithDefinition") {
361
+ const text = doc.slice(node.from, node.to);
362
+ if (plainName.test(text))
363
+ variables.add(text);
364
+ }
365
+ else if (node.name == "LabelDefinition") {
366
+ labels.add(doc.slice(node.from + 1, node.to));
367
+ }
368
+ },
369
+ });
370
+ const names = { variables: [...variables], labels: [...labels] };
371
+ namesCache.set(tree, names);
372
+ return names;
373
+ }
374
+ // A for loop's variable can only be used inside that loop.
375
+ function forVariablesAround(node, doc) {
376
+ const found = [];
377
+ for (let n = node; n; n = n.parent) {
378
+ if (n.name != "ForStatement")
379
+ continue;
380
+ const def = n.getChild("ForVariableDefinition");
381
+ if (def)
382
+ found.push(doc.slice(def.to - 1, def.to));
383
+ }
384
+ return found;
385
+ }
386
+ // Counts the % signs before `at` that open or close a variable, so that
387
+ // in "%a%b" the % after "a" isn't read as the start of a new variable.
388
+ function opensVariable(line, at) {
389
+ var _a;
390
+ let count = 0;
391
+ for (let i = 0; i < at; i++) {
392
+ if (line[i] != "%")
393
+ continue;
394
+ if (line[i + 1] == "%")
395
+ i++;
396
+ else if (!/[~0-9*]/.test((_a = line[i + 1]) !== null && _a !== void 0 ? _a : ""))
397
+ count++;
398
+ }
399
+ return count % 2 == 0;
400
+ }
401
+ function opensDelayed(line, at) {
402
+ let count = 0;
403
+ for (let i = 0; i < at; i++)
404
+ if (line[i] == "!")
405
+ count++;
406
+ return count % 2 == 0;
407
+ }
408
+ function lineBefore(context) {
409
+ const line = context.state.doc.lineAt(context.pos);
410
+ return { line, before: line.text.slice(0, context.pos - line.from) };
411
+ }
412
+ function variableCompletion(context, node) {
413
+ const { line, before } = lineBefore(context);
414
+ const doc = context.state.doc.toString();
415
+ // Inside a whole variable, as in "%na|me%", the option replaces all of it.
416
+ const inside = /^(Variable|DelayedVariable|ForVariable)$/.test(node.name) && node.to > context.pos;
417
+ const to = inside ? node.to : context.pos;
418
+ const forMatch = /%%~?[A-Za-z]?$/.exec(before);
419
+ if (forMatch) {
420
+ const names = forVariablesAround(node, doc);
421
+ if (!names.length)
422
+ return null;
423
+ return {
424
+ from: line.from + forMatch.index,
425
+ to,
426
+ options: names.map((name) => ({ label: "%%" + name, type: "variable", detail: "for" })),
427
+ validFor: /^%%~?[A-Za-z]?$/,
428
+ };
429
+ }
430
+ const percentMatch = /%~?[\w.#$@\[\]-]*$/.exec(before);
431
+ if (percentMatch && opensVariable(before, percentMatch.index)) {
432
+ const { variables } = namesIn(syntaxTree(context.state), doc);
433
+ const options = [
434
+ ...variables.map((name) => ({ label: `%${name}%`, type: "variable" })),
435
+ ...dynamicVariables.map((name) => ({ label: `%${name}%`, type: "variable", detail: "built-in" })),
436
+ ...argumentVariables,
437
+ ];
438
+ return { from: line.from + percentMatch.index, to, options, validFor: /^%~?[\w.#$@\[\]-]*%?$/ };
439
+ }
440
+ const bangMatch = /![\w.#$@\[\]-]*$/.exec(before);
441
+ if (bangMatch && opensDelayed(before, bangMatch.index)) {
442
+ const { variables } = namesIn(syntaxTree(context.state), doc);
443
+ const options = [
444
+ ...variables.map((name) => ({ label: `!${name}!`, type: "variable" })),
445
+ ...dynamicVariables.map((name) => ({ label: `!${name}!`, type: "variable", detail: "built-in" })),
446
+ ];
447
+ return { from: line.from + bangMatch.index, to, options, validFor: /^![\w.#$@\[\]-]*!?$/ };
448
+ }
449
+ return null;
450
+ }
451
+ function labelCompletion(context) {
452
+ var _a, _b;
453
+ const { before } = lineBefore(context);
454
+ const match = /\b(?:goto\s+(:?)|call\s+(:))([\w.-]*)$/i.exec(before);
455
+ if (!match)
456
+ return null;
457
+ const colon = (_b = (_a = match[1]) !== null && _a !== void 0 ? _a : match[2]) !== null && _b !== void 0 ? _b : "";
458
+ const { labels } = namesIn(syntaxTree(context.state), context.state.doc.toString());
459
+ const options = [...labels, "eof"].map((name) => ({
460
+ label: colon + name,
461
+ type: name == "eof" ? "keyword" : "function",
462
+ detail: name == "eof" ? "end of script" : "label",
463
+ }));
464
+ return { from: context.pos - match[3].length - colon.length, options, validFor: /^:?[\w.-]*$/ };
465
+ }
466
+ const ifStart = String.raw `\bif\s+(?:\/i\s+)?(?:not\s+)?`;
467
+ const conditionStart = new RegExp(ifStart + String.raw `(\w*)$`, "i");
468
+ const afterOperand = new RegExp(ifStart + String.raw `(?!(?:defined|exist|errorlevel)\s)[^\s=]+\s+(\w*)$`, "i");
469
+ const afterCondition = new RegExp(ifStart +
470
+ String.raw `(?:(?:defined|exist|errorlevel)\s+\S+|[^\s=]+\s*==\s*\S+|\S+\s+(?:equ|neq|lss|leq|gtr|geq)\s+\S+)\s+@?[\w.:]*$`, "i");
471
+ const commandStart = /(?:^|[(&|]|\b(?:do|else)\s)\s*@?[\w.:]*$/i;
472
+ const noCompletion = new Set(["LineComment", "LabelComment"]);
473
+ const stringNodes = new Set(["String", "QuotedAssignment"]);
474
+ function completion(context) {
475
+ const tree = syntaxTree(context.state);
476
+ const node = tree.resolveInner(context.pos, -1);
477
+ if (noCompletion.has(node.name))
478
+ return null;
479
+ const variables = variableCompletion(context, node);
480
+ if (variables)
481
+ return variables;
482
+ for (let n = node; n; n = n.parent)
483
+ if (stringNodes.has(n.name))
484
+ return null;
485
+ const labels = labelCompletion(context);
486
+ if (labels)
487
+ return labels;
488
+ const { before } = lineBefore(context);
489
+ const setMatch = /\bset\s+(\/\w*)$/i.exec(before);
490
+ if (setMatch)
491
+ return { from: context.pos - setMatch[1].length, options: setOptions, validFor: /^\/\w*$/ };
492
+ if (afterCondition.test(before) || commandStart.test(before)) {
493
+ // The words after echo are text, even "do" or "else".
494
+ for (let n = node; n; n = n.parent)
495
+ if (n.name == "EchoStatement" && n.firstChild && n.firstChild.to < context.pos)
496
+ return null;
497
+ return commandOptions(context);
498
+ }
499
+ const condition = conditionStart.exec(before);
500
+ if (condition) {
501
+ if (!condition[1] && !context.explicit)
502
+ return null;
503
+ return { from: context.pos - condition[1].length, options: conditionWords, validFor: /^\w*$/ };
504
+ }
505
+ const operand = afterOperand.exec(before);
506
+ if (operand) {
507
+ if (!operand[1] && !context.explicit)
508
+ return null;
509
+ return { from: context.pos - operand[1].length, options: compareOperators, validFor: /^\w*$/ };
510
+ }
511
+ return null;
512
+ }
513
+
514
+ const batchLanguage = LRLanguage.define({
515
+ name: "batch",
516
+ parser: parser.configure({
517
+ props: [
518
+ styleTags({
519
+ "if else for in do goto call exit": tags.controlKeyword,
520
+ "set echo setlocal endlocal shift pause cls": tags.keyword,
521
+ "not defined exist errorlevel cmdextversion": tags.operatorKeyword,
522
+ "CompareOp/...": tags.compareOperator,
523
+ "LineComment LabelComment": tags.lineComment,
524
+ String: tags.string,
525
+ 'String/"\\"" QuotedAssignment/"\\""': tags.string,
526
+ Escape: tags.escape,
527
+ Number: tags.number,
528
+ ArithNumber: tags.number,
529
+ Option: tags.attributeName,
530
+ "Variable DelayedVariable": tags.variableName,
531
+ "ArgumentVariable ForVariable": tags.special(tags.variableName),
532
+ "VariableDefinition ArithDefinition": tags.definition(tags.variableName),
533
+ "ForVariableDefinition/ForVariable": tags.definition(tags.special(tags.variableName)),
534
+ ArithName: tags.variableName,
535
+ LabelDefinition: tags.definition(tags.labelName),
536
+ LabelName: tags.labelName,
537
+ "CommandName/...": tags.function(tags.variableName),
538
+ ArithOp: tags.arithmeticOperator,
539
+ UpdateOp: tags.updateOperator,
540
+ "Assignment/= QuotedAssignment/=": tags.definitionOperator,
541
+ "ChainOp/...": tags.logicOperator,
542
+ "RedirectOp DuplicateRedirect": tags.operator,
543
+ "At/...": tags.meta,
544
+ "( )": tags.paren,
545
+ }),
546
+ indentNodeProp.add({
547
+ "Block ParenGroup ForList ArithGroup": delimitedIndent({ closing: ")", align: false }),
548
+ }),
549
+ foldNodeProp.add({
550
+ "Block ParenGroup": foldInside,
551
+ }),
552
+ ],
553
+ }),
554
+ languageData: {
555
+ commentTokens: { line: "REM" },
556
+ indentOnInput: /^\s*\)$/,
557
+ closeBrackets: { brackets: ["(", '"'] },
558
+ },
559
+ });
560
+ function batch() {
561
+ return new LanguageSupport(batchLanguage, batchLanguage.data.of({ autocomplete: completion }));
562
+ }
563
+
564
+ export { batch, batchLanguage, commands, completion, snippets };
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "@exercism/codemirror-lang-batch",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "Batch language support for CodeMirror",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/exercism/codemirror-lang-batch.git"
8
+ },
9
+ "homepage": "https://github.com/exercism/codemirror-lang-batch#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/exercism/codemirror-lang-batch/issues"
12
+ },
13
+ "scripts": {
14
+ "build:grammar": "lezer-generator src/syntax.grammar --typeScript -o src/parser.ts",
15
+ "prepare": "bun run build:grammar && bun --bun rollup -c",
16
+ "test": "bun run build:grammar && bun test",
17
+ "dev": "vite"
18
+ },
19
+ "type": "module",
20
+ "main": "dist/index.cjs",
21
+ "module": "dist/index.js",
22
+ "exports": {
23
+ "import": "./dist/index.js",
24
+ "require": "./dist/index.cjs"
25
+ },
26
+ "types": "dist/index.d.ts",
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "sideEffects": false,
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "dependencies": {
35
+ "@codemirror/autocomplete": "^6.18.0",
36
+ "@codemirror/language": "^6.10.1",
37
+ "@codemirror/state": "^6.4.0",
38
+ "@lezer/common": "^1.2.0",
39
+ "@lezer/highlight": "^1.2.0",
40
+ "@lezer/lr": "^1.4.0"
41
+ },
42
+ "devDependencies": {
43
+ "@lezer/generator": "^1.7.0",
44
+ "@types/bun": "^1.1.14",
45
+ "codemirror": "^6.0.1",
46
+ "rollup": "^4.18.0",
47
+ "rollup-plugin-dts": "^6.1.1",
48
+ "rollup-plugin-ts": "^3.4.5",
49
+ "typescript": "^5.4.5",
50
+ "unplugin-lezer": "^1.0.1",
51
+ "vite": "^5.4.11"
52
+ },
53
+ "license": "MIT"
54
+ }