@danielx/civet 0.5.76 → 0.5.77
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 +506 -84
- package/dist/main.js +506 -84
- package/dist/main.mjs +506 -84
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -849,6 +849,7 @@ ${input.slice(result.pos)}
|
|
|
849
849
|
Import,
|
|
850
850
|
In,
|
|
851
851
|
LetOrConst,
|
|
852
|
+
Const,
|
|
852
853
|
LetOrConstOrVar,
|
|
853
854
|
Loop,
|
|
854
855
|
New,
|
|
@@ -942,6 +943,7 @@ ${input.slice(result.pos)}
|
|
|
942
943
|
InterfaceExtendsClause,
|
|
943
944
|
InterfaceExtendsTarget,
|
|
944
945
|
TypeKeyword,
|
|
946
|
+
Enum,
|
|
945
947
|
Interface,
|
|
946
948
|
Global,
|
|
947
949
|
Module,
|
|
@@ -959,6 +961,11 @@ ${input.slice(result.pos)}
|
|
|
959
961
|
NestedDeclareElements,
|
|
960
962
|
NestedDeclareElement,
|
|
961
963
|
DeclareElement,
|
|
964
|
+
EnumDeclaration,
|
|
965
|
+
EnumBlock,
|
|
966
|
+
NestedEnumProperties,
|
|
967
|
+
NestedEnumProperty,
|
|
968
|
+
EnumProperty,
|
|
962
969
|
TypeIndexSignature,
|
|
963
970
|
TypeIndex,
|
|
964
971
|
TypeSuffix,
|
|
@@ -1217,15 +1224,16 @@ ${input.slice(result.pos)}
|
|
|
1217
1224
|
var $L169 = $L("<!--");
|
|
1218
1225
|
var $L170 = $L("-->");
|
|
1219
1226
|
var $L171 = $L("type");
|
|
1220
|
-
var $L172 = $L("
|
|
1221
|
-
var $L173 = $L("
|
|
1222
|
-
var $L174 = $L("
|
|
1223
|
-
var $L175 = $L("
|
|
1224
|
-
var $L176 = $L("
|
|
1225
|
-
var $L177 = $L("
|
|
1226
|
-
var $L178 = $L("
|
|
1227
|
-
var $L179 = $L("
|
|
1228
|
-
var $L180 = $L("
|
|
1227
|
+
var $L172 = $L("enum");
|
|
1228
|
+
var $L173 = $L("interface");
|
|
1229
|
+
var $L174 = $L("global");
|
|
1230
|
+
var $L175 = $L("module");
|
|
1231
|
+
var $L176 = $L("namespace");
|
|
1232
|
+
var $L177 = $L("asserts");
|
|
1233
|
+
var $L178 = $L("keyof");
|
|
1234
|
+
var $L179 = $L("infer");
|
|
1235
|
+
var $L180 = $L("[]");
|
|
1236
|
+
var $L181 = $L("civet");
|
|
1229
1237
|
var $R0 = $R(new RegExp("(as|for|while|until|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
|
|
1230
1238
|
var $R1 = $R(new RegExp("[0-9]", "suy"));
|
|
1231
1239
|
var $R2 = $R(new RegExp("[)}]", "suy"));
|
|
@@ -1279,18 +1287,19 @@ ${input.slice(result.pos)}
|
|
|
1279
1287
|
var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
|
|
1280
1288
|
var $R51 = $R(new RegExp("[\\s>]", "suy"));
|
|
1281
1289
|
var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
|
|
1282
|
-
var $R53 = $R(new RegExp("[
|
|
1283
|
-
var $R54 = $R(new RegExp("[
|
|
1284
|
-
var $R55 = $R(new RegExp("
|
|
1285
|
-
var $R56 = $R(new RegExp("[
|
|
1286
|
-
var $R57 = $R(new RegExp("[
|
|
1287
|
-
var $R58 = $R(new RegExp("[+-]", "suy"));
|
|
1288
|
-
var $R59 = $R(new RegExp("
|
|
1289
|
-
var $R60 = $R(new RegExp("[\\
|
|
1290
|
-
var $R61 = $R(new RegExp("[\\
|
|
1291
|
-
var $R62 = $R(new RegExp("
|
|
1292
|
-
var $R63 = $R(new RegExp("\\
|
|
1293
|
-
var $R64 = $R(new RegExp("
|
|
1290
|
+
var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
|
|
1291
|
+
var $R54 = $R(new RegExp("[<>]", "suy"));
|
|
1292
|
+
var $R55 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
|
|
1293
|
+
var $R56 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
|
|
1294
|
+
var $R57 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
|
|
1295
|
+
var $R58 = $R(new RegExp("[+-]?", "suy"));
|
|
1296
|
+
var $R59 = $R(new RegExp("[+-]", "suy"));
|
|
1297
|
+
var $R60 = $R(new RegExp("#![^\\r\\n]*", "suy"));
|
|
1298
|
+
var $R61 = $R(new RegExp("[\\t ]*", "suy"));
|
|
1299
|
+
var $R62 = $R(new RegExp("[\\s]*", "suy"));
|
|
1300
|
+
var $R63 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
|
|
1301
|
+
var $R64 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
|
|
1302
|
+
var $R65 = $R(new RegExp("[ \\t]*", "suy"));
|
|
1294
1303
|
var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
1295
1304
|
var statements = $4;
|
|
1296
1305
|
module2.processProgram(statements);
|
|
@@ -6284,6 +6293,7 @@ ${input.slice(result.pos)}
|
|
|
6284
6293
|
var Literal$0 = $TS($S(LiteralContent), function($skip, $loc, $0, $1) {
|
|
6285
6294
|
return {
|
|
6286
6295
|
type: "Literal",
|
|
6296
|
+
subtype: $1.type,
|
|
6287
6297
|
children: $0,
|
|
6288
6298
|
raw: $1.token
|
|
6289
6299
|
};
|
|
@@ -8993,12 +9003,15 @@ ${input.slice(result.pos)}
|
|
|
8993
9003
|
return result;
|
|
8994
9004
|
}
|
|
8995
9005
|
}
|
|
8996
|
-
var IterationExpression$0 = $TS($S(IterationStatement), function($skip, $loc, $0, $1) {
|
|
9006
|
+
var IterationExpression$0 = $TS($S($E($S(Async, __)), IterationStatement), function($skip, $loc, $0, $1, $2) {
|
|
9007
|
+
var async = $1;
|
|
9008
|
+
var statement = $2;
|
|
8997
9009
|
return {
|
|
8998
9010
|
type: "IterationExpression",
|
|
8999
|
-
subtype:
|
|
9000
|
-
children: [
|
|
9001
|
-
block:
|
|
9011
|
+
subtype: statement.type,
|
|
9012
|
+
children: [statement],
|
|
9013
|
+
block: statement.block,
|
|
9014
|
+
async
|
|
9002
9015
|
};
|
|
9003
9016
|
});
|
|
9004
9017
|
function IterationExpression(state) {
|
|
@@ -10683,7 +10696,8 @@ ${input.slice(result.pos)}
|
|
|
10683
10696
|
return result;
|
|
10684
10697
|
}
|
|
10685
10698
|
}
|
|
10686
|
-
var ExpressionStatement$0 =
|
|
10699
|
+
var ExpressionStatement$0 = IterationExpression;
|
|
10700
|
+
var ExpressionStatement$1 = Expression;
|
|
10687
10701
|
function ExpressionStatement(state) {
|
|
10688
10702
|
let eventData;
|
|
10689
10703
|
if (state.events) {
|
|
@@ -10695,12 +10709,12 @@ ${input.slice(result.pos)}
|
|
|
10695
10709
|
}
|
|
10696
10710
|
}
|
|
10697
10711
|
if (state.tokenize) {
|
|
10698
|
-
const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state));
|
|
10712
|
+
const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state) || ExpressionStatement$1(state));
|
|
10699
10713
|
if (state.events)
|
|
10700
10714
|
state.events.exit?.("ExpressionStatement", state, result, eventData);
|
|
10701
10715
|
return result;
|
|
10702
10716
|
} else {
|
|
10703
|
-
const result = ExpressionStatement$0(state);
|
|
10717
|
+
const result = ExpressionStatement$0(state) || ExpressionStatement$1(state);
|
|
10704
10718
|
if (state.events)
|
|
10705
10719
|
state.events.exit?.("ExpressionStatement", state, result, eventData);
|
|
10706
10720
|
return result;
|
|
@@ -11561,7 +11575,8 @@ ${input.slice(result.pos)}
|
|
|
11561
11575
|
var Declaration$1 = ClassDeclaration;
|
|
11562
11576
|
var Declaration$2 = LexicalDeclaration;
|
|
11563
11577
|
var Declaration$3 = TypeDeclaration;
|
|
11564
|
-
var Declaration$4 =
|
|
11578
|
+
var Declaration$4 = EnumDeclaration;
|
|
11579
|
+
var Declaration$5 = OperatorDeclaration;
|
|
11565
11580
|
function Declaration(state) {
|
|
11566
11581
|
let eventData;
|
|
11567
11582
|
if (state.events) {
|
|
@@ -11573,12 +11588,12 @@ ${input.slice(result.pos)}
|
|
|
11573
11588
|
}
|
|
11574
11589
|
}
|
|
11575
11590
|
if (state.tokenize) {
|
|
11576
|
-
const result = $TOKEN("Declaration", state, Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state));
|
|
11591
|
+
const result = $TOKEN("Declaration", state, Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state) || Declaration$5(state));
|
|
11577
11592
|
if (state.events)
|
|
11578
11593
|
state.events.exit?.("Declaration", state, result, eventData);
|
|
11579
11594
|
return result;
|
|
11580
11595
|
} else {
|
|
11581
|
-
const result = Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state);
|
|
11596
|
+
const result = Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state) || Declaration$5(state);
|
|
11582
11597
|
if (state.events)
|
|
11583
11598
|
state.events.exit?.("Declaration", state, result, eventData);
|
|
11584
11599
|
return result;
|
|
@@ -14471,6 +14486,31 @@ ${input.slice(result.pos)}
|
|
|
14471
14486
|
return result;
|
|
14472
14487
|
}
|
|
14473
14488
|
}
|
|
14489
|
+
var Const$0 = $TS($S($EXPECT($L129, fail, 'Const "const"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
14490
|
+
return { $loc, token: $1 };
|
|
14491
|
+
});
|
|
14492
|
+
function Const(state) {
|
|
14493
|
+
let eventData;
|
|
14494
|
+
if (state.events) {
|
|
14495
|
+
const result = state.events.enter?.("Const", state);
|
|
14496
|
+
if (result) {
|
|
14497
|
+
if (result.cache)
|
|
14498
|
+
return result.cache;
|
|
14499
|
+
eventData = result.data;
|
|
14500
|
+
}
|
|
14501
|
+
}
|
|
14502
|
+
if (state.tokenize) {
|
|
14503
|
+
const result = $TOKEN("Const", state, Const$0(state));
|
|
14504
|
+
if (state.events)
|
|
14505
|
+
state.events.exit?.("Const", state, result, eventData);
|
|
14506
|
+
return result;
|
|
14507
|
+
} else {
|
|
14508
|
+
const result = Const$0(state);
|
|
14509
|
+
if (state.events)
|
|
14510
|
+
state.events.exit?.("Const", state, result, eventData);
|
|
14511
|
+
return result;
|
|
14512
|
+
}
|
|
14513
|
+
}
|
|
14474
14514
|
var LetOrConstOrVar$0 = LetOrConst;
|
|
14475
14515
|
var LetOrConstOrVar$1 = Var;
|
|
14476
14516
|
function LetOrConstOrVar(state) {
|
|
@@ -16242,11 +16282,11 @@ ${input.slice(result.pos)}
|
|
|
16242
16282
|
var JSXAttributeValue$2 = JSXFragment;
|
|
16243
16283
|
var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
|
|
16244
16284
|
if ($2.children?.length === 1 && $2.children[0].type === "StringLiteral") {
|
|
16245
|
-
return $
|
|
16285
|
+
return $skip;
|
|
16246
16286
|
}
|
|
16247
16287
|
return $0;
|
|
16248
16288
|
});
|
|
16249
|
-
var JSXAttributeValue$4 =
|
|
16289
|
+
var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
|
|
16250
16290
|
function JSXAttributeValue(state) {
|
|
16251
16291
|
let eventData;
|
|
16252
16292
|
if (state.events) {
|
|
@@ -16296,7 +16336,7 @@ ${input.slice(result.pos)}
|
|
|
16296
16336
|
return result;
|
|
16297
16337
|
}
|
|
16298
16338
|
}
|
|
16299
|
-
var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($
|
|
16339
|
+
var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R54, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
|
|
16300
16340
|
var op = $2;
|
|
16301
16341
|
var rhs = $3;
|
|
16302
16342
|
return [[], op, [], rhs];
|
|
@@ -16351,7 +16391,7 @@ ${input.slice(result.pos)}
|
|
|
16351
16391
|
return result;
|
|
16352
16392
|
}
|
|
16353
16393
|
}
|
|
16354
|
-
var InlineJSXUnaryOp$0 = $TR($EXPECT($
|
|
16394
|
+
var InlineJSXUnaryOp$0 = $TR($EXPECT($R55, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
16355
16395
|
return { $loc, token: $0 };
|
|
16356
16396
|
});
|
|
16357
16397
|
function InlineJSXUnaryOp(state) {
|
|
@@ -16796,7 +16836,7 @@ ${input.slice(result.pos)}
|
|
|
16796
16836
|
return result;
|
|
16797
16837
|
}
|
|
16798
16838
|
}
|
|
16799
|
-
var JSXCommentContent$0 = $TR($EXPECT($
|
|
16839
|
+
var JSXCommentContent$0 = $TR($EXPECT($R56, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
16800
16840
|
return { $loc, token: $0.replace(/\*\//g, "* /") };
|
|
16801
16841
|
});
|
|
16802
16842
|
function JSXCommentContent(state) {
|
|
@@ -16821,7 +16861,7 @@ ${input.slice(result.pos)}
|
|
|
16821
16861
|
return result;
|
|
16822
16862
|
}
|
|
16823
16863
|
}
|
|
16824
|
-
var JSXText$0 = $TR($EXPECT($
|
|
16864
|
+
var JSXText$0 = $TR($EXPECT($R57, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
16825
16865
|
return {
|
|
16826
16866
|
type: "JSXText",
|
|
16827
16867
|
token: $0,
|
|
@@ -17098,7 +17138,32 @@ ${input.slice(result.pos)}
|
|
|
17098
17138
|
return result;
|
|
17099
17139
|
}
|
|
17100
17140
|
}
|
|
17101
|
-
var
|
|
17141
|
+
var Enum$0 = $TS($S($EXPECT($L172, fail, 'Enum "enum"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
17142
|
+
return { $loc, token: $1 };
|
|
17143
|
+
});
|
|
17144
|
+
function Enum(state) {
|
|
17145
|
+
let eventData;
|
|
17146
|
+
if (state.events) {
|
|
17147
|
+
const result = state.events.enter?.("Enum", state);
|
|
17148
|
+
if (result) {
|
|
17149
|
+
if (result.cache)
|
|
17150
|
+
return result.cache;
|
|
17151
|
+
eventData = result.data;
|
|
17152
|
+
}
|
|
17153
|
+
}
|
|
17154
|
+
if (state.tokenize) {
|
|
17155
|
+
const result = $TOKEN("Enum", state, Enum$0(state));
|
|
17156
|
+
if (state.events)
|
|
17157
|
+
state.events.exit?.("Enum", state, result, eventData);
|
|
17158
|
+
return result;
|
|
17159
|
+
} else {
|
|
17160
|
+
const result = Enum$0(state);
|
|
17161
|
+
if (state.events)
|
|
17162
|
+
state.events.exit?.("Enum", state, result, eventData);
|
|
17163
|
+
return result;
|
|
17164
|
+
}
|
|
17165
|
+
}
|
|
17166
|
+
var Interface$0 = $TS($S($EXPECT($L173, fail, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
17102
17167
|
return { $loc, token: $1 };
|
|
17103
17168
|
});
|
|
17104
17169
|
function Interface(state) {
|
|
@@ -17123,7 +17188,7 @@ ${input.slice(result.pos)}
|
|
|
17123
17188
|
return result;
|
|
17124
17189
|
}
|
|
17125
17190
|
}
|
|
17126
|
-
var Global$0 = $TS($S($EXPECT($
|
|
17191
|
+
var Global$0 = $TS($S($EXPECT($L174, fail, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
17127
17192
|
return { $loc, token: $1 };
|
|
17128
17193
|
});
|
|
17129
17194
|
function Global(state) {
|
|
@@ -17148,7 +17213,7 @@ ${input.slice(result.pos)}
|
|
|
17148
17213
|
return result;
|
|
17149
17214
|
}
|
|
17150
17215
|
}
|
|
17151
|
-
var Module$0 = $TS($S($EXPECT($
|
|
17216
|
+
var Module$0 = $TS($S($EXPECT($L175, fail, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
17152
17217
|
return { $loc, token: $1 };
|
|
17153
17218
|
});
|
|
17154
17219
|
function Module(state) {
|
|
@@ -17173,7 +17238,7 @@ ${input.slice(result.pos)}
|
|
|
17173
17238
|
return result;
|
|
17174
17239
|
}
|
|
17175
17240
|
}
|
|
17176
|
-
var Namespace$0 = $TS($S($EXPECT($
|
|
17241
|
+
var Namespace$0 = $TS($S($EXPECT($L176, fail, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
17177
17242
|
return { $loc, token: $1 };
|
|
17178
17243
|
});
|
|
17179
17244
|
function Namespace(state) {
|
|
@@ -17322,7 +17387,7 @@ ${input.slice(result.pos)}
|
|
|
17322
17387
|
return result;
|
|
17323
17388
|
}
|
|
17324
17389
|
}
|
|
17325
|
-
var InterfacePropertyDelimiter$0 = $S($
|
|
17390
|
+
var InterfacePropertyDelimiter$0 = $S($E(_), $C(Semicolon, Comma));
|
|
17326
17391
|
var InterfacePropertyDelimiter$1 = $Y($S(__, CloseBrace));
|
|
17327
17392
|
var InterfacePropertyDelimiter$2 = $Y(EOS);
|
|
17328
17393
|
function InterfacePropertyDelimiter(state) {
|
|
@@ -17526,7 +17591,221 @@ ${input.slice(result.pos)}
|
|
|
17526
17591
|
return result;
|
|
17527
17592
|
}
|
|
17528
17593
|
}
|
|
17529
|
-
var
|
|
17594
|
+
var EnumDeclaration$0 = $TS($S($E($S(Const, _)), Enum, $Q(TrailingComment), IdentifierName, EnumBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
17595
|
+
var isConst = $1;
|
|
17596
|
+
var id = $4;
|
|
17597
|
+
var block = $5;
|
|
17598
|
+
const ts = {
|
|
17599
|
+
ts: true,
|
|
17600
|
+
children: $0
|
|
17601
|
+
};
|
|
17602
|
+
if (isConst)
|
|
17603
|
+
return ts;
|
|
17604
|
+
const names = new Set(block.properties.map((p) => p.name.name));
|
|
17605
|
+
return [
|
|
17606
|
+
ts,
|
|
17607
|
+
{
|
|
17608
|
+
js: true,
|
|
17609
|
+
children: [
|
|
17610
|
+
["let ", id, " = {};\n"],
|
|
17611
|
+
...block.properties.map((property, i) => {
|
|
17612
|
+
let init, isString;
|
|
17613
|
+
if (property.init) {
|
|
17614
|
+
init = module2.replaceNodes(
|
|
17615
|
+
structuredClone(property.init),
|
|
17616
|
+
(n) => n.type === "Identifier" && names.has(n.name),
|
|
17617
|
+
(n) => [id, '["', n.name, '"]']
|
|
17618
|
+
);
|
|
17619
|
+
const value = init[init.length - 1];
|
|
17620
|
+
isString = value.type === "TemplateLiteral" || value.type === "Literal" && value.subtype === "StringLiteral";
|
|
17621
|
+
} else {
|
|
17622
|
+
init = i === 0 ? " = 0" : [" = ", id, '["', block.properties[i - 1].name, '"] + 1'];
|
|
17623
|
+
}
|
|
17624
|
+
if (isString) {
|
|
17625
|
+
return [
|
|
17626
|
+
id,
|
|
17627
|
+
'["',
|
|
17628
|
+
property.name,
|
|
17629
|
+
'"]',
|
|
17630
|
+
init,
|
|
17631
|
+
";\n"
|
|
17632
|
+
];
|
|
17633
|
+
} else {
|
|
17634
|
+
return [
|
|
17635
|
+
id,
|
|
17636
|
+
"[",
|
|
17637
|
+
id,
|
|
17638
|
+
'["',
|
|
17639
|
+
property.name,
|
|
17640
|
+
'"]',
|
|
17641
|
+
init,
|
|
17642
|
+
'] = "',
|
|
17643
|
+
property.name,
|
|
17644
|
+
'";\n'
|
|
17645
|
+
];
|
|
17646
|
+
}
|
|
17647
|
+
})
|
|
17648
|
+
]
|
|
17649
|
+
}
|
|
17650
|
+
];
|
|
17651
|
+
});
|
|
17652
|
+
function EnumDeclaration(state) {
|
|
17653
|
+
let eventData;
|
|
17654
|
+
if (state.events) {
|
|
17655
|
+
const result = state.events.enter?.("EnumDeclaration", state);
|
|
17656
|
+
if (result) {
|
|
17657
|
+
if (result.cache)
|
|
17658
|
+
return result.cache;
|
|
17659
|
+
eventData = result.data;
|
|
17660
|
+
}
|
|
17661
|
+
}
|
|
17662
|
+
if (state.tokenize) {
|
|
17663
|
+
const result = $TOKEN("EnumDeclaration", state, EnumDeclaration$0(state));
|
|
17664
|
+
if (state.events)
|
|
17665
|
+
state.events.exit?.("EnumDeclaration", state, result, eventData);
|
|
17666
|
+
return result;
|
|
17667
|
+
} else {
|
|
17668
|
+
const result = EnumDeclaration$0(state);
|
|
17669
|
+
if (state.events)
|
|
17670
|
+
state.events.exit?.("EnumDeclaration", state, result, eventData);
|
|
17671
|
+
return result;
|
|
17672
|
+
}
|
|
17673
|
+
}
|
|
17674
|
+
var EnumBlock$0 = $TS($S(__, OpenBrace, NestedEnumProperties, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
17675
|
+
var props2 = $3;
|
|
17676
|
+
return {
|
|
17677
|
+
properties: props2.properties,
|
|
17678
|
+
children: $0
|
|
17679
|
+
};
|
|
17680
|
+
});
|
|
17681
|
+
var EnumBlock$1 = $TS($S(__, OpenBrace, $Q($S(__, EnumProperty)), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
17682
|
+
var props2 = $3;
|
|
17683
|
+
return {
|
|
17684
|
+
properties: props2.map((p) => p[1]),
|
|
17685
|
+
children: $0
|
|
17686
|
+
};
|
|
17687
|
+
});
|
|
17688
|
+
var EnumBlock$2 = $TS($S(InsertOpenBrace, NestedEnumProperties, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
17689
|
+
var props2 = $2;
|
|
17690
|
+
return {
|
|
17691
|
+
properties: props2.properties,
|
|
17692
|
+
children: $0
|
|
17693
|
+
};
|
|
17694
|
+
});
|
|
17695
|
+
function EnumBlock(state) {
|
|
17696
|
+
let eventData;
|
|
17697
|
+
if (state.events) {
|
|
17698
|
+
const result = state.events.enter?.("EnumBlock", state);
|
|
17699
|
+
if (result) {
|
|
17700
|
+
if (result.cache)
|
|
17701
|
+
return result.cache;
|
|
17702
|
+
eventData = result.data;
|
|
17703
|
+
}
|
|
17704
|
+
}
|
|
17705
|
+
if (state.tokenize) {
|
|
17706
|
+
const result = $TOKEN("EnumBlock", state, EnumBlock$0(state) || EnumBlock$1(state) || EnumBlock$2(state));
|
|
17707
|
+
if (state.events)
|
|
17708
|
+
state.events.exit?.("EnumBlock", state, result, eventData);
|
|
17709
|
+
return result;
|
|
17710
|
+
} else {
|
|
17711
|
+
const result = EnumBlock$0(state) || EnumBlock$1(state) || EnumBlock$2(state);
|
|
17712
|
+
if (state.events)
|
|
17713
|
+
state.events.exit?.("EnumBlock", state, result, eventData);
|
|
17714
|
+
return result;
|
|
17715
|
+
}
|
|
17716
|
+
}
|
|
17717
|
+
var NestedEnumProperties$0 = $TS($S(PushIndent, $Q(NestedEnumProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
17718
|
+
var props2 = $2;
|
|
17719
|
+
if (!props2.length)
|
|
17720
|
+
return $skip;
|
|
17721
|
+
return {
|
|
17722
|
+
properties: props2.map((p) => p.property),
|
|
17723
|
+
children: $0
|
|
17724
|
+
};
|
|
17725
|
+
});
|
|
17726
|
+
function NestedEnumProperties(state) {
|
|
17727
|
+
let eventData;
|
|
17728
|
+
if (state.events) {
|
|
17729
|
+
const result = state.events.enter?.("NestedEnumProperties", state);
|
|
17730
|
+
if (result) {
|
|
17731
|
+
if (result.cache)
|
|
17732
|
+
return result.cache;
|
|
17733
|
+
eventData = result.data;
|
|
17734
|
+
}
|
|
17735
|
+
}
|
|
17736
|
+
if (state.tokenize) {
|
|
17737
|
+
const result = $TOKEN("NestedEnumProperties", state, NestedEnumProperties$0(state));
|
|
17738
|
+
if (state.events)
|
|
17739
|
+
state.events.exit?.("NestedEnumProperties", state, result, eventData);
|
|
17740
|
+
return result;
|
|
17741
|
+
} else {
|
|
17742
|
+
const result = NestedEnumProperties$0(state);
|
|
17743
|
+
if (state.events)
|
|
17744
|
+
state.events.exit?.("NestedEnumProperties", state, result, eventData);
|
|
17745
|
+
return result;
|
|
17746
|
+
}
|
|
17747
|
+
}
|
|
17748
|
+
var NestedEnumProperty$0 = $TS($S(Nested, EnumProperty), function($skip, $loc, $0, $1, $2) {
|
|
17749
|
+
return {
|
|
17750
|
+
property: $2,
|
|
17751
|
+
children: $0
|
|
17752
|
+
};
|
|
17753
|
+
});
|
|
17754
|
+
function NestedEnumProperty(state) {
|
|
17755
|
+
let eventData;
|
|
17756
|
+
if (state.events) {
|
|
17757
|
+
const result = state.events.enter?.("NestedEnumProperty", state);
|
|
17758
|
+
if (result) {
|
|
17759
|
+
if (result.cache)
|
|
17760
|
+
return result.cache;
|
|
17761
|
+
eventData = result.data;
|
|
17762
|
+
}
|
|
17763
|
+
}
|
|
17764
|
+
if (state.tokenize) {
|
|
17765
|
+
const result = $TOKEN("NestedEnumProperty", state, NestedEnumProperty$0(state));
|
|
17766
|
+
if (state.events)
|
|
17767
|
+
state.events.exit?.("NestedEnumProperty", state, result, eventData);
|
|
17768
|
+
return result;
|
|
17769
|
+
} else {
|
|
17770
|
+
const result = NestedEnumProperty$0(state);
|
|
17771
|
+
if (state.events)
|
|
17772
|
+
state.events.exit?.("NestedEnumProperty", state, result, eventData);
|
|
17773
|
+
return result;
|
|
17774
|
+
}
|
|
17775
|
+
}
|
|
17776
|
+
var EnumProperty$0 = $TS($S(Identifier, $E($S(__, Equals, ExtendedExpression)), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3) {
|
|
17777
|
+
var name = $1;
|
|
17778
|
+
var init = $2;
|
|
17779
|
+
return {
|
|
17780
|
+
type: "EnumProperty",
|
|
17781
|
+
name,
|
|
17782
|
+
init,
|
|
17783
|
+
children: $0
|
|
17784
|
+
};
|
|
17785
|
+
});
|
|
17786
|
+
function EnumProperty(state) {
|
|
17787
|
+
let eventData;
|
|
17788
|
+
if (state.events) {
|
|
17789
|
+
const result = state.events.enter?.("EnumProperty", state);
|
|
17790
|
+
if (result) {
|
|
17791
|
+
if (result.cache)
|
|
17792
|
+
return result.cache;
|
|
17793
|
+
eventData = result.data;
|
|
17794
|
+
}
|
|
17795
|
+
}
|
|
17796
|
+
if (state.tokenize) {
|
|
17797
|
+
const result = $TOKEN("EnumProperty", state, EnumProperty$0(state));
|
|
17798
|
+
if (state.events)
|
|
17799
|
+
state.events.exit?.("EnumProperty", state, result, eventData);
|
|
17800
|
+
return result;
|
|
17801
|
+
} else {
|
|
17802
|
+
const result = EnumProperty$0(state);
|
|
17803
|
+
if (state.events)
|
|
17804
|
+
state.events.exit?.("EnumProperty", state, result, eventData);
|
|
17805
|
+
return result;
|
|
17806
|
+
}
|
|
17807
|
+
}
|
|
17808
|
+
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R58, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L141, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R59, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
|
|
17530
17809
|
function TypeIndexSignature(state) {
|
|
17531
17810
|
let eventData;
|
|
17532
17811
|
if (state.events) {
|
|
@@ -17604,7 +17883,7 @@ ${input.slice(result.pos)}
|
|
|
17604
17883
|
return result;
|
|
17605
17884
|
}
|
|
17606
17885
|
}
|
|
17607
|
-
var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($
|
|
17886
|
+
var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($L177, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
17608
17887
|
var asserts = $3;
|
|
17609
17888
|
var t = $4;
|
|
17610
17889
|
if (asserts) {
|
|
@@ -17778,9 +18057,9 @@ ${input.slice(result.pos)}
|
|
|
17778
18057
|
return result;
|
|
17779
18058
|
}
|
|
17780
18059
|
}
|
|
17781
|
-
var TypeUnaryOp$0 = $S($EXPECT($
|
|
18060
|
+
var TypeUnaryOp$0 = $S($EXPECT($L178, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
|
|
17782
18061
|
var TypeUnaryOp$1 = $S($EXPECT($L157, fail, 'TypeUnaryOp "typeof"'), NonIdContinue);
|
|
17783
|
-
var TypeUnaryOp$2 = $S($EXPECT($
|
|
18062
|
+
var TypeUnaryOp$2 = $S($EXPECT($L179, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
|
|
17784
18063
|
var TypeUnaryOp$3 = $S($EXPECT($L141, fail, 'TypeUnaryOp "readonly"'), NonIdContinue);
|
|
17785
18064
|
function TypeUnaryOp(state) {
|
|
17786
18065
|
let eventData;
|
|
@@ -18026,7 +18305,7 @@ ${input.slice(result.pos)}
|
|
|
18026
18305
|
var TypeLiteral$2 = $TS($S($EXPECT($L161, fail, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
|
|
18027
18306
|
return { type: "VoidType", $loc, token: $1 };
|
|
18028
18307
|
});
|
|
18029
|
-
var TypeLiteral$3 = $TV($EXPECT($
|
|
18308
|
+
var TypeLiteral$3 = $TV($EXPECT($L180, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
|
|
18030
18309
|
return { $loc, token: "[]" };
|
|
18031
18310
|
});
|
|
18032
18311
|
function TypeLiteral(state) {
|
|
@@ -18433,7 +18712,7 @@ ${input.slice(result.pos)}
|
|
|
18433
18712
|
return result;
|
|
18434
18713
|
}
|
|
18435
18714
|
}
|
|
18436
|
-
var Shebang$0 = $S($R$0($EXPECT($
|
|
18715
|
+
var Shebang$0 = $S($R$0($EXPECT($R60, fail, "Shebang /#![^\\r\\n]*/")), EOL);
|
|
18437
18716
|
function Shebang(state) {
|
|
18438
18717
|
let eventData;
|
|
18439
18718
|
if (state.events) {
|
|
@@ -18456,11 +18735,11 @@ ${input.slice(result.pos)}
|
|
|
18456
18735
|
return result;
|
|
18457
18736
|
}
|
|
18458
18737
|
}
|
|
18459
|
-
var CivetPrologue$0 = $T($S($EXPECT($
|
|
18738
|
+
var CivetPrologue$0 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
|
|
18460
18739
|
var content = value[2];
|
|
18461
18740
|
return content;
|
|
18462
18741
|
});
|
|
18463
|
-
var CivetPrologue$1 = $T($S($EXPECT($
|
|
18742
|
+
var CivetPrologue$1 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
|
|
18464
18743
|
var content = value[2];
|
|
18465
18744
|
return content;
|
|
18466
18745
|
});
|
|
@@ -18486,7 +18765,7 @@ ${input.slice(result.pos)}
|
|
|
18486
18765
|
return result;
|
|
18487
18766
|
}
|
|
18488
18767
|
}
|
|
18489
|
-
var CivetPrologueContent$0 = $TS($S($EXPECT($
|
|
18768
|
+
var CivetPrologueContent$0 = $TS($S($EXPECT($L181, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R62, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
18490
18769
|
var options = $3;
|
|
18491
18770
|
return {
|
|
18492
18771
|
type: "CivetPrologue",
|
|
@@ -18516,7 +18795,7 @@ ${input.slice(result.pos)}
|
|
|
18516
18795
|
return result;
|
|
18517
18796
|
}
|
|
18518
18797
|
}
|
|
18519
|
-
var CivetOption$0 = $TR($EXPECT($
|
|
18798
|
+
var CivetOption$0 = $TR($EXPECT($R63, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
18520
18799
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
18521
18800
|
if (l)
|
|
18522
18801
|
return l.toUpperCase();
|
|
@@ -18552,7 +18831,7 @@ ${input.slice(result.pos)}
|
|
|
18552
18831
|
return result;
|
|
18553
18832
|
}
|
|
18554
18833
|
}
|
|
18555
|
-
var UnknownPrologue$0 = $S($R$0($EXPECT($
|
|
18834
|
+
var UnknownPrologue$0 = $S($R$0($EXPECT($R61, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
|
|
18556
18835
|
function UnknownPrologue(state) {
|
|
18557
18836
|
let eventData;
|
|
18558
18837
|
if (state.events) {
|
|
@@ -18622,7 +18901,7 @@ ${input.slice(result.pos)}
|
|
|
18622
18901
|
return result;
|
|
18623
18902
|
}
|
|
18624
18903
|
}
|
|
18625
|
-
var EOL$0 = $TR($EXPECT($
|
|
18904
|
+
var EOL$0 = $TR($EXPECT($R64, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
18626
18905
|
return { $loc, token: $0 };
|
|
18627
18906
|
});
|
|
18628
18907
|
function EOL(state) {
|
|
@@ -19776,6 +20055,9 @@ ${input.slice(result.pos)}
|
|
|
19776
20055
|
module2.modifyString = function(str) {
|
|
19777
20056
|
return str.replace(/(^.?|[^\\]{2})(\\\\)*\n/g, "$1$2\\n");
|
|
19778
20057
|
};
|
|
20058
|
+
module2.unmodifyString = function(str) {
|
|
20059
|
+
return str.replace(/\\n/g, "\n");
|
|
20060
|
+
};
|
|
19779
20061
|
module2.quoteString = function(str) {
|
|
19780
20062
|
str = str.replace(/\\/g, "\\\\");
|
|
19781
20063
|
if (str.includes('"') && !str.includes("'")) {
|
|
@@ -19927,6 +20209,20 @@ ${input.slice(result.pos)}
|
|
|
19927
20209
|
return { children };
|
|
19928
20210
|
}
|
|
19929
20211
|
};
|
|
20212
|
+
module2.needsRef = function(expression, base = "ref") {
|
|
20213
|
+
switch (expression.type) {
|
|
20214
|
+
case "Ref":
|
|
20215
|
+
case "Identifier":
|
|
20216
|
+
case "Literal":
|
|
20217
|
+
return;
|
|
20218
|
+
default:
|
|
20219
|
+
return {
|
|
20220
|
+
type: "Ref",
|
|
20221
|
+
base,
|
|
20222
|
+
id: base
|
|
20223
|
+
};
|
|
20224
|
+
}
|
|
20225
|
+
};
|
|
19930
20226
|
module2.literalValue = function(literal) {
|
|
19931
20227
|
let { raw } = literal;
|
|
19932
20228
|
switch (raw) {
|
|
@@ -20006,7 +20302,7 @@ ${input.slice(result.pos)}
|
|
|
20006
20302
|
const i = exp.children.indexOf(exp.block);
|
|
20007
20303
|
if (exp.subtype === "DoStatement") {
|
|
20008
20304
|
insertReturn(exp.block);
|
|
20009
|
-
exp.children.splice(i, 1, ...module2.wrapIIFE(exp.children));
|
|
20305
|
+
exp.children.splice(i, 1, ...module2.wrapIIFE(exp.children, exp.async));
|
|
20010
20306
|
return;
|
|
20011
20307
|
}
|
|
20012
20308
|
const resultsRef = {
|
|
@@ -20015,16 +20311,28 @@ ${input.slice(result.pos)}
|
|
|
20015
20311
|
id: "results"
|
|
20016
20312
|
};
|
|
20017
20313
|
insertPush(exp.block, resultsRef);
|
|
20018
|
-
exp.children.splice(
|
|
20019
|
-
|
|
20020
|
-
|
|
20314
|
+
exp.children.splice(
|
|
20315
|
+
i,
|
|
20316
|
+
1,
|
|
20317
|
+
module2.wrapIIFE([
|
|
20318
|
+
"const ",
|
|
20319
|
+
resultsRef,
|
|
20320
|
+
"=[];",
|
|
20321
|
+
...exp.children,
|
|
20322
|
+
"; return ",
|
|
20323
|
+
resultsRef
|
|
20324
|
+
], exp.async)
|
|
20325
|
+
);
|
|
20021
20326
|
}
|
|
20022
20327
|
module2.hasAwait = (exp) => {
|
|
20023
20328
|
return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
|
|
20024
20329
|
};
|
|
20025
|
-
module2.wrapIIFE = (exp) => {
|
|
20330
|
+
module2.wrapIIFE = (exp, async) => {
|
|
20026
20331
|
let prefix, suffix;
|
|
20027
|
-
if (
|
|
20332
|
+
if (async) {
|
|
20333
|
+
prefix = "(async ()=>{";
|
|
20334
|
+
suffix = "})()";
|
|
20335
|
+
} else if (module2.hasAwait(exp)) {
|
|
20028
20336
|
prefix = "(await (async ()=>{";
|
|
20029
20337
|
suffix = "})())";
|
|
20030
20338
|
} else {
|
|
@@ -20232,6 +20540,7 @@ ${input.slice(result.pos)}
|
|
|
20232
20540
|
}
|
|
20233
20541
|
module2.makeLeftHandSideExpression = function(expression) {
|
|
20234
20542
|
switch (expression.type) {
|
|
20543
|
+
case "Ref":
|
|
20235
20544
|
case "Identifier":
|
|
20236
20545
|
case "Literal":
|
|
20237
20546
|
case "CallExpression":
|
|
@@ -20616,14 +20925,14 @@ ${input.slice(result.pos)}
|
|
|
20616
20925
|
if (node == null)
|
|
20617
20926
|
return [];
|
|
20618
20927
|
if (Array.isArray(node)) {
|
|
20619
|
-
return node.flatMap((n) => gatherRecursive(n, predicate));
|
|
20928
|
+
return node.flatMap((n) => gatherRecursive(n, predicate, skipPredicate));
|
|
20620
20929
|
}
|
|
20621
20930
|
if (skipPredicate?.(node))
|
|
20622
20931
|
return [];
|
|
20623
20932
|
if (predicate(node)) {
|
|
20624
20933
|
return [node];
|
|
20625
20934
|
}
|
|
20626
|
-
return gatherRecursive(node.children, predicate);
|
|
20935
|
+
return gatherRecursive(node.children, predicate, skipPredicate);
|
|
20627
20936
|
}
|
|
20628
20937
|
function gatherRecursiveAll(node, predicate) {
|
|
20629
20938
|
if (node == null)
|
|
@@ -20637,8 +20946,9 @@ ${input.slice(result.pos)}
|
|
|
20637
20946
|
}
|
|
20638
20947
|
return nodes;
|
|
20639
20948
|
}
|
|
20640
|
-
function isFunction(
|
|
20641
|
-
|
|
20949
|
+
function isFunction(node) {
|
|
20950
|
+
const { type } = node;
|
|
20951
|
+
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
20642
20952
|
}
|
|
20643
20953
|
function gatherRecursiveWithinFunction(node, predicate) {
|
|
20644
20954
|
return gatherRecursive(node, predicate, isFunction);
|
|
@@ -20661,6 +20971,28 @@ ${input.slice(result.pos)}
|
|
|
20661
20971
|
}
|
|
20662
20972
|
}
|
|
20663
20973
|
}
|
|
20974
|
+
function removeParentPointers(node) {
|
|
20975
|
+
if (node == null)
|
|
20976
|
+
return;
|
|
20977
|
+
if (typeof node !== "object")
|
|
20978
|
+
return;
|
|
20979
|
+
if (Array.isArray(node)) {
|
|
20980
|
+
for (const child of node) {
|
|
20981
|
+
removeParentPointers(child);
|
|
20982
|
+
}
|
|
20983
|
+
return;
|
|
20984
|
+
}
|
|
20985
|
+
node.parent = null;
|
|
20986
|
+
if (node.children) {
|
|
20987
|
+
for (const child of node.children) {
|
|
20988
|
+
removeParentPointers(child);
|
|
20989
|
+
}
|
|
20990
|
+
}
|
|
20991
|
+
}
|
|
20992
|
+
function clone(node) {
|
|
20993
|
+
removeParentPointers(node);
|
|
20994
|
+
return structuredClone(node);
|
|
20995
|
+
}
|
|
20664
20996
|
function findAncestor(node, predicate, stopPredicate) {
|
|
20665
20997
|
node = node.parent;
|
|
20666
20998
|
while (node && !stopPredicate?.(node)) {
|
|
@@ -20669,6 +21001,23 @@ ${input.slice(result.pos)}
|
|
|
20669
21001
|
node = node.parent;
|
|
20670
21002
|
}
|
|
20671
21003
|
}
|
|
21004
|
+
module2.replaceNodes = (root, predicate, replacer) => {
|
|
21005
|
+
if (root == null)
|
|
21006
|
+
return root;
|
|
21007
|
+
const array = Array.isArray(root) ? root : root.children;
|
|
21008
|
+
if (!array)
|
|
21009
|
+
return root;
|
|
21010
|
+
array.forEach((node, i) => {
|
|
21011
|
+
if (node == null)
|
|
21012
|
+
return;
|
|
21013
|
+
if (predicate(node)) {
|
|
21014
|
+
array[i] = replacer(node, root);
|
|
21015
|
+
} else {
|
|
21016
|
+
module2.replaceNodes(node, predicate, replacer);
|
|
21017
|
+
}
|
|
21018
|
+
});
|
|
21019
|
+
return root;
|
|
21020
|
+
};
|
|
20672
21021
|
function processParams(f) {
|
|
20673
21022
|
const { type, parameters, block } = f;
|
|
20674
21023
|
if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
|
|
@@ -21161,6 +21510,22 @@ ${input.slice(result.pos)}
|
|
|
21161
21510
|
}
|
|
21162
21511
|
}
|
|
21163
21512
|
propsGroupedByName.forEach((shared, key) => {
|
|
21513
|
+
if (!key)
|
|
21514
|
+
return;
|
|
21515
|
+
if (ReservedWord({
|
|
21516
|
+
pos: 0,
|
|
21517
|
+
input: key
|
|
21518
|
+
})) {
|
|
21519
|
+
shared.forEach((p) => {
|
|
21520
|
+
const ref = {
|
|
21521
|
+
type: "Ref",
|
|
21522
|
+
base: `_${key}`,
|
|
21523
|
+
id: key
|
|
21524
|
+
};
|
|
21525
|
+
p.children.push(": ", ref);
|
|
21526
|
+
});
|
|
21527
|
+
return;
|
|
21528
|
+
}
|
|
21164
21529
|
if (shared.length === 1)
|
|
21165
21530
|
return;
|
|
21166
21531
|
const refs = shared.map((p) => {
|
|
@@ -21202,19 +21567,7 @@ ${input.slice(result.pos)}
|
|
|
21202
21567
|
if (expression.type === "ParenthesizedExpression") {
|
|
21203
21568
|
expression = expression.expression;
|
|
21204
21569
|
}
|
|
21205
|
-
let ref;
|
|
21206
|
-
switch (expression.type) {
|
|
21207
|
-
case "Identifier":
|
|
21208
|
-
case "Literal":
|
|
21209
|
-
ref = expression;
|
|
21210
|
-
break;
|
|
21211
|
-
default:
|
|
21212
|
-
ref = {
|
|
21213
|
-
type: "Ref",
|
|
21214
|
-
base: "m",
|
|
21215
|
-
id: "m"
|
|
21216
|
-
};
|
|
21217
|
-
}
|
|
21570
|
+
let ref = module2.needsRef(expression, "m") || expression;
|
|
21218
21571
|
let prev = [], root = prev;
|
|
21219
21572
|
const l = clauses.length;
|
|
21220
21573
|
clauses.forEach((c, i) => {
|
|
@@ -21285,29 +21638,96 @@ ${input.slice(result.pos)}
|
|
|
21285
21638
|
const [ws, , body] = s.children;
|
|
21286
21639
|
let [, arg] = s.children;
|
|
21287
21640
|
let i = 0, l = body.length;
|
|
21288
|
-
const
|
|
21641
|
+
const refDec = [];
|
|
21642
|
+
const children = [ws, refDec];
|
|
21643
|
+
let usingRef = null;
|
|
21289
21644
|
for (i = 0; i < l; i++) {
|
|
21290
21645
|
const step = body[i];
|
|
21291
21646
|
const [leadingComment, pipe, trailingComment, expr] = step;
|
|
21292
21647
|
const returns = pipe.token === "||>";
|
|
21648
|
+
let ref, result, returning = returns ? arg : null;
|
|
21293
21649
|
if (pipe.token === "|>=") {
|
|
21650
|
+
let initRef;
|
|
21294
21651
|
if (i === 0) {
|
|
21295
|
-
|
|
21652
|
+
outer:
|
|
21653
|
+
switch (arg.type) {
|
|
21654
|
+
case "MemberExpression":
|
|
21655
|
+
if (arg.children.length <= 2)
|
|
21656
|
+
break;
|
|
21657
|
+
case "CallExpression":
|
|
21658
|
+
const access = arg.children.pop();
|
|
21659
|
+
switch (access.type) {
|
|
21660
|
+
case "PropertyAccess":
|
|
21661
|
+
case "SliceExpression":
|
|
21662
|
+
break;
|
|
21663
|
+
default:
|
|
21664
|
+
children.unshift({
|
|
21665
|
+
type: "Error",
|
|
21666
|
+
$loc: pipe.token.$loc,
|
|
21667
|
+
message: `Can't assign to ${access.type}`
|
|
21668
|
+
});
|
|
21669
|
+
arg.children.push(access);
|
|
21670
|
+
break outer;
|
|
21671
|
+
}
|
|
21672
|
+
usingRef = module2.needsRef({});
|
|
21673
|
+
initRef = {
|
|
21674
|
+
type: "AssignmentExpression",
|
|
21675
|
+
children: [usingRef, " = ", arg, ","]
|
|
21676
|
+
};
|
|
21677
|
+
arg = {
|
|
21678
|
+
type: "MemberExpression",
|
|
21679
|
+
children: [usingRef, access]
|
|
21680
|
+
};
|
|
21681
|
+
break;
|
|
21682
|
+
}
|
|
21683
|
+
children.pop();
|
|
21684
|
+
const lhs = [[
|
|
21685
|
+
[refDec, initRef],
|
|
21686
|
+
arg,
|
|
21687
|
+
[],
|
|
21688
|
+
{ token: "=", children: [" = "] }
|
|
21689
|
+
]];
|
|
21690
|
+
Object.assign(s, {
|
|
21691
|
+
type: "AssignmentExpression",
|
|
21692
|
+
children: [lhs, children],
|
|
21693
|
+
names: null,
|
|
21694
|
+
lhs,
|
|
21695
|
+
assigned: arg,
|
|
21696
|
+
exp: children
|
|
21697
|
+
});
|
|
21698
|
+
arg = clone(arg);
|
|
21699
|
+
if (arg.children[0].type === "Ref") {
|
|
21700
|
+
arg.children[0] = usingRef;
|
|
21701
|
+
}
|
|
21296
21702
|
} else {
|
|
21297
|
-
children.
|
|
21703
|
+
children.unshift({
|
|
21298
21704
|
type: "Error",
|
|
21705
|
+
$loc: pipe.token.$loc,
|
|
21299
21706
|
message: "Can't use |>= in the middle of a pipeline"
|
|
21300
21707
|
});
|
|
21301
21708
|
}
|
|
21709
|
+
} else {
|
|
21710
|
+
s.children = children;
|
|
21302
21711
|
}
|
|
21303
|
-
|
|
21712
|
+
if (returns && (ref = module2.needsRef(arg))) {
|
|
21713
|
+
usingRef = usingRef || ref;
|
|
21714
|
+
arg = {
|
|
21715
|
+
type: "ParenthesizedExpression",
|
|
21716
|
+
children: ["(", {
|
|
21717
|
+
type: "AssignmentExpression",
|
|
21718
|
+
children: [usingRef, " = ", arg]
|
|
21719
|
+
}, ")"]
|
|
21720
|
+
};
|
|
21721
|
+
returning = usingRef;
|
|
21722
|
+
}
|
|
21723
|
+
[result, returning] = module2.constructPipeStep(
|
|
21304
21724
|
{
|
|
21305
21725
|
leadingComment: module2.skipIfOnlyWS(leadingComment),
|
|
21306
21726
|
trailingComment: module2.skipIfOnlyWS(trailingComment),
|
|
21307
21727
|
expr
|
|
21308
21728
|
},
|
|
21309
21729
|
arg,
|
|
21310
|
-
|
|
21730
|
+
returning
|
|
21311
21731
|
);
|
|
21312
21732
|
if (result.type === "ReturnStatement") {
|
|
21313
21733
|
if (i < l - 1) {
|
|
@@ -21330,8 +21750,10 @@ ${input.slice(result.pos)}
|
|
|
21330
21750
|
arg = result;
|
|
21331
21751
|
}
|
|
21332
21752
|
}
|
|
21753
|
+
if (usingRef) {
|
|
21754
|
+
refDec.unshift("let ", usingRef, ";");
|
|
21755
|
+
}
|
|
21333
21756
|
children.push(arg);
|
|
21334
|
-
s.children = children;
|
|
21335
21757
|
addParentPointers(s, s.parent);
|
|
21336
21758
|
});
|
|
21337
21759
|
}
|
|
@@ -21620,7 +22042,7 @@ ${input.slice(result.pos)}
|
|
|
21620
22042
|
return result;
|
|
21621
22043
|
}
|
|
21622
22044
|
}
|
|
21623
|
-
var Indent$0 = $TR($EXPECT($
|
|
22045
|
+
var Indent$0 = $TR($EXPECT($R65, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
21624
22046
|
let level;
|
|
21625
22047
|
if (module2.config.tab) {
|
|
21626
22048
|
const tabs = $0.match(/\t/g);
|