@danielx/civet 0.5.84 → 0.5.85
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/browser.js +511 -225
- package/dist/main.js +511 -225
- package/dist/main.mjs +511 -225
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -126,16 +126,209 @@ var require_lib = __commonJS({
|
|
|
126
126
|
function gatherRecursiveWithinFunction(node, predicate) {
|
|
127
127
|
return gatherRecursive(node, predicate, isFunction);
|
|
128
128
|
}
|
|
129
|
+
function insertTrimmingSpace(target, c) {
|
|
130
|
+
if (!target)
|
|
131
|
+
return target;
|
|
132
|
+
if (Array.isArray(target))
|
|
133
|
+
return target.map((e, i) => {
|
|
134
|
+
if (i === 0)
|
|
135
|
+
return insertTrimmingSpace(e, c);
|
|
136
|
+
return e;
|
|
137
|
+
});
|
|
138
|
+
if (target.children)
|
|
139
|
+
return Object.assign({}, target, {
|
|
140
|
+
children: target.children.map((e, i) => {
|
|
141
|
+
if (i === 0)
|
|
142
|
+
return insertTrimmingSpace(e, c);
|
|
143
|
+
return e;
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
if (target.token)
|
|
147
|
+
return Object.assign({}, target, {
|
|
148
|
+
token: target.token.replace(/^ ?/, c)
|
|
149
|
+
});
|
|
150
|
+
return target;
|
|
151
|
+
}
|
|
152
|
+
function getTrimmingSpace(target) {
|
|
153
|
+
if (!target)
|
|
154
|
+
return;
|
|
155
|
+
if (Array.isArray(target))
|
|
156
|
+
return getTrimmingSpace(target[0]);
|
|
157
|
+
if (target.children)
|
|
158
|
+
return getTrimmingSpace(target.children[0]);
|
|
159
|
+
if (target.token)
|
|
160
|
+
return target.token.match(/^ ?/)[0];
|
|
161
|
+
}
|
|
162
|
+
function needsRef(exp) {
|
|
163
|
+
switch (exp.type) {
|
|
164
|
+
case "Identifier":
|
|
165
|
+
case "Literal":
|
|
166
|
+
case "Ref":
|
|
167
|
+
return false;
|
|
168
|
+
default:
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function maybeRef(exp, base = "ref") {
|
|
173
|
+
if (!needsRef(exp))
|
|
174
|
+
return exp;
|
|
175
|
+
return {
|
|
176
|
+
type: "Ref",
|
|
177
|
+
base,
|
|
178
|
+
id: base
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function literalValue(literal) {
|
|
182
|
+
let { raw } = literal;
|
|
183
|
+
switch (raw) {
|
|
184
|
+
case "null":
|
|
185
|
+
return null;
|
|
186
|
+
case "true":
|
|
187
|
+
return true;
|
|
188
|
+
case "false":
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
if (raw.startsWith('"') && raw.endsWith('"') || raw.startsWith("'") && raw.endsWith("'")) {
|
|
192
|
+
return raw.slice(1, -1);
|
|
193
|
+
}
|
|
194
|
+
const numeric = literal.children.find(
|
|
195
|
+
(child) => child.type === "NumericLiteral"
|
|
196
|
+
);
|
|
197
|
+
if (numeric) {
|
|
198
|
+
raw = raw.replace(/_/g, "");
|
|
199
|
+
const { token } = numeric;
|
|
200
|
+
if (token.endsWith("n")) {
|
|
201
|
+
return BigInt(raw.slice(0, -1));
|
|
202
|
+
} else if (token.match(/[\.eE]/)) {
|
|
203
|
+
return parseFloat(raw);
|
|
204
|
+
} else if (token.startsWith("0")) {
|
|
205
|
+
switch (token.charAt(1).toLowerCase()) {
|
|
206
|
+
case "x":
|
|
207
|
+
return parseInt(raw.replace(/0[xX]/, ""), 16);
|
|
208
|
+
case "b":
|
|
209
|
+
return parseInt(raw.replace(/0[bB]/, ""), 2);
|
|
210
|
+
case "o":
|
|
211
|
+
return parseInt(raw.replace(/0[oO]/, ""), 8);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return parseInt(raw, 10);
|
|
215
|
+
}
|
|
216
|
+
throw new Error("Unrecognized literal " + JSON.stringify(literal));
|
|
217
|
+
}
|
|
218
|
+
function forRange(open, forDeclaration, range, stepExp, close) {
|
|
219
|
+
const { start, end, inclusive } = range;
|
|
220
|
+
const counterRef = {
|
|
221
|
+
type: "Ref",
|
|
222
|
+
base: "i",
|
|
223
|
+
id: "i"
|
|
224
|
+
};
|
|
225
|
+
let stepRef;
|
|
226
|
+
if (stepExp) {
|
|
227
|
+
stepExp = insertTrimmingSpace(stepExp, "");
|
|
228
|
+
stepRef = maybeRef(stepExp, "step");
|
|
229
|
+
}
|
|
230
|
+
const startRef = maybeRef(start, "start");
|
|
231
|
+
const endRef = maybeRef(end, "end");
|
|
232
|
+
const startRefDec = startRef !== start ? [startRef, " = ", start, ", "] : [];
|
|
233
|
+
const endRefDec = endRef !== end ? [endRef, " = ", end, ", "] : [];
|
|
234
|
+
let ascDec = [], ascRef, asc;
|
|
235
|
+
if (stepRef) {
|
|
236
|
+
if (stepRef !== stepExp) {
|
|
237
|
+
ascDec = [", ", stepRef, " = ", stepExp];
|
|
238
|
+
}
|
|
239
|
+
} else if (start.type === "Literal" && end.type === "Literal") {
|
|
240
|
+
asc = literalValue(start) <= literalValue(end);
|
|
241
|
+
} else {
|
|
242
|
+
ascRef = {
|
|
243
|
+
type: "Ref",
|
|
244
|
+
base: "asc",
|
|
245
|
+
id: "asc"
|
|
246
|
+
};
|
|
247
|
+
ascDec = [", ", ascRef, " = ", startRef, " <= ", endRef];
|
|
248
|
+
}
|
|
249
|
+
let varAssign = [], varLetAssign = varAssign, varLet = varAssign, blockPrefix;
|
|
250
|
+
if (forDeclaration?.declare) {
|
|
251
|
+
if (forDeclaration.declare.token === "let") {
|
|
252
|
+
const varName = forDeclaration.children.splice(1);
|
|
253
|
+
varAssign = [...insertTrimmingSpace(varName, ""), " = "];
|
|
254
|
+
varLet = [",", ...varName, " = ", counterRef];
|
|
255
|
+
} else {
|
|
256
|
+
blockPrefix = [
|
|
257
|
+
["", forDeclaration, " = ", counterRef, ";\n"]
|
|
258
|
+
];
|
|
259
|
+
}
|
|
260
|
+
} else if (forDeclaration) {
|
|
261
|
+
varAssign = varLetAssign = [forDeclaration, " = "];
|
|
262
|
+
blockPrefix = [
|
|
263
|
+
["", {
|
|
264
|
+
type: "AssignmentExpression",
|
|
265
|
+
children: [],
|
|
266
|
+
names: forDeclaration.names
|
|
267
|
+
}]
|
|
268
|
+
];
|
|
269
|
+
}
|
|
270
|
+
const declaration = {
|
|
271
|
+
type: "Declaration",
|
|
272
|
+
children: ["let ", ...startRefDec, ...endRefDec, counterRef, " = ", ...varLetAssign, startRef, ...varLet, ...ascDec],
|
|
273
|
+
names: forDeclaration?.names
|
|
274
|
+
};
|
|
275
|
+
const counterPart = inclusive ? [counterRef, " <= ", endRef, " : ", counterRef, " >= ", endRef] : [counterRef, " < ", endRef, " : ", counterRef, " > ", endRef];
|
|
276
|
+
const condition = stepRef ? [stepRef, " !== 0 && (", stepRef, " > 0 ? ", ...counterPart, ")"] : ascRef ? [ascRef, " ? ", ...counterPart] : asc ? counterPart.slice(0, 3) : counterPart.slice(4);
|
|
277
|
+
const increment = stepRef ? [...varAssign, counterRef, " += ", stepRef] : ascRef ? [...varAssign, ascRef, " ? ++", counterRef, " : --", counterRef] : [...varAssign, asc ? "++" : "--", counterRef];
|
|
278
|
+
return {
|
|
279
|
+
declaration,
|
|
280
|
+
children: [open, declaration, "; ", ...condition, "; ", ...increment, close],
|
|
281
|
+
blockPrefix
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
function modifyString(str) {
|
|
285
|
+
return str.replace(/(^.?|[^\\]{2})(\\\\)*\n/g, "$1$2\\n");
|
|
286
|
+
}
|
|
287
|
+
function quoteString(str) {
|
|
288
|
+
str = str.replace(/\\/g, "\\\\");
|
|
289
|
+
if (str.includes('"') && !str.includes("'")) {
|
|
290
|
+
return "'" + str.replace(/'/g, "\\'") + "'";
|
|
291
|
+
} else {
|
|
292
|
+
return '"' + str.replace(/"/g, '\\"') + '"';
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
function processCoffeeInterpolation(s, parts, e, $loc) {
|
|
296
|
+
if (parts.length === 0 || parts.length === 1 && parts[0].token != null) {
|
|
297
|
+
return {
|
|
298
|
+
type: "StringLiteral",
|
|
299
|
+
token: parts.length ? `"${modifyString(parts[0].token)}"` : '""',
|
|
300
|
+
$loc
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
parts.forEach((part) => {
|
|
304
|
+
if (part.token) {
|
|
305
|
+
const str = part.token.replace(/(`|\$\{)/g, "\\$1");
|
|
306
|
+
part.token = modifyString(str);
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
s.token = e.token = "`";
|
|
310
|
+
return {
|
|
311
|
+
type: "TemplateLiteral",
|
|
312
|
+
children: [s, parts, e]
|
|
313
|
+
};
|
|
314
|
+
}
|
|
129
315
|
module.exports = {
|
|
130
316
|
clone,
|
|
131
317
|
deepCopy,
|
|
318
|
+
forRange,
|
|
132
319
|
gatherNodes,
|
|
133
320
|
gatherRecursive,
|
|
134
321
|
gatherRecursiveAll,
|
|
135
322
|
gatherRecursiveWithinFunction,
|
|
323
|
+
getTrimmingSpace,
|
|
136
324
|
hasAwait,
|
|
137
325
|
hasYield,
|
|
326
|
+
insertTrimmingSpace,
|
|
138
327
|
isFunction,
|
|
328
|
+
literalValue,
|
|
329
|
+
modifyString,
|
|
330
|
+
processCoffeeInterpolation,
|
|
331
|
+
quoteString,
|
|
139
332
|
removeParentPointers
|
|
140
333
|
};
|
|
141
334
|
}
|
|
@@ -702,6 +895,7 @@ ${input.slice(result.pos)}
|
|
|
702
895
|
BracedContent,
|
|
703
896
|
NestedBlockStatements,
|
|
704
897
|
NestedBlockStatement,
|
|
898
|
+
BlockStatementPart,
|
|
705
899
|
Literal,
|
|
706
900
|
LiteralContent,
|
|
707
901
|
NullLiteral,
|
|
@@ -779,6 +973,7 @@ ${input.slice(result.pos)}
|
|
|
779
973
|
ElseExpressionBlock,
|
|
780
974
|
NestedBlockExpressions,
|
|
781
975
|
NestedBlockExpression,
|
|
976
|
+
BlockExpressionPart,
|
|
782
977
|
IterationStatement,
|
|
783
978
|
IterationExpression,
|
|
784
979
|
LoopStatement,
|
|
@@ -795,6 +990,7 @@ ${input.slice(result.pos)}
|
|
|
795
990
|
CoffeeForIndex,
|
|
796
991
|
CoffeeForDeclaration,
|
|
797
992
|
ForStatementParameters,
|
|
993
|
+
ForRangeParameters,
|
|
798
994
|
ForInOfDeclaration,
|
|
799
995
|
ForDeclaration,
|
|
800
996
|
ForBinding,
|
|
@@ -1106,6 +1302,10 @@ ${input.slice(result.pos)}
|
|
|
1106
1302
|
NestedTypeList,
|
|
1107
1303
|
NestedType,
|
|
1108
1304
|
TypeConditional,
|
|
1305
|
+
TypeTemplateSubstitution,
|
|
1306
|
+
TypeTemplateLiteral,
|
|
1307
|
+
CoffeeStringTypeSubstitution,
|
|
1308
|
+
CoffeeInterpolatedDoubleQuotedTypeLiteral,
|
|
1109
1309
|
TypeLiteral,
|
|
1110
1310
|
InlineInterfaceLiteral,
|
|
1111
1311
|
InlineBasicInterfaceProperty,
|
|
@@ -1522,10 +1722,7 @@ ${input.slice(result.pos)}
|
|
|
1522
1722
|
return result;
|
|
1523
1723
|
}
|
|
1524
1724
|
}
|
|
1525
|
-
var TopLevelSingleLineStatements$0 = $
|
|
1526
|
-
var statements = $0;
|
|
1527
|
-
return statements.map(([, statement]) => statement);
|
|
1528
|
-
});
|
|
1725
|
+
var TopLevelSingleLineStatements$0 = $P(TopLevelStatement);
|
|
1529
1726
|
function TopLevelSingleLineStatements(state) {
|
|
1530
1727
|
let eventData;
|
|
1531
1728
|
if (state.events) {
|
|
@@ -1548,10 +1745,10 @@ ${input.slice(result.pos)}
|
|
|
1548
1745
|
return result;
|
|
1549
1746
|
}
|
|
1550
1747
|
}
|
|
1551
|
-
var TopLevelStatement$0 = $TS($S($E(_), ModuleItem, StatementDelimiter), function($skip, $loc, $0, $1, $2, $3) {
|
|
1552
|
-
var ws = $
|
|
1553
|
-
var statement = $
|
|
1554
|
-
var delimiter = $
|
|
1748
|
+
var TopLevelStatement$0 = $TS($S($N(EOS), $E(_), ModuleItem, StatementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
1749
|
+
var ws = $2;
|
|
1750
|
+
var statement = $3;
|
|
1751
|
+
var delimiter = $4;
|
|
1555
1752
|
if (ws) {
|
|
1556
1753
|
statement = {
|
|
1557
1754
|
...statement,
|
|
@@ -1782,7 +1979,7 @@ ${input.slice(result.pos)}
|
|
|
1782
1979
|
if (args.length === 1 && args[0].type === "IterationExpression" && args[0].subtype !== "DoStatement" && !args[0].async && module.isEmptyBareBlock(args[0].block)) {
|
|
1783
1980
|
return $skip;
|
|
1784
1981
|
}
|
|
1785
|
-
return [ta?.[0], open,
|
|
1982
|
+
return [ta?.[0], open, insertTrimmingSpace(ws, ""), args, close];
|
|
1786
1983
|
});
|
|
1787
1984
|
function ImplicitArguments(state) {
|
|
1788
1985
|
let eventData;
|
|
@@ -1992,7 +2189,7 @@ ${input.slice(result.pos)}
|
|
|
1992
2189
|
}
|
|
1993
2190
|
var ArgumentList$0 = $S(ArgumentPart, $P($S(CommaDelimiter, $C(NestedImplicitObjectLiteral, NestedArgumentList))));
|
|
1994
2191
|
var ArgumentList$1 = $TS($S(NestedImplicitObjectLiteral), function($skip, $loc, $0, $1) {
|
|
1995
|
-
return
|
|
2192
|
+
return insertTrimmingSpace($1, "");
|
|
1996
2193
|
});
|
|
1997
2194
|
var ArgumentList$2 = NestedArgumentList;
|
|
1998
2195
|
var ArgumentList$3 = $TS($S($E(_), ArgumentPart, $Q($S(CommaDelimiter, $E(_), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -2022,7 +2219,7 @@ ${input.slice(result.pos)}
|
|
|
2022
2219
|
}
|
|
2023
2220
|
var NonPipelineArgumentList$0 = $S(NonPipelineArgumentPart, $P($S(CommaDelimiter, $C(NestedImplicitObjectLiteral, NestedArgumentList))));
|
|
2024
2221
|
var NonPipelineArgumentList$1 = $TS($S(NestedImplicitObjectLiteral), function($skip, $loc, $0, $1) {
|
|
2025
|
-
return
|
|
2222
|
+
return insertTrimmingSpace($1, "");
|
|
2026
2223
|
});
|
|
2027
2224
|
var NonPipelineArgumentList$2 = NestedArgumentList;
|
|
2028
2225
|
var NonPipelineArgumentList$3 = $TS($S($E(_), NonPipelineArgumentPart, $Q($S(CommaDelimiter, $E(_), NonPipelineArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -2294,7 +2491,7 @@ ${input.slice(result.pos)}
|
|
|
2294
2491
|
var UnaryExpression$1 = $TS($S(CoffeeDoEnabled, Do, __, $C($S(LeftHandSideExpression, $N($S(__, AssignmentOpSymbol))), ArrowFunction, ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
2295
2492
|
var ws = $3;
|
|
2296
2493
|
var exp = $4;
|
|
2297
|
-
ws =
|
|
2494
|
+
ws = insertTrimmingSpace(ws, "");
|
|
2298
2495
|
return ["(", ...ws, exp, ")()"];
|
|
2299
2496
|
});
|
|
2300
2497
|
function UnaryExpression(state) {
|
|
@@ -4305,7 +4502,7 @@ ${input.slice(result.pos)}
|
|
|
4305
4502
|
if (after.length) {
|
|
4306
4503
|
const spliceRef = module.getRef("splice");
|
|
4307
4504
|
blockPrefix = {
|
|
4308
|
-
children: ["[",
|
|
4505
|
+
children: ["[", insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
|
|
4309
4506
|
names: after.flatMap((p) => p.names)
|
|
4310
4507
|
};
|
|
4311
4508
|
}
|
|
@@ -5813,7 +6010,7 @@ ${input.slice(result.pos)}
|
|
|
5813
6010
|
var w = $2;
|
|
5814
6011
|
var decl = $3;
|
|
5815
6012
|
decl.names.forEach((name) => module.operators.add(name));
|
|
5816
|
-
return [
|
|
6013
|
+
return [insertTrimmingSpace(w, ""), decl];
|
|
5817
6014
|
});
|
|
5818
6015
|
var OperatorDeclaration$1 = $TS($S(OperatorSignature, BracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
5819
6016
|
var signature = $1;
|
|
@@ -5869,7 +6066,7 @@ ${input.slice(result.pos)}
|
|
|
5869
6066
|
if (!func) {
|
|
5870
6067
|
func = { $loc: op.$loc, token: "function" };
|
|
5871
6068
|
} else {
|
|
5872
|
-
func = [
|
|
6069
|
+
func = [insertTrimmingSpace(func[0], ""), func[1]];
|
|
5873
6070
|
}
|
|
5874
6071
|
return {
|
|
5875
6072
|
type: "FunctionSignature",
|
|
@@ -6529,6 +6726,7 @@ ${input.slice(result.pos)}
|
|
|
6529
6726
|
var statements = $2;
|
|
6530
6727
|
if (!statements.length)
|
|
6531
6728
|
return $skip;
|
|
6729
|
+
statements = statements.flat();
|
|
6532
6730
|
const first = statements[0];
|
|
6533
6731
|
const ws = first[0];
|
|
6534
6732
|
const indent = ws.at(-1);
|
|
@@ -6565,15 +6763,13 @@ ${input.slice(result.pos)}
|
|
|
6565
6763
|
return result;
|
|
6566
6764
|
}
|
|
6567
6765
|
}
|
|
6568
|
-
var NestedBlockStatement$0 = $TS($S(Nested, $
|
|
6766
|
+
var NestedBlockStatement$0 = $TS($S(Nested, $P(BlockStatementPart)), function($skip, $loc, $0, $1, $2) {
|
|
6569
6767
|
var nested = $1;
|
|
6570
|
-
var
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
}
|
|
6576
|
-
return [nested, statement, delimiter];
|
|
6768
|
+
var statements = $2;
|
|
6769
|
+
return [
|
|
6770
|
+
[nested, ...statements[0]],
|
|
6771
|
+
...statements.slice(1).map((s) => ["", ...s])
|
|
6772
|
+
];
|
|
6577
6773
|
});
|
|
6578
6774
|
function NestedBlockStatement(state) {
|
|
6579
6775
|
let eventData;
|
|
@@ -6597,6 +6793,37 @@ ${input.slice(result.pos)}
|
|
|
6597
6793
|
return result;
|
|
6598
6794
|
}
|
|
6599
6795
|
}
|
|
6796
|
+
var BlockStatementPart$0 = $TS($S($N(EOS), $E(_), StatementListItem, StatementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6797
|
+
var ws = $2;
|
|
6798
|
+
var statement = $3;
|
|
6799
|
+
var delimiter = $4;
|
|
6800
|
+
if (ws) {
|
|
6801
|
+
statement = { ...statement, children: [ws, ...statement.children] };
|
|
6802
|
+
}
|
|
6803
|
+
return [statement, delimiter];
|
|
6804
|
+
});
|
|
6805
|
+
function BlockStatementPart(state) {
|
|
6806
|
+
let eventData;
|
|
6807
|
+
if (state.events) {
|
|
6808
|
+
const result = state.events.enter?.("BlockStatementPart", state);
|
|
6809
|
+
if (result) {
|
|
6810
|
+
if (result.cache)
|
|
6811
|
+
return result.cache;
|
|
6812
|
+
eventData = result.data;
|
|
6813
|
+
}
|
|
6814
|
+
}
|
|
6815
|
+
if (state.tokenize) {
|
|
6816
|
+
const result = $TOKEN("BlockStatementPart", state, BlockStatementPart$0(state));
|
|
6817
|
+
if (state.events)
|
|
6818
|
+
state.events.exit?.("BlockStatementPart", state, result, eventData);
|
|
6819
|
+
return result;
|
|
6820
|
+
} else {
|
|
6821
|
+
const result = BlockStatementPart$0(state);
|
|
6822
|
+
if (state.events)
|
|
6823
|
+
state.events.exit?.("BlockStatementPart", state, result, eventData);
|
|
6824
|
+
return result;
|
|
6825
|
+
}
|
|
6826
|
+
}
|
|
6600
6827
|
var Literal$0 = $TS($S(LiteralContent), function($skip, $loc, $0, $1) {
|
|
6601
6828
|
return {
|
|
6602
6829
|
type: "Literal",
|
|
@@ -6897,8 +7124,8 @@ ${input.slice(result.pos)}
|
|
|
6897
7124
|
const inclusive = range.token === "..";
|
|
6898
7125
|
range.token = ",";
|
|
6899
7126
|
if (s.type === "Literal" && e.type === "Literal") {
|
|
6900
|
-
const start =
|
|
6901
|
-
const end =
|
|
7127
|
+
const start = literalValue(s);
|
|
7128
|
+
const end = literalValue(e);
|
|
6902
7129
|
if (typeof start !== typeof end) {
|
|
6903
7130
|
throw new Error("Range start and end must be of the same type");
|
|
6904
7131
|
}
|
|
@@ -9201,6 +9428,7 @@ ${input.slice(result.pos)}
|
|
|
9201
9428
|
}
|
|
9202
9429
|
var ExpressionBlock$0 = $TS($S(InsertOpenParen, NestedBlockExpressions, InsertNewline, InsertIndent, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9203
9430
|
var exps = $2;
|
|
9431
|
+
exps = exps.flat();
|
|
9204
9432
|
if (exps.length === 1) {
|
|
9205
9433
|
let [ws, exp] = exps[0];
|
|
9206
9434
|
switch (exp.type) {
|
|
@@ -9246,6 +9474,7 @@ ${input.slice(result.pos)}
|
|
|
9246
9474
|
}
|
|
9247
9475
|
var ElseExpressionBlock$0 = $TS($S(InsertOpenParen, NestedBlockExpressions, InsertNewline, InsertIndent, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
9248
9476
|
var exps = $2;
|
|
9477
|
+
exps = exps.flat();
|
|
9249
9478
|
if (exps.length === 1) {
|
|
9250
9479
|
let [ws, exp] = exps[0];
|
|
9251
9480
|
switch (exp.type) {
|
|
@@ -9319,7 +9548,14 @@ ${input.slice(result.pos)}
|
|
|
9319
9548
|
return result;
|
|
9320
9549
|
}
|
|
9321
9550
|
}
|
|
9322
|
-
var NestedBlockExpression$0 = $S(Nested,
|
|
9551
|
+
var NestedBlockExpression$0 = $TS($S(Nested, $P(BlockExpressionPart)), function($skip, $loc, $0, $1, $2) {
|
|
9552
|
+
var nested = $1;
|
|
9553
|
+
var expressions = $2;
|
|
9554
|
+
return [
|
|
9555
|
+
[nested, ...expressions[0]],
|
|
9556
|
+
...expressions.slice(1).map((s) => ["", ...s])
|
|
9557
|
+
];
|
|
9558
|
+
});
|
|
9323
9559
|
function NestedBlockExpression(state) {
|
|
9324
9560
|
let eventData;
|
|
9325
9561
|
if (state.events) {
|
|
@@ -9342,6 +9578,37 @@ ${input.slice(result.pos)}
|
|
|
9342
9578
|
return result;
|
|
9343
9579
|
}
|
|
9344
9580
|
}
|
|
9581
|
+
var BlockExpressionPart$0 = $TS($S($N(EOS), $E(_), PostfixedExpression, ExpressionDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
9582
|
+
var ws = $2;
|
|
9583
|
+
var exp = $3;
|
|
9584
|
+
var delimiter = $4;
|
|
9585
|
+
if (ws) {
|
|
9586
|
+
exp = { ...exp, children: [ws, ...exp.children] };
|
|
9587
|
+
}
|
|
9588
|
+
return [exp, delimiter];
|
|
9589
|
+
});
|
|
9590
|
+
function BlockExpressionPart(state) {
|
|
9591
|
+
let eventData;
|
|
9592
|
+
if (state.events) {
|
|
9593
|
+
const result = state.events.enter?.("BlockExpressionPart", state);
|
|
9594
|
+
if (result) {
|
|
9595
|
+
if (result.cache)
|
|
9596
|
+
return result.cache;
|
|
9597
|
+
eventData = result.data;
|
|
9598
|
+
}
|
|
9599
|
+
}
|
|
9600
|
+
if (state.tokenize) {
|
|
9601
|
+
const result = $TOKEN("BlockExpressionPart", state, BlockExpressionPart$0(state));
|
|
9602
|
+
if (state.events)
|
|
9603
|
+
state.events.exit?.("BlockExpressionPart", state, result, eventData);
|
|
9604
|
+
return result;
|
|
9605
|
+
} else {
|
|
9606
|
+
const result = BlockExpressionPart$0(state);
|
|
9607
|
+
if (state.events)
|
|
9608
|
+
state.events.exit?.("BlockExpressionPart", state, result, eventData);
|
|
9609
|
+
return result;
|
|
9610
|
+
}
|
|
9611
|
+
}
|
|
9345
9612
|
var IterationStatement$0 = LoopStatement;
|
|
9346
9613
|
var IterationStatement$1 = $T($S($N(CoffeeDoEnabled), DoWhileStatement), function(value) {
|
|
9347
9614
|
return value[1];
|
|
@@ -9490,7 +9757,7 @@ ${input.slice(result.pos)}
|
|
|
9490
9757
|
}
|
|
9491
9758
|
var DoStatement$0 = $TS($S(Do, NoPostfixBracedBlock), function($skip, $loc, $0, $1, $2) {
|
|
9492
9759
|
var block = $2;
|
|
9493
|
-
block =
|
|
9760
|
+
block = insertTrimmingSpace(block, "");
|
|
9494
9761
|
return {
|
|
9495
9762
|
type: "DoStatement",
|
|
9496
9763
|
children: [block],
|
|
@@ -9592,7 +9859,16 @@ ${input.slice(result.pos)}
|
|
|
9592
9859
|
var clause = $1;
|
|
9593
9860
|
var block = $2;
|
|
9594
9861
|
if (clause.blockPrefix) {
|
|
9595
|
-
|
|
9862
|
+
const expressions = [...clause.blockPrefix, ...block.expressions];
|
|
9863
|
+
block = {
|
|
9864
|
+
...block,
|
|
9865
|
+
expressions,
|
|
9866
|
+
children: block.children === block.expressions ? expressions : block.children.map((c) => c === block.expressions ? expressions : c)
|
|
9867
|
+
};
|
|
9868
|
+
if (block.bare) {
|
|
9869
|
+
block.children = [" {\n", ...block.children, "\n}"];
|
|
9870
|
+
block.bare = false;
|
|
9871
|
+
}
|
|
9596
9872
|
}
|
|
9597
9873
|
return {
|
|
9598
9874
|
...clause,
|
|
@@ -9669,7 +9945,7 @@ ${input.slice(result.pos)}
|
|
|
9669
9945
|
[indent, {
|
|
9670
9946
|
type: "IfStatement",
|
|
9671
9947
|
then: block,
|
|
9672
|
-
children: ["if (!(",
|
|
9948
|
+
children: ["if (!(", insertTrimmingSpace($3, ""), ")) ", block]
|
|
9673
9949
|
}]
|
|
9674
9950
|
]
|
|
9675
9951
|
};
|
|
@@ -9724,7 +10000,7 @@ ${input.slice(result.pos)}
|
|
|
9724
10000
|
return result;
|
|
9725
10001
|
}
|
|
9726
10002
|
}
|
|
9727
|
-
var CoffeeForStatementParameters$0 = $TS($S($E($S(Await, __)), InsertOpenParen, CoffeeForDeclaration, $E(CoffeeForIndex), __, $C(In, Of, From), ExpressionWithIndentedApplicationForbidden, $E($S(
|
|
10003
|
+
var CoffeeForStatementParameters$0 = $TS($S($E($S(Await, __)), InsertOpenParen, CoffeeForDeclaration, $E(CoffeeForIndex), __, $C(In, Of, From), ExpressionWithIndentedApplicationForbidden, $E($S($E(_), By, ExpressionWithIndentedApplicationForbidden)), InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
9728
10004
|
var open = $2;
|
|
9729
10005
|
var declaration = $3;
|
|
9730
10006
|
var index = $4;
|
|
@@ -9734,8 +10010,8 @@ ${input.slice(result.pos)}
|
|
|
9734
10010
|
var close = $9;
|
|
9735
10011
|
let blockPrefix = [];
|
|
9736
10012
|
const indent = module.currentIndent.token + " ";
|
|
9737
|
-
exp =
|
|
9738
|
-
declaration =
|
|
10013
|
+
exp = insertTrimmingSpace(exp, "");
|
|
10014
|
+
declaration = insertTrimmingSpace(declaration, "");
|
|
9739
10015
|
if (kind.token === "from") {
|
|
9740
10016
|
if (step) {
|
|
9741
10017
|
throw new Error("Can't use 'by' with 'from' in CoffeeScript for loops");
|
|
@@ -9773,68 +10049,8 @@ ${input.slice(result.pos)}
|
|
|
9773
10049
|
case "Identifier":
|
|
9774
10050
|
expRef = exp;
|
|
9775
10051
|
break;
|
|
9776
|
-
case "RangeExpression":
|
|
9777
|
-
|
|
9778
|
-
let stepExp = step?.[2];
|
|
9779
|
-
let stepRef;
|
|
9780
|
-
if (stepExp) {
|
|
9781
|
-
stepExp = module.insertTrimmingSpace(stepExp, "");
|
|
9782
|
-
if (stepExp.type === "Literal") {
|
|
9783
|
-
stepRef = stepExp;
|
|
9784
|
-
} else {
|
|
9785
|
-
stepRef = {
|
|
9786
|
-
type: "Ref",
|
|
9787
|
-
base: "step",
|
|
9788
|
-
id: "step"
|
|
9789
|
-
};
|
|
9790
|
-
}
|
|
9791
|
-
}
|
|
9792
|
-
let startRef, endRef;
|
|
9793
|
-
if (start.type === "Literal") {
|
|
9794
|
-
startRef = start;
|
|
9795
|
-
} else if (start.type === "Identifier") {
|
|
9796
|
-
startRef = start;
|
|
9797
|
-
} else {
|
|
9798
|
-
startRef = {
|
|
9799
|
-
type: "Ref",
|
|
9800
|
-
base: "ref",
|
|
9801
|
-
id: "ref"
|
|
9802
|
-
};
|
|
9803
|
-
}
|
|
9804
|
-
if (end.type === "Literal") {
|
|
9805
|
-
endRef = end;
|
|
9806
|
-
} else if (end.type === "Identifier") {
|
|
9807
|
-
endRef = end;
|
|
9808
|
-
} else {
|
|
9809
|
-
endRef = {
|
|
9810
|
-
type: "Ref",
|
|
9811
|
-
base: "ref",
|
|
9812
|
-
id: "ref"
|
|
9813
|
-
};
|
|
9814
|
-
}
|
|
9815
|
-
const startRefDec = startRef !== start ? [startRef, " = ", start, ", "] : [];
|
|
9816
|
-
const endRefDec = endRef !== end ? [endRef, " = ", end, ", "] : [];
|
|
9817
|
-
const varRef2 = declaration;
|
|
9818
|
-
const ascDec = stepRef ? stepRef !== stepExp ? [", step = ", stepExp] : [] : [", asc = ", startRef, " <= ", endRef];
|
|
9819
|
-
declaration = {
|
|
9820
|
-
type: "Declaration",
|
|
9821
|
-
children: ["let ", ...startRefDec, ...endRefDec, counterRef, " = ", varRef2, " = ", startRef, ...ascDec],
|
|
9822
|
-
names: varRef2.names
|
|
9823
|
-
};
|
|
9824
|
-
blockPrefix.push(["", {
|
|
9825
|
-
type: "AssignmentExpression",
|
|
9826
|
-
children: [],
|
|
9827
|
-
names: varRef2.names
|
|
9828
|
-
}]);
|
|
9829
|
-
const counterPart = inclusive ? [counterRef, " <= ", endRef, " : ", counterRef, " >= ", endRef] : [counterRef, " < ", endRef, " : ", counterRef, " > ", endRef];
|
|
9830
|
-
const condition2 = stepRef ? [stepRef, " !== 0 && (", stepRef, " > 0 ? ", ...counterPart, ")"] : ["asc ? ", ...counterPart];
|
|
9831
|
-
const increment2 = stepRef ? [varRef2, " = ", counterRef, " += ", stepRef] : [varRef2, " = asc ? ++", counterRef, " : --", counterRef];
|
|
9832
|
-
return {
|
|
9833
|
-
declaration,
|
|
9834
|
-
children: [$1, open, declaration, "; ", ...condition2, "; ", ...increment2, close],
|
|
9835
|
-
blockPrefix
|
|
9836
|
-
};
|
|
9837
|
-
}
|
|
10052
|
+
case "RangeExpression":
|
|
10053
|
+
return forRange(open, declaration, exp, step?.[2], close);
|
|
9838
10054
|
default:
|
|
9839
10055
|
expRef = {
|
|
9840
10056
|
type: "Ref",
|
|
@@ -9845,11 +10061,11 @@ ${input.slice(result.pos)}
|
|
|
9845
10061
|
const varRef = declaration;
|
|
9846
10062
|
let increment = "++", indexAssignment, assignmentNames = [...varRef.names];
|
|
9847
10063
|
if (index) {
|
|
9848
|
-
index =
|
|
10064
|
+
index = insertTrimmingSpace(index, "");
|
|
9849
10065
|
indexAssignment = [index, "="];
|
|
9850
10066
|
assignmentNames.push(...index.names);
|
|
9851
10067
|
}
|
|
9852
|
-
const expRefDec = expRef !== exp ? [expRef, " = ",
|
|
10068
|
+
const expRefDec = expRef !== exp ? [expRef, " = ", insertTrimmingSpace(exp, ""), ", "] : [];
|
|
9853
10069
|
blockPrefix.push([indent, {
|
|
9854
10070
|
type: "AssignmentExpression",
|
|
9855
10071
|
children: [varRef, " = ", expRef, "[", indexAssignment, counterRef, "]\n"],
|
|
@@ -9863,7 +10079,7 @@ ${input.slice(result.pos)}
|
|
|
9863
10079
|
let condition = [counterRef, " < ", lenRef, "; "];
|
|
9864
10080
|
if (step) {
|
|
9865
10081
|
let [stepWs, , stepExp] = step;
|
|
9866
|
-
stepWs =
|
|
10082
|
+
stepWs = insertTrimmingSpace(stepWs, "");
|
|
9867
10083
|
if (stepExp.type === "Literal") {
|
|
9868
10084
|
increment = [" +=", ...stepWs, stepExp];
|
|
9869
10085
|
if (stepExp.raw[0] === "-") {
|
|
@@ -9895,6 +10111,7 @@ ${input.slice(result.pos)}
|
|
|
9895
10111
|
blockPrefix
|
|
9896
10112
|
};
|
|
9897
10113
|
});
|
|
10114
|
+
var CoffeeForStatementParameters$1 = ForRangeParameters;
|
|
9898
10115
|
function CoffeeForStatementParameters(state) {
|
|
9899
10116
|
let eventData;
|
|
9900
10117
|
if (state.events) {
|
|
@@ -9906,12 +10123,12 @@ ${input.slice(result.pos)}
|
|
|
9906
10123
|
}
|
|
9907
10124
|
}
|
|
9908
10125
|
if (state.tokenize) {
|
|
9909
|
-
const result = $TOKEN("CoffeeForStatementParameters", state, CoffeeForStatementParameters$0(state));
|
|
10126
|
+
const result = $TOKEN("CoffeeForStatementParameters", state, CoffeeForStatementParameters$0(state) || CoffeeForStatementParameters$1(state));
|
|
9910
10127
|
if (state.events)
|
|
9911
10128
|
state.events.exit?.("CoffeeForStatementParameters", state, result, eventData);
|
|
9912
10129
|
return result;
|
|
9913
10130
|
} else {
|
|
9914
|
-
const result = CoffeeForStatementParameters$0(state);
|
|
10131
|
+
const result = CoffeeForStatementParameters$0(state) || CoffeeForStatementParameters$1(state);
|
|
9915
10132
|
if (state.events)
|
|
9916
10133
|
state.events.exit?.("CoffeeForStatementParameters", state, result, eventData);
|
|
9917
10134
|
return result;
|
|
@@ -9921,7 +10138,7 @@ ${input.slice(result.pos)}
|
|
|
9921
10138
|
var ws1 = $1;
|
|
9922
10139
|
var ws2 = $3;
|
|
9923
10140
|
var id = $4;
|
|
9924
|
-
ws2 =
|
|
10141
|
+
ws2 = insertTrimmingSpace(ws1, "");
|
|
9925
10142
|
return {
|
|
9926
10143
|
...id,
|
|
9927
10144
|
children: [...ws1 || [], ...ws2 || [], ...id.children]
|
|
@@ -9995,20 +10212,41 @@ ${input.slice(result.pos)}
|
|
|
9995
10212
|
children: $0
|
|
9996
10213
|
};
|
|
9997
10214
|
});
|
|
9998
|
-
var ForStatementParameters$2 = $TS($S($E($S(Await, __)), OpenParen, __, ForInOfDeclaration, __, $C(In, Of), ExpressionWithIndentedApplicationForbidden, __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
10215
|
+
var ForStatementParameters$2 = $TS($S($E($S(Await, __)), OpenParen, __, ForInOfDeclaration, __, $C(In, Of), ExpressionWithIndentedApplicationForbidden, $E($S(__, By, ExpressionWithIndentedApplicationForbidden)), __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9, $10) {
|
|
10216
|
+
var open = $2;
|
|
9999
10217
|
var declaration = $4;
|
|
10218
|
+
var op = $6;
|
|
10219
|
+
var exp = $7;
|
|
10220
|
+
var step = $8;
|
|
10221
|
+
var close = $10;
|
|
10222
|
+
if (exp.type === "RangeExpression" && op.token === "of") {
|
|
10223
|
+
return forRange(open, declaration, exp, step, close);
|
|
10224
|
+
} else if (step) {
|
|
10225
|
+
throw new Error("for..of/in cannot use 'by' except with range literals");
|
|
10226
|
+
}
|
|
10000
10227
|
return {
|
|
10001
10228
|
declaration,
|
|
10002
10229
|
children: $0
|
|
10003
10230
|
};
|
|
10004
10231
|
});
|
|
10005
|
-
var ForStatementParameters$3 = $TS($S($E($S(Await, __)), InsertOpenParen, ForInOfDeclaration, __, $C(In, Of), ExpressionWithIndentedApplicationForbidden, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
10232
|
+
var ForStatementParameters$3 = $TS($S($E($S(Await, __)), InsertOpenParen, ForInOfDeclaration, __, $C(In, Of), ExpressionWithIndentedApplicationForbidden, $E($S(__, By, ExpressionWithIndentedApplicationForbidden)), InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
10233
|
+
var open = $2;
|
|
10006
10234
|
var declaration = $3;
|
|
10235
|
+
var op = $5;
|
|
10236
|
+
var exp = $6;
|
|
10237
|
+
var step = $7;
|
|
10238
|
+
var close = $8;
|
|
10239
|
+
if (exp.type === "RangeExpression" && op.token === "of") {
|
|
10240
|
+
return forRange(open, declaration, exp, step, close);
|
|
10241
|
+
} else if (step) {
|
|
10242
|
+
throw new Error("for..of/in cannot use 'by' except with range literals");
|
|
10243
|
+
}
|
|
10007
10244
|
return {
|
|
10008
10245
|
declaration,
|
|
10009
10246
|
children: $0
|
|
10010
10247
|
};
|
|
10011
10248
|
});
|
|
10249
|
+
var ForStatementParameters$4 = ForRangeParameters;
|
|
10012
10250
|
function ForStatementParameters(state) {
|
|
10013
10251
|
let eventData;
|
|
10014
10252
|
if (state.events) {
|
|
@@ -10020,22 +10258,59 @@ ${input.slice(result.pos)}
|
|
|
10020
10258
|
}
|
|
10021
10259
|
}
|
|
10022
10260
|
if (state.tokenize) {
|
|
10023
|
-
const result = $TOKEN("ForStatementParameters", state, ForStatementParameters$0(state) || ForStatementParameters$1(state) || ForStatementParameters$2(state) || ForStatementParameters$3(state));
|
|
10261
|
+
const result = $TOKEN("ForStatementParameters", state, ForStatementParameters$0(state) || ForStatementParameters$1(state) || ForStatementParameters$2(state) || ForStatementParameters$3(state) || ForStatementParameters$4(state));
|
|
10024
10262
|
if (state.events)
|
|
10025
10263
|
state.events.exit?.("ForStatementParameters", state, result, eventData);
|
|
10026
10264
|
return result;
|
|
10027
10265
|
} else {
|
|
10028
|
-
const result = ForStatementParameters$0(state) || ForStatementParameters$1(state) || ForStatementParameters$2(state) || ForStatementParameters$3(state);
|
|
10266
|
+
const result = ForStatementParameters$0(state) || ForStatementParameters$1(state) || ForStatementParameters$2(state) || ForStatementParameters$3(state) || ForStatementParameters$4(state);
|
|
10029
10267
|
if (state.events)
|
|
10030
10268
|
state.events.exit?.("ForStatementParameters", state, result, eventData);
|
|
10031
10269
|
return result;
|
|
10032
10270
|
}
|
|
10033
10271
|
}
|
|
10272
|
+
var ForRangeParameters$0 = $TS($S($E($S(Await, __)), OpenParen, OpenBracket, RangeExpression, CloseBracket, $E($S(__, By, ExpressionWithIndentedApplicationForbidden)), CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
10273
|
+
var open = $2;
|
|
10274
|
+
var exp = $4;
|
|
10275
|
+
var step = $6;
|
|
10276
|
+
var close = $7;
|
|
10277
|
+
return forRange(open, null, exp, step, close);
|
|
10278
|
+
});
|
|
10279
|
+
var ForRangeParameters$1 = $TS($S($E($S(Await, __)), InsertOpenParen, OpenBracket, RangeExpression, CloseBracket, $E($S(__, By, ExpressionWithIndentedApplicationForbidden)), InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
10280
|
+
var open = $2;
|
|
10281
|
+
var exp = $4;
|
|
10282
|
+
var step = $6;
|
|
10283
|
+
var close = $7;
|
|
10284
|
+
return forRange(open, null, exp, step, close);
|
|
10285
|
+
});
|
|
10286
|
+
function ForRangeParameters(state) {
|
|
10287
|
+
let eventData;
|
|
10288
|
+
if (state.events) {
|
|
10289
|
+
const result = state.events.enter?.("ForRangeParameters", state);
|
|
10290
|
+
if (result) {
|
|
10291
|
+
if (result.cache)
|
|
10292
|
+
return result.cache;
|
|
10293
|
+
eventData = result.data;
|
|
10294
|
+
}
|
|
10295
|
+
}
|
|
10296
|
+
if (state.tokenize) {
|
|
10297
|
+
const result = $TOKEN("ForRangeParameters", state, ForRangeParameters$0(state) || ForRangeParameters$1(state));
|
|
10298
|
+
if (state.events)
|
|
10299
|
+
state.events.exit?.("ForRangeParameters", state, result, eventData);
|
|
10300
|
+
return result;
|
|
10301
|
+
} else {
|
|
10302
|
+
const result = ForRangeParameters$0(state) || ForRangeParameters$1(state);
|
|
10303
|
+
if (state.events)
|
|
10304
|
+
state.events.exit?.("ForRangeParameters", state, result, eventData);
|
|
10305
|
+
return result;
|
|
10306
|
+
}
|
|
10307
|
+
}
|
|
10034
10308
|
var ForInOfDeclaration$0 = $TS($S(Var, ForBinding), function($skip, $loc, $0, $1, $2) {
|
|
10035
10309
|
var binding = $2;
|
|
10036
10310
|
return {
|
|
10037
10311
|
type: "ForDeclaration",
|
|
10038
10312
|
children: $0,
|
|
10313
|
+
declare: $1,
|
|
10039
10314
|
names: binding.names
|
|
10040
10315
|
};
|
|
10041
10316
|
});
|
|
@@ -10063,12 +10338,13 @@ ${input.slice(result.pos)}
|
|
|
10063
10338
|
return result;
|
|
10064
10339
|
}
|
|
10065
10340
|
}
|
|
10066
|
-
var ForDeclaration$0 = $TS($S(LetOrConst,
|
|
10341
|
+
var ForDeclaration$0 = $TS($S(LetOrConst, ForBinding), function($skip, $loc, $0, $1, $2) {
|
|
10067
10342
|
var c = $1;
|
|
10068
|
-
var binding = $
|
|
10343
|
+
var binding = $2;
|
|
10069
10344
|
return {
|
|
10070
10345
|
type: "ForDeclaration",
|
|
10071
10346
|
children: [c, binding],
|
|
10347
|
+
declare: c,
|
|
10072
10348
|
names: binding.names
|
|
10073
10349
|
};
|
|
10074
10350
|
});
|
|
@@ -10078,6 +10354,7 @@ ${input.slice(result.pos)}
|
|
|
10078
10354
|
return {
|
|
10079
10355
|
type: "ForDeclaration",
|
|
10080
10356
|
children: [c, binding],
|
|
10357
|
+
declare: c,
|
|
10081
10358
|
names: binding.names
|
|
10082
10359
|
};
|
|
10083
10360
|
});
|
|
@@ -10404,9 +10681,9 @@ ${input.slice(result.pos)}
|
|
|
10404
10681
|
if (!first)
|
|
10405
10682
|
return $skip;
|
|
10406
10683
|
const result = rest.map(([ws, _comma, exp, col]) => {
|
|
10407
|
-
exp =
|
|
10684
|
+
exp = insertTrimmingSpace(exp, "");
|
|
10408
10685
|
if (ws.length)
|
|
10409
|
-
return [
|
|
10686
|
+
return [insertTrimmingSpace("case ", ws), exp, col];
|
|
10410
10687
|
return ["case ", exp, col];
|
|
10411
10688
|
});
|
|
10412
10689
|
result.unshift(first);
|
|
@@ -10656,7 +10933,7 @@ ${input.slice(result.pos)}
|
|
|
10656
10933
|
var close = $3;
|
|
10657
10934
|
if (expression.type === "ParenthesizedExpression")
|
|
10658
10935
|
return expression;
|
|
10659
|
-
expression =
|
|
10936
|
+
expression = insertTrimmingSpace(expression, "");
|
|
10660
10937
|
return {
|
|
10661
10938
|
type: "ParenthesizedExpression",
|
|
10662
10939
|
children: [open, expression, close],
|
|
@@ -11637,7 +11914,7 @@ ${input.slice(result.pos)}
|
|
|
11637
11914
|
...spec,
|
|
11638
11915
|
children: [
|
|
11639
11916
|
ws,
|
|
11640
|
-
|
|
11917
|
+
insertTrimmingSpace(spec[0], ""),
|
|
11641
11918
|
spec.children.slice(1)
|
|
11642
11919
|
]
|
|
11643
11920
|
};
|
|
@@ -12697,7 +12974,7 @@ ${input.slice(result.pos)}
|
|
|
12697
12974
|
var str = $2;
|
|
12698
12975
|
return {
|
|
12699
12976
|
type: "StringLiteral",
|
|
12700
|
-
token: `"${
|
|
12977
|
+
token: `"${modifyString(str.token)}"`,
|
|
12701
12978
|
$loc
|
|
12702
12979
|
};
|
|
12703
12980
|
});
|
|
@@ -12705,7 +12982,7 @@ ${input.slice(result.pos)}
|
|
|
12705
12982
|
var str = $2;
|
|
12706
12983
|
return {
|
|
12707
12984
|
type: "StringLiteral",
|
|
12708
|
-
token: `'${
|
|
12985
|
+
token: `'${modifyString(str.token)}'`,
|
|
12709
12986
|
$loc
|
|
12710
12987
|
};
|
|
12711
12988
|
});
|
|
@@ -12858,24 +13135,7 @@ ${input.slice(result.pos)}
|
|
|
12858
13135
|
var s = $2;
|
|
12859
13136
|
var parts = $3;
|
|
12860
13137
|
var e = $4;
|
|
12861
|
-
|
|
12862
|
-
return {
|
|
12863
|
-
type: "StringLiteral",
|
|
12864
|
-
token: parts.length ? `"${module.modifyString(parts[0].token)}"` : '""',
|
|
12865
|
-
$loc
|
|
12866
|
-
};
|
|
12867
|
-
}
|
|
12868
|
-
parts.forEach((part) => {
|
|
12869
|
-
if (part.token) {
|
|
12870
|
-
const str = part.token.replace(/(`|\$\{)/g, "\\$1");
|
|
12871
|
-
part.token = module.modifyString(str);
|
|
12872
|
-
}
|
|
12873
|
-
});
|
|
12874
|
-
s.token = e.token = "`";
|
|
12875
|
-
return {
|
|
12876
|
-
type: "TemplateLiteral",
|
|
12877
|
-
children: [s, parts, e]
|
|
12878
|
-
};
|
|
13138
|
+
return processCoffeeInterpolation(s, parts, e, $loc);
|
|
12879
13139
|
});
|
|
12880
13140
|
function CoffeeInterpolatedDoubleQuotedString(state) {
|
|
12881
13141
|
let eventData;
|
|
@@ -13715,7 +13975,7 @@ ${input.slice(result.pos)}
|
|
|
13715
13975
|
}
|
|
13716
13976
|
var Trimmed_$0 = $TV($Q(_), function($skip, $loc, $0, $1) {
|
|
13717
13977
|
var ws = $0;
|
|
13718
|
-
return
|
|
13978
|
+
return insertTrimmingSpace(ws, "");
|
|
13719
13979
|
});
|
|
13720
13980
|
function Trimmed_(state) {
|
|
13721
13981
|
let eventData;
|
|
@@ -16579,7 +16839,7 @@ ${input.slice(result.pos)}
|
|
|
16579
16839
|
if (part.name.type === "ComputedPropertyName") {
|
|
16580
16840
|
rest.push(part);
|
|
16581
16841
|
} else {
|
|
16582
|
-
parts.push([part.name, "={",
|
|
16842
|
+
parts.push([part.name, "={", insertTrimmingSpace(part.value, ""), "}"]);
|
|
16583
16843
|
}
|
|
16584
16844
|
break;
|
|
16585
16845
|
case "SpreadProperty":
|
|
@@ -16680,7 +16940,7 @@ ${input.slice(result.pos)}
|
|
|
16680
16940
|
}
|
|
16681
16941
|
}
|
|
16682
16942
|
var JSXShorthandString$0 = $TR($EXPECT($R52, fail, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
16683
|
-
return
|
|
16943
|
+
return quoteString($0);
|
|
16684
16944
|
});
|
|
16685
16945
|
var JSXShorthandString$1 = $TS($S(TemplateLiteral), function($skip, $loc, $0, $1) {
|
|
16686
16946
|
return ["{", $1, "}"];
|
|
@@ -18780,7 +19040,110 @@ ${input.slice(result.pos)}
|
|
|
18780
19040
|
return result;
|
|
18781
19041
|
}
|
|
18782
19042
|
}
|
|
18783
|
-
var
|
|
19043
|
+
var TypeTemplateSubstitution$0 = $S(SubstitutionStart, Type, __, CloseBrace);
|
|
19044
|
+
function TypeTemplateSubstitution(state) {
|
|
19045
|
+
let eventData;
|
|
19046
|
+
if (state.events) {
|
|
19047
|
+
const result = state.events.enter?.("TypeTemplateSubstitution", state);
|
|
19048
|
+
if (result) {
|
|
19049
|
+
if (result.cache)
|
|
19050
|
+
return result.cache;
|
|
19051
|
+
eventData = result.data;
|
|
19052
|
+
}
|
|
19053
|
+
}
|
|
19054
|
+
if (state.tokenize) {
|
|
19055
|
+
const result = $TOKEN("TypeTemplateSubstitution", state, TypeTemplateSubstitution$0(state));
|
|
19056
|
+
if (state.events)
|
|
19057
|
+
state.events.exit?.("TypeTemplateSubstitution", state, result, eventData);
|
|
19058
|
+
return result;
|
|
19059
|
+
} else {
|
|
19060
|
+
const result = TypeTemplateSubstitution$0(state);
|
|
19061
|
+
if (state.events)
|
|
19062
|
+
state.events.exit?.("TypeTemplateSubstitution", state, result, eventData);
|
|
19063
|
+
return result;
|
|
19064
|
+
}
|
|
19065
|
+
}
|
|
19066
|
+
var TypeTemplateLiteral$0 = $TS($S(Backtick, $Q($C(TemplateCharacters, TypeTemplateSubstitution)), Backtick), function($skip, $loc, $0, $1, $2, $3) {
|
|
19067
|
+
return {
|
|
19068
|
+
type: "TemplateLiteral",
|
|
19069
|
+
children: $0
|
|
19070
|
+
};
|
|
19071
|
+
});
|
|
19072
|
+
var TypeTemplateLiteral$1 = CoffeeInterpolatedDoubleQuotedTypeLiteral;
|
|
19073
|
+
function TypeTemplateLiteral(state) {
|
|
19074
|
+
let eventData;
|
|
19075
|
+
if (state.events) {
|
|
19076
|
+
const result = state.events.enter?.("TypeTemplateLiteral", state);
|
|
19077
|
+
if (result) {
|
|
19078
|
+
if (result.cache)
|
|
19079
|
+
return result.cache;
|
|
19080
|
+
eventData = result.data;
|
|
19081
|
+
}
|
|
19082
|
+
}
|
|
19083
|
+
if (state.tokenize) {
|
|
19084
|
+
const result = $TOKEN("TypeTemplateLiteral", state, TypeTemplateLiteral$0(state) || TypeTemplateLiteral$1(state));
|
|
19085
|
+
if (state.events)
|
|
19086
|
+
state.events.exit?.("TypeTemplateLiteral", state, result, eventData);
|
|
19087
|
+
return result;
|
|
19088
|
+
} else {
|
|
19089
|
+
const result = TypeTemplateLiteral$0(state) || TypeTemplateLiteral$1(state);
|
|
19090
|
+
if (state.events)
|
|
19091
|
+
state.events.exit?.("TypeTemplateLiteral", state, result, eventData);
|
|
19092
|
+
return result;
|
|
19093
|
+
}
|
|
19094
|
+
}
|
|
19095
|
+
var CoffeeStringTypeSubstitution$0 = $S(CoffeeSubstitutionStart, Type, __, CloseBrace);
|
|
19096
|
+
function CoffeeStringTypeSubstitution(state) {
|
|
19097
|
+
let eventData;
|
|
19098
|
+
if (state.events) {
|
|
19099
|
+
const result = state.events.enter?.("CoffeeStringTypeSubstitution", state);
|
|
19100
|
+
if (result) {
|
|
19101
|
+
if (result.cache)
|
|
19102
|
+
return result.cache;
|
|
19103
|
+
eventData = result.data;
|
|
19104
|
+
}
|
|
19105
|
+
}
|
|
19106
|
+
if (state.tokenize) {
|
|
19107
|
+
const result = $TOKEN("CoffeeStringTypeSubstitution", state, CoffeeStringTypeSubstitution$0(state));
|
|
19108
|
+
if (state.events)
|
|
19109
|
+
state.events.exit?.("CoffeeStringTypeSubstitution", state, result, eventData);
|
|
19110
|
+
return result;
|
|
19111
|
+
} else {
|
|
19112
|
+
const result = CoffeeStringTypeSubstitution$0(state);
|
|
19113
|
+
if (state.events)
|
|
19114
|
+
state.events.exit?.("CoffeeStringTypeSubstitution", state, result, eventData);
|
|
19115
|
+
return result;
|
|
19116
|
+
}
|
|
19117
|
+
}
|
|
19118
|
+
var CoffeeInterpolatedDoubleQuotedTypeLiteral$0 = $TS($S(CoffeeInterpolationEnabled, DoubleQuote, $Q($C(CoffeeDoubleQuotedStringCharacters, CoffeeStringTypeSubstitution)), DoubleQuote), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
19119
|
+
var s = $2;
|
|
19120
|
+
var parts = $3;
|
|
19121
|
+
var e = $4;
|
|
19122
|
+
return processCoffeeInterpolation(s, parts, e, $loc);
|
|
19123
|
+
});
|
|
19124
|
+
function CoffeeInterpolatedDoubleQuotedTypeLiteral(state) {
|
|
19125
|
+
let eventData;
|
|
19126
|
+
if (state.events) {
|
|
19127
|
+
const result = state.events.enter?.("CoffeeInterpolatedDoubleQuotedTypeLiteral", state);
|
|
19128
|
+
if (result) {
|
|
19129
|
+
if (result.cache)
|
|
19130
|
+
return result.cache;
|
|
19131
|
+
eventData = result.data;
|
|
19132
|
+
}
|
|
19133
|
+
}
|
|
19134
|
+
if (state.tokenize) {
|
|
19135
|
+
const result = $TOKEN("CoffeeInterpolatedDoubleQuotedTypeLiteral", state, CoffeeInterpolatedDoubleQuotedTypeLiteral$0(state));
|
|
19136
|
+
if (state.events)
|
|
19137
|
+
state.events.exit?.("CoffeeInterpolatedDoubleQuotedTypeLiteral", state, result, eventData);
|
|
19138
|
+
return result;
|
|
19139
|
+
} else {
|
|
19140
|
+
const result = CoffeeInterpolatedDoubleQuotedTypeLiteral$0(state);
|
|
19141
|
+
if (state.events)
|
|
19142
|
+
state.events.exit?.("CoffeeInterpolatedDoubleQuotedTypeLiteral", state, result, eventData);
|
|
19143
|
+
return result;
|
|
19144
|
+
}
|
|
19145
|
+
}
|
|
19146
|
+
var TypeLiteral$0 = TypeTemplateLiteral;
|
|
18784
19147
|
var TypeLiteral$1 = Literal;
|
|
18785
19148
|
var TypeLiteral$2 = $TS($S($EXPECT($L161, fail, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
18786
19149
|
return { type: "VoidType", $loc, token: $1 };
|
|
@@ -20539,20 +20902,6 @@ ${input.slice(result.pos)}
|
|
|
20539
20902
|
}
|
|
20540
20903
|
}
|
|
20541
20904
|
});
|
|
20542
|
-
module.modifyString = function(str) {
|
|
20543
|
-
return str.replace(/(^.?|[^\\]{2})(\\\\)*\n/g, "$1$2\\n");
|
|
20544
|
-
};
|
|
20545
|
-
module.unmodifyString = function(str) {
|
|
20546
|
-
return str.replace(/\\n/g, "\n");
|
|
20547
|
-
};
|
|
20548
|
-
module.quoteString = function(str) {
|
|
20549
|
-
str = str.replace(/\\/g, "\\\\");
|
|
20550
|
-
if (str.includes('"') && !str.includes("'")) {
|
|
20551
|
-
return "'" + str.replace(/'/g, "\\'") + "'";
|
|
20552
|
-
} else {
|
|
20553
|
-
return '"' + str.replace(/"/g, '\\"') + '"';
|
|
20554
|
-
}
|
|
20555
|
-
};
|
|
20556
20905
|
});
|
|
20557
20906
|
function Reset(state) {
|
|
20558
20907
|
let eventData;
|
|
@@ -20598,8 +20947,8 @@ ${input.slice(result.pos)}
|
|
|
20598
20947
|
throw new Error("Glob pattern must have call or member expression value");
|
|
20599
20948
|
}
|
|
20600
20949
|
let value = part.value ?? part.name;
|
|
20601
|
-
const wValue =
|
|
20602
|
-
value = prefix.concat(
|
|
20950
|
+
const wValue = getTrimmingSpace(part.value);
|
|
20951
|
+
value = prefix.concat(insertTrimmingSpace(value, ""));
|
|
20603
20952
|
if (wValue)
|
|
20604
20953
|
value.unshift(wValue);
|
|
20605
20954
|
if (part.type === "SpreadProperty") {
|
|
@@ -20710,43 +21059,6 @@ ${input.slice(result.pos)}
|
|
|
20710
21059
|
};
|
|
20711
21060
|
}
|
|
20712
21061
|
};
|
|
20713
|
-
module.literalValue = function(literal) {
|
|
20714
|
-
let { raw } = literal;
|
|
20715
|
-
switch (raw) {
|
|
20716
|
-
case "null":
|
|
20717
|
-
return null;
|
|
20718
|
-
case "true":
|
|
20719
|
-
return true;
|
|
20720
|
-
case "false":
|
|
20721
|
-
return false;
|
|
20722
|
-
}
|
|
20723
|
-
if (raw.startsWith('"') && raw.endsWith('"') || raw.startsWith("'") && raw.endsWith("'")) {
|
|
20724
|
-
return raw.slice(1, -1);
|
|
20725
|
-
}
|
|
20726
|
-
const numeric = literal.children.find(
|
|
20727
|
-
(child) => child.type === "NumericLiteral"
|
|
20728
|
-
);
|
|
20729
|
-
if (numeric) {
|
|
20730
|
-
raw = raw.replace(/_/g, "");
|
|
20731
|
-
const { token } = numeric;
|
|
20732
|
-
if (token.endsWith("n")) {
|
|
20733
|
-
return BigInt(raw.slice(0, -1));
|
|
20734
|
-
} else if (token.match(/[\.eE]/)) {
|
|
20735
|
-
return parseFloat(raw);
|
|
20736
|
-
} else if (token.startsWith("0")) {
|
|
20737
|
-
switch (token.charAt(1).toLowerCase()) {
|
|
20738
|
-
case "x":
|
|
20739
|
-
return parseInt(raw.replace(/0[xX]/, ""), 16);
|
|
20740
|
-
case "b":
|
|
20741
|
-
return parseInt(raw.replace(/0[bB]/, ""), 2);
|
|
20742
|
-
case "o":
|
|
20743
|
-
return parseInt(raw.replace(/0[oO]/, ""), 8);
|
|
20744
|
-
}
|
|
20745
|
-
}
|
|
20746
|
-
return parseInt(raw, 10);
|
|
20747
|
-
}
|
|
20748
|
-
throw new Error("Unrecognized literal " + JSON.stringify(literal));
|
|
20749
|
-
};
|
|
20750
21062
|
module.expressionizeIfClause = function(clause, b, e) {
|
|
20751
21063
|
const children = clause.children.slice(1);
|
|
20752
21064
|
children.push("?", b);
|
|
@@ -21086,16 +21398,16 @@ ${input.slice(result.pos)}
|
|
|
21086
21398
|
}
|
|
21087
21399
|
let children;
|
|
21088
21400
|
if (op2.call) {
|
|
21089
|
-
wsOp =
|
|
21401
|
+
wsOp = insertTrimmingSpace(wsOp, "");
|
|
21090
21402
|
if (op2.reversed) {
|
|
21091
|
-
wsB =
|
|
21403
|
+
wsB = insertTrimmingSpace(wsB, "");
|
|
21092
21404
|
children = [wsOp, op2.call, "(", wsB, b, ", ", a, ")", op2.suffix];
|
|
21093
21405
|
} else {
|
|
21094
21406
|
children = [wsOp, op2.call, "(", a, ",", wsB, b, ")", op2.suffix];
|
|
21095
21407
|
}
|
|
21096
21408
|
} else if (op2.method) {
|
|
21097
|
-
wsOp =
|
|
21098
|
-
wsB =
|
|
21409
|
+
wsOp = insertTrimmingSpace(wsOp, "");
|
|
21410
|
+
wsB = insertTrimmingSpace(wsB, "");
|
|
21099
21411
|
if (op2.reversed) {
|
|
21100
21412
|
children = [wsB, b, wsOp, ".", op2.method, "(", a, ")"];
|
|
21101
21413
|
} else {
|
|
@@ -21205,39 +21517,6 @@ ${input.slice(result.pos)}
|
|
|
21205
21517
|
}
|
|
21206
21518
|
return target;
|
|
21207
21519
|
};
|
|
21208
|
-
module.insertTrimmingSpace = function(target, c) {
|
|
21209
|
-
if (!target)
|
|
21210
|
-
return target;
|
|
21211
|
-
if (Array.isArray(target))
|
|
21212
|
-
return target.map((e, i) => {
|
|
21213
|
-
if (i === 0)
|
|
21214
|
-
return module.insertTrimmingSpace(e, c);
|
|
21215
|
-
return e;
|
|
21216
|
-
});
|
|
21217
|
-
if (target.children)
|
|
21218
|
-
return Object.assign({}, target, {
|
|
21219
|
-
children: target.children.map((e, i) => {
|
|
21220
|
-
if (i === 0)
|
|
21221
|
-
return module.insertTrimmingSpace(e, c);
|
|
21222
|
-
return e;
|
|
21223
|
-
})
|
|
21224
|
-
});
|
|
21225
|
-
if (target.token)
|
|
21226
|
-
return Object.assign({}, target, {
|
|
21227
|
-
token: target.token.replace(/^ ?/, c)
|
|
21228
|
-
});
|
|
21229
|
-
return target;
|
|
21230
|
-
};
|
|
21231
|
-
module.getTrimmingSpace = function(target) {
|
|
21232
|
-
if (!target)
|
|
21233
|
-
return;
|
|
21234
|
-
if (Array.isArray(target))
|
|
21235
|
-
return module.getTrimmingSpace(target[0]);
|
|
21236
|
-
if (target.children)
|
|
21237
|
-
return module.getTrimmingSpace(target.children[0]);
|
|
21238
|
-
if (target.token)
|
|
21239
|
-
return target.token.match(/^ ?/)[0];
|
|
21240
|
-
};
|
|
21241
21520
|
const initialSpacingRe = /^(?:\r?\n|\n)*((?:\r?\n|\n)\s+)/;
|
|
21242
21521
|
module.dedentBlockSubstitutions = function($02) {
|
|
21243
21522
|
const [s, strWithSubstitutions, e] = $02;
|
|
@@ -21327,7 +21606,7 @@ ${input.slice(result.pos)}
|
|
|
21327
21606
|
const spliceRef = module.getRef("splice");
|
|
21328
21607
|
blockPrefix = {
|
|
21329
21608
|
type: "PostRestBindingElements",
|
|
21330
|
-
children: ["[",
|
|
21609
|
+
children: ["[", insertTrimmingSpace(after, ""), "] = ", spliceRef, ".call(", restIdentifier, ", -", after.length.toString(), ")"],
|
|
21331
21610
|
names: after.flatMap((p) => p.names)
|
|
21332
21611
|
};
|
|
21333
21612
|
}
|
|
@@ -22711,13 +22990,20 @@ ${input.slice(result.pos)}
|
|
|
22711
22990
|
var {
|
|
22712
22991
|
clone,
|
|
22713
22992
|
deepCopy,
|
|
22993
|
+
forRange,
|
|
22714
22994
|
gatherNodes,
|
|
22715
22995
|
gatherRecursive,
|
|
22716
22996
|
gatherRecursiveAll,
|
|
22717
22997
|
gatherRecursiveWithinFunction,
|
|
22998
|
+
getTrimmingSpace,
|
|
22718
22999
|
hasAwait,
|
|
22719
23000
|
hasYield,
|
|
23001
|
+
insertTrimmingSpace,
|
|
22720
23002
|
isFunction,
|
|
23003
|
+
literalValue,
|
|
23004
|
+
modifyString,
|
|
23005
|
+
processCoffeeInterpolation,
|
|
23006
|
+
quoteString,
|
|
22721
23007
|
removeParentPointers
|
|
22722
23008
|
} = require_lib();
|
|
22723
23009
|
}
|