@danielx/civet 0.5.80 → 0.5.81
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 +214 -144
- package/dist/main.js +214 -144
- package/dist/main.mjs +214 -144
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -26,6 +26,106 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
|
|
29
|
+
// source/lib.js
|
|
30
|
+
var require_lib = __commonJS({
|
|
31
|
+
"source/lib.js"(exports, module2) {
|
|
32
|
+
"use strict";
|
|
33
|
+
function clone(node) {
|
|
34
|
+
removeParentPointers(node);
|
|
35
|
+
return deepCopy(node);
|
|
36
|
+
}
|
|
37
|
+
function deepCopy(node) {
|
|
38
|
+
if (node == null)
|
|
39
|
+
return node;
|
|
40
|
+
if (typeof node !== "object")
|
|
41
|
+
return node;
|
|
42
|
+
if (Array.isArray(node)) {
|
|
43
|
+
return node.map(deepCopy);
|
|
44
|
+
}
|
|
45
|
+
return Object.fromEntries(
|
|
46
|
+
Object.entries(node).map(([key, value]) => {
|
|
47
|
+
return [key, deepCopy(value)];
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function removeParentPointers(node) {
|
|
52
|
+
if (node == null)
|
|
53
|
+
return;
|
|
54
|
+
if (typeof node !== "object")
|
|
55
|
+
return;
|
|
56
|
+
if (Array.isArray(node)) {
|
|
57
|
+
for (const child of node) {
|
|
58
|
+
removeParentPointers(child);
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
node.parent = null;
|
|
63
|
+
if (node.children) {
|
|
64
|
+
for (const child of node.children) {
|
|
65
|
+
removeParentPointers(child);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function gatherNodes(node, predicate) {
|
|
70
|
+
if (node == null)
|
|
71
|
+
return [];
|
|
72
|
+
if (Array.isArray(node)) {
|
|
73
|
+
return node.flatMap((n) => gatherNodes(n, predicate));
|
|
74
|
+
}
|
|
75
|
+
if (predicate(node)) {
|
|
76
|
+
return [node];
|
|
77
|
+
}
|
|
78
|
+
switch (node.type) {
|
|
79
|
+
case "BlockStatement":
|
|
80
|
+
return [];
|
|
81
|
+
case "ForStatement":
|
|
82
|
+
const isDec = node.declaration?.type === "Declaration";
|
|
83
|
+
return node.children.flatMap((n) => {
|
|
84
|
+
if (isDec && n === node.declaration)
|
|
85
|
+
return [];
|
|
86
|
+
return gatherNodes(n, predicate);
|
|
87
|
+
});
|
|
88
|
+
default:
|
|
89
|
+
return gatherNodes(node.children, predicate);
|
|
90
|
+
}
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
function gatherRecursive(node, predicate, skipPredicate) {
|
|
94
|
+
if (node == null)
|
|
95
|
+
return [];
|
|
96
|
+
if (Array.isArray(node)) {
|
|
97
|
+
return node.flatMap((n) => gatherRecursive(n, predicate, skipPredicate));
|
|
98
|
+
}
|
|
99
|
+
if (skipPredicate?.(node))
|
|
100
|
+
return [];
|
|
101
|
+
if (predicate(node)) {
|
|
102
|
+
return [node];
|
|
103
|
+
}
|
|
104
|
+
return gatherRecursive(node.children, predicate, skipPredicate);
|
|
105
|
+
}
|
|
106
|
+
function gatherRecursiveAll(node, predicate) {
|
|
107
|
+
if (node == null)
|
|
108
|
+
return [];
|
|
109
|
+
if (Array.isArray(node)) {
|
|
110
|
+
return node.flatMap((n) => gatherRecursiveAll(n, predicate));
|
|
111
|
+
}
|
|
112
|
+
const nodes = gatherRecursiveAll(node.children, predicate);
|
|
113
|
+
if (predicate(node)) {
|
|
114
|
+
nodes.push(node);
|
|
115
|
+
}
|
|
116
|
+
return nodes;
|
|
117
|
+
}
|
|
118
|
+
module2.exports = {
|
|
119
|
+
clone,
|
|
120
|
+
deepCopy,
|
|
121
|
+
gatherNodes,
|
|
122
|
+
gatherRecursive,
|
|
123
|
+
gatherRecursiveAll,
|
|
124
|
+
removeParentPointers
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
29
129
|
// source/parser.hera
|
|
30
130
|
var require_parser = __commonJS({
|
|
31
131
|
"source/parser.hera"(exports, module2) {
|
|
@@ -565,6 +665,7 @@ ${input.slice(result.pos)}
|
|
|
565
665
|
FunctionDeclaration,
|
|
566
666
|
FunctionSignature,
|
|
567
667
|
FunctionExpression,
|
|
668
|
+
AmpersandFunctionExpression,
|
|
568
669
|
OperatorDeclaration,
|
|
569
670
|
OperatorSignature,
|
|
570
671
|
AmpersandBlockRHS,
|
|
@@ -1879,8 +1980,8 @@ ${input.slice(result.pos)}
|
|
|
1879
1980
|
return module2.insertTrimmingSpace($1, "");
|
|
1880
1981
|
});
|
|
1881
1982
|
var ArgumentList$2 = NestedArgumentList;
|
|
1882
|
-
var ArgumentList$3 = $TS($S($
|
|
1883
|
-
return [...$1, $2, ...$3];
|
|
1983
|
+
var ArgumentList$3 = $TS($S($E(_), ArgumentPart, $Q($S(CommaDelimiter, $E(_), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
1984
|
+
return [...$1 || [], $2, ...$3];
|
|
1884
1985
|
});
|
|
1885
1986
|
function ArgumentList(state) {
|
|
1886
1987
|
let eventData;
|
|
@@ -1909,8 +2010,8 @@ ${input.slice(result.pos)}
|
|
|
1909
2010
|
return module2.insertTrimmingSpace($1, "");
|
|
1910
2011
|
});
|
|
1911
2012
|
var NonPipelineArgumentList$2 = NestedArgumentList;
|
|
1912
|
-
var NonPipelineArgumentList$3 = $TS($S($
|
|
1913
|
-
return [...$1, $2, ...$3];
|
|
2013
|
+
var NonPipelineArgumentList$3 = $TS($S($E(_), NonPipelineArgumentPart, $Q($S(CommaDelimiter, $E(_), NonPipelineArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
2014
|
+
return [...$1 || [], $2, ...$3];
|
|
1914
2015
|
});
|
|
1915
2016
|
function NonPipelineArgumentList(state) {
|
|
1916
2017
|
let eventData;
|
|
@@ -1985,7 +2086,7 @@ ${input.slice(result.pos)}
|
|
|
1985
2086
|
return result;
|
|
1986
2087
|
}
|
|
1987
2088
|
}
|
|
1988
|
-
var SingleLineArgumentExpressions$0 = $S($
|
|
2089
|
+
var SingleLineArgumentExpressions$0 = $S($E(_), ArgumentPart, $Q($S($E(_), Comma, $E(_), ArgumentPart)));
|
|
1989
2090
|
function SingleLineArgumentExpressions(state) {
|
|
1990
2091
|
let eventData;
|
|
1991
2092
|
if (state.events) {
|
|
@@ -2344,10 +2445,10 @@ ${input.slice(result.pos)}
|
|
|
2344
2445
|
return result;
|
|
2345
2446
|
}
|
|
2346
2447
|
}
|
|
2347
|
-
var SingleLineAssignmentExpression$0 = $TS($S($
|
|
2448
|
+
var SingleLineAssignmentExpression$0 = $TS($S($E(_), AssignmentExpressionTail), function($skip, $loc, $0, $1, $2) {
|
|
2348
2449
|
var ws = $1;
|
|
2349
2450
|
var tail = $2;
|
|
2350
|
-
if (ws
|
|
2451
|
+
if (ws?.length) {
|
|
2351
2452
|
if (tail.children && tail.type !== "IterationExpression") {
|
|
2352
2453
|
return {
|
|
2353
2454
|
...tail,
|
|
@@ -2464,7 +2565,7 @@ ${input.slice(result.pos)}
|
|
|
2464
2565
|
}
|
|
2465
2566
|
}
|
|
2466
2567
|
var YieldTail$0 = $Y(EOS);
|
|
2467
|
-
var YieldTail$1 = $S($E($S($
|
|
2568
|
+
var YieldTail$1 = $S($E($S($E(_), Star)), AssignmentExpression);
|
|
2468
2569
|
function YieldTail(state) {
|
|
2469
2570
|
let eventData;
|
|
2470
2571
|
if (state.events) {
|
|
@@ -2636,7 +2737,7 @@ ${input.slice(result.pos)}
|
|
|
2636
2737
|
}
|
|
2637
2738
|
}
|
|
2638
2739
|
var TernaryRest$0 = NestedTernaryRest;
|
|
2639
|
-
var TernaryRest$1 = $TS($S($N(CoffeeBinaryExistentialEnabled), $Y($EXPECT($L9, fail, 'TernaryRest " "')), $
|
|
2740
|
+
var TernaryRest$1 = $TS($S($N(CoffeeBinaryExistentialEnabled), $Y($EXPECT($L9, fail, 'TernaryRest " "')), $E(_), QuestionMark, ExtendedExpression, __, Colon, ExtendedExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
2640
2741
|
return $0.slice(2);
|
|
2641
2742
|
});
|
|
2642
2743
|
function TernaryRest(state) {
|
|
@@ -2715,6 +2816,23 @@ ${input.slice(result.pos)}
|
|
|
2715
2816
|
var ws = $1;
|
|
2716
2817
|
var head = $2;
|
|
2717
2818
|
var body = $3;
|
|
2819
|
+
if (head.token === "&") {
|
|
2820
|
+
const ref = {
|
|
2821
|
+
type: "Ref",
|
|
2822
|
+
base: "$"
|
|
2823
|
+
};
|
|
2824
|
+
const arrowBody = {
|
|
2825
|
+
type: "PipelineExpression",
|
|
2826
|
+
children: [ws, ref, body]
|
|
2827
|
+
};
|
|
2828
|
+
return {
|
|
2829
|
+
type: "ArrowFunction",
|
|
2830
|
+
children: [ref, " => ", arrowBody],
|
|
2831
|
+
ref,
|
|
2832
|
+
body: [arrowBody],
|
|
2833
|
+
ampersandBlock: true
|
|
2834
|
+
};
|
|
2835
|
+
}
|
|
2718
2836
|
return {
|
|
2719
2837
|
type: "PipelineExpression",
|
|
2720
2838
|
children: [ws, head, body]
|
|
@@ -2744,6 +2862,7 @@ ${input.slice(result.pos)}
|
|
|
2744
2862
|
}
|
|
2745
2863
|
var PipelineHeadItem$0 = NonPipelineExtendedExpression;
|
|
2746
2864
|
var PipelineHeadItem$1 = ParenthesizedExpression;
|
|
2865
|
+
var PipelineHeadItem$2 = Ampersand;
|
|
2747
2866
|
function PipelineHeadItem(state) {
|
|
2748
2867
|
let eventData;
|
|
2749
2868
|
if (state.events) {
|
|
@@ -2755,12 +2874,12 @@ ${input.slice(result.pos)}
|
|
|
2755
2874
|
}
|
|
2756
2875
|
}
|
|
2757
2876
|
if (state.tokenize) {
|
|
2758
|
-
const result = $TOKEN("PipelineHeadItem", state, PipelineHeadItem$0(state) || PipelineHeadItem$1(state));
|
|
2877
|
+
const result = $TOKEN("PipelineHeadItem", state, PipelineHeadItem$0(state) || PipelineHeadItem$1(state) || PipelineHeadItem$2(state));
|
|
2759
2878
|
if (state.events)
|
|
2760
2879
|
state.events.exit?.("PipelineHeadItem", state, result, eventData);
|
|
2761
2880
|
return result;
|
|
2762
2881
|
} else {
|
|
2763
|
-
const result = PipelineHeadItem$0(state) || PipelineHeadItem$1(state);
|
|
2882
|
+
const result = PipelineHeadItem$0(state) || PipelineHeadItem$1(state) || PipelineHeadItem$2(state);
|
|
2764
2883
|
if (state.events)
|
|
2765
2884
|
state.events.exit?.("PipelineHeadItem", state, result, eventData);
|
|
2766
2885
|
return result;
|
|
@@ -2769,7 +2888,10 @@ ${input.slice(result.pos)}
|
|
|
2769
2888
|
var PipelineTailItem$0 = Await;
|
|
2770
2889
|
var PipelineTailItem$1 = Yield;
|
|
2771
2890
|
var PipelineTailItem$2 = Return;
|
|
2772
|
-
var PipelineTailItem$3 =
|
|
2891
|
+
var PipelineTailItem$3 = AmpersandFunctionExpression;
|
|
2892
|
+
var PipelineTailItem$4 = $T($S($N(Ampersand), PipelineHeadItem), function(value) {
|
|
2893
|
+
return value[1];
|
|
2894
|
+
});
|
|
2773
2895
|
function PipelineTailItem(state) {
|
|
2774
2896
|
let eventData;
|
|
2775
2897
|
if (state.events) {
|
|
@@ -2781,12 +2903,12 @@ ${input.slice(result.pos)}
|
|
|
2781
2903
|
}
|
|
2782
2904
|
}
|
|
2783
2905
|
if (state.tokenize) {
|
|
2784
|
-
const result = $TOKEN("PipelineTailItem", state, PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state));
|
|
2906
|
+
const result = $TOKEN("PipelineTailItem", state, PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state) || PipelineTailItem$4(state));
|
|
2785
2907
|
if (state.events)
|
|
2786
2908
|
state.events.exit?.("PipelineTailItem", state, result, eventData);
|
|
2787
2909
|
return result;
|
|
2788
2910
|
} else {
|
|
2789
|
-
const result = PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state);
|
|
2911
|
+
const result = PipelineTailItem$0(state) || PipelineTailItem$1(state) || PipelineTailItem$2(state) || PipelineTailItem$3(state) || PipelineTailItem$4(state);
|
|
2790
2912
|
if (state.events)
|
|
2791
2913
|
state.events.exit?.("PipelineTailItem", state, result, eventData);
|
|
2792
2914
|
return result;
|
|
@@ -3233,7 +3355,7 @@ ${input.slice(result.pos)}
|
|
|
3233
3355
|
return result;
|
|
3234
3356
|
}
|
|
3235
3357
|
}
|
|
3236
|
-
var ClassElement$0 = $S($E(Decorators), $E(AccessModifier), $E($S(Static, $
|
|
3358
|
+
var ClassElement$0 = $S($E(Decorators), $E(AccessModifier), $E($S(Static, $E(_))), ClassElementDefinition);
|
|
3237
3359
|
var ClassElement$1 = $S(Static, BracedBlock);
|
|
3238
3360
|
function ClassElement(state) {
|
|
3239
3361
|
let eventData;
|
|
@@ -3379,7 +3501,7 @@ ${input.slice(result.pos)}
|
|
|
3379
3501
|
return result;
|
|
3380
3502
|
}
|
|
3381
3503
|
}
|
|
3382
|
-
var ClassSignatureElement$0 = $S($E(Decorators), $E(AccessModifier), $E($S(Static, $
|
|
3504
|
+
var ClassSignatureElement$0 = $S($E(Decorators), $E(AccessModifier), $E($S(Static, $E(_))), $C(MethodSignature, FieldDefinition));
|
|
3383
3505
|
var ClassSignatureElement$1 = $S(Static, ClassSignatureBody);
|
|
3384
3506
|
function ClassSignatureElement(state) {
|
|
3385
3507
|
let eventData;
|
|
@@ -3455,7 +3577,7 @@ ${input.slice(result.pos)}
|
|
|
3455
3577
|
};
|
|
3456
3578
|
return $0;
|
|
3457
3579
|
});
|
|
3458
|
-
var FieldDefinition$2 = $TS($S($E($S(Abstract, $
|
|
3580
|
+
var FieldDefinition$2 = $TS($S($E($S(Abstract, $E(_))), $E($S(Readonly, $E(_))), ClassElementName, $E(TypeSuffix), $E(Initializer)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
3459
3581
|
if ($1)
|
|
3460
3582
|
return { children: $0, ts: true };
|
|
3461
3583
|
return $0;
|
|
@@ -5595,7 +5717,30 @@ ${input.slice(result.pos)}
|
|
|
5595
5717
|
block
|
|
5596
5718
|
};
|
|
5597
5719
|
});
|
|
5598
|
-
var FunctionExpression$1 =
|
|
5720
|
+
var FunctionExpression$1 = AmpersandFunctionExpression;
|
|
5721
|
+
function FunctionExpression(state) {
|
|
5722
|
+
let eventData;
|
|
5723
|
+
if (state.events) {
|
|
5724
|
+
const result = state.events.enter?.("FunctionExpression", state);
|
|
5725
|
+
if (result) {
|
|
5726
|
+
if (result.cache)
|
|
5727
|
+
return result.cache;
|
|
5728
|
+
eventData = result.data;
|
|
5729
|
+
}
|
|
5730
|
+
}
|
|
5731
|
+
if (state.tokenize) {
|
|
5732
|
+
const result = $TOKEN("FunctionExpression", state, FunctionExpression$0(state) || FunctionExpression$1(state));
|
|
5733
|
+
if (state.events)
|
|
5734
|
+
state.events.exit?.("FunctionExpression", state, result, eventData);
|
|
5735
|
+
return result;
|
|
5736
|
+
} else {
|
|
5737
|
+
const result = FunctionExpression$0(state) || FunctionExpression$1(state);
|
|
5738
|
+
if (state.events)
|
|
5739
|
+
state.events.exit?.("FunctionExpression", state, result, eventData);
|
|
5740
|
+
return result;
|
|
5741
|
+
}
|
|
5742
|
+
}
|
|
5743
|
+
var AmpersandFunctionExpression$0 = $TS($S($E(AmpersandUnaryPrefix), $C(Ampersand, $S($N(NumericLiteral), $Y($S($E(QuestionMark), Dot)))), $E(AmpersandBlockRHS)), function($skip, $loc, $0, $1, $2, $3) {
|
|
5599
5744
|
var prefix = $1;
|
|
5600
5745
|
var rhs = $3;
|
|
5601
5746
|
if (!prefix && !rhs)
|
|
@@ -5624,10 +5769,10 @@ ${input.slice(result.pos)}
|
|
|
5624
5769
|
ampersandBlock: true
|
|
5625
5770
|
};
|
|
5626
5771
|
});
|
|
5627
|
-
function
|
|
5772
|
+
function AmpersandFunctionExpression(state) {
|
|
5628
5773
|
let eventData;
|
|
5629
5774
|
if (state.events) {
|
|
5630
|
-
const result = state.events.enter?.("
|
|
5775
|
+
const result = state.events.enter?.("AmpersandFunctionExpression", state);
|
|
5631
5776
|
if (result) {
|
|
5632
5777
|
if (result.cache)
|
|
5633
5778
|
return result.cache;
|
|
@@ -5635,14 +5780,14 @@ ${input.slice(result.pos)}
|
|
|
5635
5780
|
}
|
|
5636
5781
|
}
|
|
5637
5782
|
if (state.tokenize) {
|
|
5638
|
-
const result = $TOKEN("
|
|
5783
|
+
const result = $TOKEN("AmpersandFunctionExpression", state, AmpersandFunctionExpression$0(state));
|
|
5639
5784
|
if (state.events)
|
|
5640
|
-
state.events.exit?.("
|
|
5785
|
+
state.events.exit?.("AmpersandFunctionExpression", state, result, eventData);
|
|
5641
5786
|
return result;
|
|
5642
5787
|
} else {
|
|
5643
|
-
const result =
|
|
5788
|
+
const result = AmpersandFunctionExpression$0(state);
|
|
5644
5789
|
if (state.events)
|
|
5645
|
-
state.events.exit?.("
|
|
5790
|
+
state.events.exit?.("AmpersandFunctionExpression", state, result, eventData);
|
|
5646
5791
|
return result;
|
|
5647
5792
|
}
|
|
5648
5793
|
}
|
|
@@ -6197,7 +6342,7 @@ ${input.slice(result.pos)}
|
|
|
6197
6342
|
return result;
|
|
6198
6343
|
}
|
|
6199
6344
|
}
|
|
6200
|
-
var NonSingleBracedBlock$0 = $TS($S($
|
|
6345
|
+
var NonSingleBracedBlock$0 = $TS($S($E(_), OpenBrace, AllowAll, $E($S(BracedContent, __, CloseBrace)), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
6201
6346
|
var ws1 = $1;
|
|
6202
6347
|
var open = $2;
|
|
6203
6348
|
if (!$4)
|
|
@@ -6313,7 +6458,7 @@ ${input.slice(result.pos)}
|
|
|
6313
6458
|
}
|
|
6314
6459
|
}
|
|
6315
6460
|
var BracedContent$0 = NestedBlockStatements;
|
|
6316
|
-
var BracedContent$1 = $TS($S($
|
|
6461
|
+
var BracedContent$1 = $TS($S($E(_), Statement), function($skip, $loc, $0, $1, $2) {
|
|
6317
6462
|
const expressions = [["", $2]];
|
|
6318
6463
|
return {
|
|
6319
6464
|
type: "BlockStatement",
|
|
@@ -7357,7 +7502,7 @@ ${input.slice(result.pos)}
|
|
|
7357
7502
|
return result;
|
|
7358
7503
|
}
|
|
7359
7504
|
}
|
|
7360
|
-
var ImplicitInlineObjectPropertyDelimiter$0 = $S($
|
|
7505
|
+
var ImplicitInlineObjectPropertyDelimiter$0 = $S($E(_), Comma);
|
|
7361
7506
|
var ImplicitInlineObjectPropertyDelimiter$1 = $T($S($Y($S($C(Samedent, $Q(_)), NamedProperty)), InsertComma), function(value) {
|
|
7362
7507
|
return value[1];
|
|
7363
7508
|
});
|
|
@@ -7824,7 +7969,7 @@ ${input.slice(result.pos)}
|
|
|
7824
7969
|
return result;
|
|
7825
7970
|
}
|
|
7826
7971
|
}
|
|
7827
|
-
var MethodModifier$0 = $S(GetOrSet, $
|
|
7972
|
+
var MethodModifier$0 = $S(GetOrSet, $E(_));
|
|
7828
7973
|
var MethodModifier$1 = $S($S(Async, __), $E($S(Star, __)));
|
|
7829
7974
|
var MethodModifier$2 = $S(Star, __);
|
|
7830
7975
|
function MethodModifier(state) {
|
|
@@ -7980,8 +8125,8 @@ ${input.slice(result.pos)}
|
|
|
7980
8125
|
return result;
|
|
7981
8126
|
}
|
|
7982
8127
|
}
|
|
7983
|
-
var AssignmentOp$0 = $TS($S(AssignmentOpSymbol, $
|
|
7984
|
-
if ($2
|
|
8128
|
+
var AssignmentOp$0 = $TS($S(AssignmentOpSymbol, $E(_)), function($skip, $loc, $0, $1, $2) {
|
|
8129
|
+
if ($2?.length) {
|
|
7985
8130
|
return {
|
|
7986
8131
|
token: $1,
|
|
7987
8132
|
children: [$1, ...$2]
|
|
@@ -8011,21 +8156,21 @@ ${input.slice(result.pos)}
|
|
|
8011
8156
|
return result;
|
|
8012
8157
|
}
|
|
8013
8158
|
}
|
|
8014
|
-
var OperatorAssignmentOp$0 = $TS($S(Xor, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $
|
|
8159
|
+
var OperatorAssignmentOp$0 = $TS($S(Xor, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $E(_)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8015
8160
|
return {
|
|
8016
8161
|
special: true,
|
|
8017
8162
|
call: module2.getRef("xor"),
|
|
8018
8163
|
children: [$2, ...$4]
|
|
8019
8164
|
};
|
|
8020
8165
|
});
|
|
8021
|
-
var OperatorAssignmentOp$1 = $TS($S(Xnor, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $
|
|
8166
|
+
var OperatorAssignmentOp$1 = $TS($S(Xnor, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $E(_)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8022
8167
|
return {
|
|
8023
8168
|
special: true,
|
|
8024
8169
|
call: module2.getRef("xnor"),
|
|
8025
8170
|
children: [$2, ...$4]
|
|
8026
8171
|
};
|
|
8027
8172
|
});
|
|
8028
|
-
var OperatorAssignmentOp$2 = $TS($S(Identifier, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $
|
|
8173
|
+
var OperatorAssignmentOp$2 = $TS($S(Identifier, $EXPECT($L2, fail, 'OperatorAssignmentOp "="'), $Y(Whitespace), $E(_)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
8029
8174
|
return {
|
|
8030
8175
|
special: true,
|
|
8031
8176
|
call: $1,
|
|
@@ -8491,7 +8636,7 @@ ${input.slice(result.pos)}
|
|
|
8491
8636
|
return result;
|
|
8492
8637
|
}
|
|
8493
8638
|
}
|
|
8494
|
-
var PostfixedStatement$0 = $TS($S(Statement, $E($S($
|
|
8639
|
+
var PostfixedStatement$0 = $TS($S(Statement, $E($S($E(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
8495
8640
|
var statement = $1;
|
|
8496
8641
|
var post = $2;
|
|
8497
8642
|
if (post)
|
|
@@ -8520,7 +8665,7 @@ ${input.slice(result.pos)}
|
|
|
8520
8665
|
return result;
|
|
8521
8666
|
}
|
|
8522
8667
|
}
|
|
8523
|
-
var PostfixedExpression$0 = $TS($S(ExtendedExpression, $E($S($
|
|
8668
|
+
var PostfixedExpression$0 = $TS($S(ExtendedExpression, $E($S($E(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
8524
8669
|
var expression = $1;
|
|
8525
8670
|
var post = $2;
|
|
8526
8671
|
if (post)
|
|
@@ -8549,7 +8694,7 @@ ${input.slice(result.pos)}
|
|
|
8549
8694
|
return result;
|
|
8550
8695
|
}
|
|
8551
8696
|
}
|
|
8552
|
-
var NonPipelinePostfixedExpression$0 = $TS($S(NonPipelineExtendedExpression, $E($S($
|
|
8697
|
+
var NonPipelinePostfixedExpression$0 = $TS($S(NonPipelineExtendedExpression, $E($S($E(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
|
|
8553
8698
|
var expression = $1;
|
|
8554
8699
|
var post = $2;
|
|
8555
8700
|
if (post)
|
|
@@ -8642,8 +8787,8 @@ ${input.slice(result.pos)}
|
|
|
8642
8787
|
return result;
|
|
8643
8788
|
}
|
|
8644
8789
|
}
|
|
8645
|
-
var EmptyStatement$0 = $
|
|
8646
|
-
return {
|
|
8790
|
+
var EmptyStatement$0 = $TS($S($E(_), $Y($EXPECT($L85, fail, 'EmptyStatement ";"'))), function($skip, $loc, $0, $1, $2) {
|
|
8791
|
+
return { type: "EmptyStatement", children: $1 || [] };
|
|
8647
8792
|
});
|
|
8648
8793
|
function EmptyStatement(state) {
|
|
8649
8794
|
let eventData;
|
|
@@ -8807,7 +8952,7 @@ ${input.slice(result.pos)}
|
|
|
8807
8952
|
}
|
|
8808
8953
|
}
|
|
8809
8954
|
var ElseClause$0 = $S(Samedent, Else, Block);
|
|
8810
|
-
var ElseClause$1 = $S($
|
|
8955
|
+
var ElseClause$1 = $S($E(_), Else, Block);
|
|
8811
8956
|
function ElseClause(state) {
|
|
8812
8957
|
let eventData;
|
|
8813
8958
|
if (state.events) {
|
|
@@ -8942,7 +9087,7 @@ ${input.slice(result.pos)}
|
|
|
8942
9087
|
return result;
|
|
8943
9088
|
}
|
|
8944
9089
|
}
|
|
8945
|
-
var ElseExpressionClause$0 = $TS($S($C($S(Samedent, Else), $S($
|
|
9090
|
+
var ElseExpressionClause$0 = $TS($S($C($S(Samedent, Else), $S($E(_), Else)), ElseExpressionBlock), function($skip, $loc, $0, $1, $2) {
|
|
8946
9091
|
return [...$1, $2];
|
|
8947
9092
|
});
|
|
8948
9093
|
function ElseExpressionClause(state) {
|
|
@@ -9318,7 +9463,7 @@ ${input.slice(result.pos)}
|
|
|
9318
9463
|
return result;
|
|
9319
9464
|
}
|
|
9320
9465
|
}
|
|
9321
|
-
var WhileClause$0 = $TS($S($C(While, Until), $
|
|
9466
|
+
var WhileClause$0 = $TS($S($C(While, Until), $E(_), Condition), function($skip, $loc, $0, $1, $2, $3) {
|
|
9322
9467
|
var kind = $1;
|
|
9323
9468
|
var ws = $2;
|
|
9324
9469
|
var cond = $3;
|
|
@@ -10415,7 +10560,7 @@ ${input.slice(result.pos)}
|
|
|
10415
10560
|
return result;
|
|
10416
10561
|
}
|
|
10417
10562
|
}
|
|
10418
|
-
var Condition$0 = $T($S(ParenthesizedExpression, $N($S($
|
|
10563
|
+
var Condition$0 = $T($S(ParenthesizedExpression, $N($S($E(_), $C(BinaryOp, AssignmentOp, Dot, QuestionMark))), $N($S(_, OperatorAssignmentOp))), function(value) {
|
|
10419
10564
|
return value[0];
|
|
10420
10565
|
});
|
|
10421
10566
|
var Condition$1 = $TS($S(InsertOpenParen, ExpressionWithIndentedApplicationForbidden, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3) {
|
|
@@ -13380,9 +13525,7 @@ ${input.slice(result.pos)}
|
|
|
13380
13525
|
return result;
|
|
13381
13526
|
}
|
|
13382
13527
|
}
|
|
13383
|
-
var TrailingComment$0 =
|
|
13384
|
-
var TrailingComment$1 = InlineComment;
|
|
13385
|
-
var TrailingComment$2 = SingleLineComment;
|
|
13528
|
+
var TrailingComment$0 = $S($E(_), SingleLineComment);
|
|
13386
13529
|
function TrailingComment(state) {
|
|
13387
13530
|
let eventData;
|
|
13388
13531
|
if (state.events) {
|
|
@@ -13394,12 +13537,12 @@ ${input.slice(result.pos)}
|
|
|
13394
13537
|
}
|
|
13395
13538
|
}
|
|
13396
13539
|
if (state.tokenize) {
|
|
13397
|
-
const result = $TOKEN("TrailingComment", state, TrailingComment$0(state)
|
|
13540
|
+
const result = $TOKEN("TrailingComment", state, TrailingComment$0(state));
|
|
13398
13541
|
if (state.events)
|
|
13399
13542
|
state.events.exit?.("TrailingComment", state, result, eventData);
|
|
13400
13543
|
return result;
|
|
13401
13544
|
} else {
|
|
13402
|
-
const result = TrailingComment$0(state)
|
|
13545
|
+
const result = TrailingComment$0(state);
|
|
13403
13546
|
if (state.events)
|
|
13404
13547
|
state.events.exit?.("TrailingComment", state, result, eventData);
|
|
13405
13548
|
return result;
|
|
@@ -13530,7 +13673,7 @@ ${input.slice(result.pos)}
|
|
|
13530
13673
|
return result;
|
|
13531
13674
|
}
|
|
13532
13675
|
}
|
|
13533
|
-
var ExpressionDelimiter$0 = $TS($S($
|
|
13676
|
+
var ExpressionDelimiter$0 = $TS($S($E(_), Semicolon, InsertComma, $E(TrailingComment)), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
13534
13677
|
return [$1, $3, $4];
|
|
13535
13678
|
});
|
|
13536
13679
|
var ExpressionDelimiter$1 = $T($S($Y(EOS), InsertComma), function(value) {
|
|
@@ -13607,7 +13750,7 @@ ${input.slice(result.pos)}
|
|
|
13607
13750
|
return result;
|
|
13608
13751
|
}
|
|
13609
13752
|
}
|
|
13610
|
-
var SemicolonDelimiter$0 = $TS($S($
|
|
13753
|
+
var SemicolonDelimiter$0 = $TS($S($E(_), Semicolon, $E(TrailingComment)), function($skip, $loc, $0, $1, $2, $3) {
|
|
13611
13754
|
return {
|
|
13612
13755
|
type: "SemicolonDelimiter",
|
|
13613
13756
|
children: $0
|
|
@@ -17213,9 +17356,9 @@ ${input.slice(result.pos)}
|
|
|
17213
17356
|
return result;
|
|
17214
17357
|
}
|
|
17215
17358
|
}
|
|
17216
|
-
var TypeDeclarationRest$0 = $S(TypeKeyword, $
|
|
17217
|
-
var TypeDeclarationRest$1 = $S(Interface, $
|
|
17218
|
-
var TypeDeclarationRest$2 = $S(Namespace, $
|
|
17359
|
+
var TypeDeclarationRest$0 = $S(TypeKeyword, $E(_), IdentifierName, $E(TypeParameters), __, Equals, $C($S($E(_), Type), $S(__, Type)));
|
|
17360
|
+
var TypeDeclarationRest$1 = $S(Interface, $E(_), IdentifierName, $E(TypeParameters), $E(InterfaceExtendsClause), InterfaceBlock);
|
|
17361
|
+
var TypeDeclarationRest$2 = $S(Namespace, $E(_), IdentifierName, ModuleBlock);
|
|
17219
17362
|
var TypeDeclarationRest$3 = FunctionSignature;
|
|
17220
17363
|
function TypeDeclarationRest(state) {
|
|
17221
17364
|
let eventData;
|
|
@@ -17242,7 +17385,7 @@ ${input.slice(result.pos)}
|
|
|
17242
17385
|
var TypeLexicalDeclaration$0 = $S(__, LetOrConstOrVar, TypeDeclarationBinding, $Q($S(CommaDelimiter, __, TypeDeclarationBinding)));
|
|
17243
17386
|
var TypeLexicalDeclaration$1 = $S(__, EnumDeclaration);
|
|
17244
17387
|
var TypeLexicalDeclaration$2 = ClassSignature;
|
|
17245
|
-
var TypeLexicalDeclaration$3 = $S(Namespace, $
|
|
17388
|
+
var TypeLexicalDeclaration$3 = $S(Namespace, $E(_), IdentifierName, DeclareBlock);
|
|
17246
17389
|
var TypeLexicalDeclaration$4 = $S(Module, _, StringLiteral, $E(DeclareBlock));
|
|
17247
17390
|
var TypeLexicalDeclaration$5 = $S(Global, $E(DeclareBlock));
|
|
17248
17391
|
function TypeLexicalDeclaration(state) {
|
|
@@ -17814,7 +17957,7 @@ ${input.slice(result.pos)}
|
|
|
17814
17957
|
return result;
|
|
17815
17958
|
}
|
|
17816
17959
|
}
|
|
17817
|
-
var EnumDeclaration$0 = $TS($S($E($S(Const, _)), Enum, $
|
|
17960
|
+
var EnumDeclaration$0 = $TS($S($E($S(Const, _)), Enum, $E(_), IdentifierName, EnumBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
17818
17961
|
var isConst = $1;
|
|
17819
17962
|
var id = $4;
|
|
17820
17963
|
var block = $5;
|
|
@@ -17835,7 +17978,7 @@ ${input.slice(result.pos)}
|
|
|
17835
17978
|
let init, isString;
|
|
17836
17979
|
if (property.init) {
|
|
17837
17980
|
init = module2.replaceNodes(
|
|
17838
|
-
|
|
17981
|
+
deepCopy(property.init),
|
|
17839
17982
|
(n) => n.type === "Identifier" && names.has(n.name),
|
|
17840
17983
|
(n) => [id, '["', n.name, '"]']
|
|
17841
17984
|
);
|
|
@@ -21136,55 +21279,6 @@ ${input.slice(result.pos)}
|
|
|
21136
21279
|
}, props2]
|
|
21137
21280
|
};
|
|
21138
21281
|
};
|
|
21139
|
-
function gatherNodes(node, predicate) {
|
|
21140
|
-
if (node == null)
|
|
21141
|
-
return [];
|
|
21142
|
-
if (Array.isArray(node)) {
|
|
21143
|
-
return node.flatMap((n) => gatherNodes(n, predicate));
|
|
21144
|
-
}
|
|
21145
|
-
if (predicate(node)) {
|
|
21146
|
-
return [node];
|
|
21147
|
-
}
|
|
21148
|
-
switch (node.type) {
|
|
21149
|
-
case "BlockStatement":
|
|
21150
|
-
return [];
|
|
21151
|
-
case "ForStatement":
|
|
21152
|
-
const isDec = node.declaration?.type === "Declaration";
|
|
21153
|
-
return node.children.flatMap((n) => {
|
|
21154
|
-
if (isDec && n === node.declaration)
|
|
21155
|
-
return [];
|
|
21156
|
-
return gatherNodes(n, predicate);
|
|
21157
|
-
});
|
|
21158
|
-
default:
|
|
21159
|
-
return gatherNodes(node.children, predicate);
|
|
21160
|
-
}
|
|
21161
|
-
return [];
|
|
21162
|
-
}
|
|
21163
|
-
function gatherRecursive(node, predicate, skipPredicate) {
|
|
21164
|
-
if (node == null)
|
|
21165
|
-
return [];
|
|
21166
|
-
if (Array.isArray(node)) {
|
|
21167
|
-
return node.flatMap((n) => gatherRecursive(n, predicate, skipPredicate));
|
|
21168
|
-
}
|
|
21169
|
-
if (skipPredicate?.(node))
|
|
21170
|
-
return [];
|
|
21171
|
-
if (predicate(node)) {
|
|
21172
|
-
return [node];
|
|
21173
|
-
}
|
|
21174
|
-
return gatherRecursive(node.children, predicate, skipPredicate);
|
|
21175
|
-
}
|
|
21176
|
-
function gatherRecursiveAll(node, predicate) {
|
|
21177
|
-
if (node == null)
|
|
21178
|
-
return [];
|
|
21179
|
-
if (Array.isArray(node)) {
|
|
21180
|
-
return node.flatMap((n) => gatherRecursiveAll(n, predicate));
|
|
21181
|
-
}
|
|
21182
|
-
const nodes = gatherRecursiveAll(node.children, predicate);
|
|
21183
|
-
if (predicate(node)) {
|
|
21184
|
-
nodes.push(node);
|
|
21185
|
-
}
|
|
21186
|
-
return nodes;
|
|
21187
|
-
}
|
|
21188
21282
|
function isFunction(node) {
|
|
21189
21283
|
const { type } = node;
|
|
21190
21284
|
return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
|
|
@@ -21210,43 +21304,6 @@ ${input.slice(result.pos)}
|
|
|
21210
21304
|
}
|
|
21211
21305
|
}
|
|
21212
21306
|
}
|
|
21213
|
-
function removeParentPointers(node) {
|
|
21214
|
-
if (node == null)
|
|
21215
|
-
return;
|
|
21216
|
-
if (typeof node !== "object")
|
|
21217
|
-
return;
|
|
21218
|
-
if (Array.isArray(node)) {
|
|
21219
|
-
for (const child of node) {
|
|
21220
|
-
removeParentPointers(child);
|
|
21221
|
-
}
|
|
21222
|
-
return;
|
|
21223
|
-
}
|
|
21224
|
-
node.parent = null;
|
|
21225
|
-
if (node.children) {
|
|
21226
|
-
for (const child of node.children) {
|
|
21227
|
-
removeParentPointers(child);
|
|
21228
|
-
}
|
|
21229
|
-
}
|
|
21230
|
-
}
|
|
21231
|
-
function clone(node) {
|
|
21232
|
-
removeParentPointers(node);
|
|
21233
|
-
return deepCopy(node);
|
|
21234
|
-
}
|
|
21235
|
-
function deepCopy(node) {
|
|
21236
|
-
if (node == null)
|
|
21237
|
-
return node;
|
|
21238
|
-
if (typeof node !== "object")
|
|
21239
|
-
return node;
|
|
21240
|
-
if (Array.isArray(node)) {
|
|
21241
|
-
return node.map(deepCopy);
|
|
21242
|
-
}
|
|
21243
|
-
return Object.fromEntries(
|
|
21244
|
-
Object.entries(node).map(([key, value]) => {
|
|
21245
|
-
return [key, deepCopy(value)];
|
|
21246
|
-
})
|
|
21247
|
-
);
|
|
21248
|
-
}
|
|
21249
|
-
module2.deepCopy = deepCopy;
|
|
21250
21307
|
function findAncestor(node, predicate, stopPredicate) {
|
|
21251
21308
|
node = node.parent;
|
|
21252
21309
|
while (node && !stopPredicate?.(node)) {
|
|
@@ -22209,8 +22266,12 @@ ${input.slice(result.pos)}
|
|
|
22209
22266
|
module2.gatherBindingCode = gatherBindingCode;
|
|
22210
22267
|
module2.constructInvocation = function(fn, arg) {
|
|
22211
22268
|
const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
|
|
22212
|
-
|
|
22213
|
-
|
|
22269
|
+
let expr = fn.expr;
|
|
22270
|
+
while (expr.type === "ParenthesizedExpression") {
|
|
22271
|
+
expr = expr.expression;
|
|
22272
|
+
}
|
|
22273
|
+
if (expr.ampersandBlock) {
|
|
22274
|
+
const { ref, body } = expr;
|
|
22214
22275
|
ref.type = "PipedExpression";
|
|
22215
22276
|
ref.children = [module2.makeLeftHandSideExpression(arg)];
|
|
22216
22277
|
return {
|
|
@@ -22218,7 +22279,8 @@ ${input.slice(result.pos)}
|
|
|
22218
22279
|
children: [module2.skipIfOnlyWS(fn.leadingComment), ...body, module2.skipIfOnlyWS(fn.trailingComment)]
|
|
22219
22280
|
};
|
|
22220
22281
|
}
|
|
22221
|
-
|
|
22282
|
+
expr = fn.expr;
|
|
22283
|
+
const lhs = module2.makeLeftHandSideExpression(expr);
|
|
22222
22284
|
let comment = module2.skipIfOnlyWS(fn.trailingComment);
|
|
22223
22285
|
if (comment)
|
|
22224
22286
|
lhs.children.splice(2, 0, comment);
|
|
@@ -22542,6 +22604,14 @@ ${input.slice(result.pos)}
|
|
|
22542
22604
|
}
|
|
22543
22605
|
exports.parse = parse2;
|
|
22544
22606
|
exports.default = { parse: parse2 };
|
|
22607
|
+
var {
|
|
22608
|
+
clone,
|
|
22609
|
+
deepCopy,
|
|
22610
|
+
gatherNodes,
|
|
22611
|
+
gatherRecursive,
|
|
22612
|
+
gatherRecursiveAll,
|
|
22613
|
+
removeParentPointers
|
|
22614
|
+
} = require_lib();
|
|
22545
22615
|
}
|
|
22546
22616
|
});
|
|
22547
22617
|
|