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