@danielx/civet 0.5.66 → 0.5.67
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 +140 -64
- package/dist/civet +0 -0
- package/dist/main.js +140 -64
- package/dist/main.mjs +140 -64
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -444,11 +444,12 @@ ${input.slice(result.pos)}
|
|
|
444
444
|
NonSuppressedTrailingMemberExpressions,
|
|
445
445
|
CommaDelimiter,
|
|
446
446
|
ArgumentList,
|
|
447
|
+
NonPipelineArgumentList,
|
|
447
448
|
NestedArgumentList,
|
|
448
449
|
NestedArgument,
|
|
449
|
-
InlineArgumentExpressions,
|
|
450
450
|
SingleLineArgumentExpressions,
|
|
451
451
|
ArgumentPart,
|
|
452
|
+
NonPipelineArgumentPart,
|
|
452
453
|
BinaryOpExpression,
|
|
453
454
|
BinaryOpRHS,
|
|
454
455
|
RHS,
|
|
@@ -1491,7 +1492,7 @@ ${input.slice(result.pos)}
|
|
|
1491
1492
|
return result;
|
|
1492
1493
|
}
|
|
1493
1494
|
}
|
|
1494
|
-
var ImplicitArguments$0 = $TS($S($E($S(TypeArguments, $N(ImplementsToken))), ApplicationStart, InsertOpenParen, $Q(_),
|
|
1495
|
+
var ImplicitArguments$0 = $TS($S($E($S(TypeArguments, $N(ImplementsToken))), ApplicationStart, InsertOpenParen, $Q(_), NonPipelineArgumentList, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
1495
1496
|
var ta = $1;
|
|
1496
1497
|
var open = $3;
|
|
1497
1498
|
var ws = $4;
|
|
@@ -1709,7 +1710,9 @@ ${input.slice(result.pos)}
|
|
|
1709
1710
|
return module.insertTrimmingSpace($1, "");
|
|
1710
1711
|
});
|
|
1711
1712
|
var ArgumentList$2 = NestedArgumentList;
|
|
1712
|
-
var ArgumentList$3 =
|
|
1713
|
+
var ArgumentList$3 = $TS($S($Q(TrailingComment), ArgumentPart, $Q($S(CommaDelimiter, $Q(TrailingComment), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
1714
|
+
return [...$1, $2, ...$3];
|
|
1715
|
+
});
|
|
1713
1716
|
function ArgumentList(state) {
|
|
1714
1717
|
let eventData;
|
|
1715
1718
|
if (state.events) {
|
|
@@ -1732,6 +1735,36 @@ ${input.slice(result.pos)}
|
|
|
1732
1735
|
return result;
|
|
1733
1736
|
}
|
|
1734
1737
|
}
|
|
1738
|
+
var NonPipelineArgumentList$0 = $S(NonPipelineArgumentPart, $P($S(CommaDelimiter, $C(NestedImplicitObjectLiteral, NestedArgumentList))));
|
|
1739
|
+
var NonPipelineArgumentList$1 = $TS($S(NestedImplicitObjectLiteral), function($skip, $loc, $0, $1) {
|
|
1740
|
+
return module.insertTrimmingSpace($1, "");
|
|
1741
|
+
});
|
|
1742
|
+
var NonPipelineArgumentList$2 = NestedArgumentList;
|
|
1743
|
+
var NonPipelineArgumentList$3 = $TS($S($Q(TrailingComment), NonPipelineArgumentPart, $Q($S(CommaDelimiter, $Q(TrailingComment), NonPipelineArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
1744
|
+
return [...$1, $2, ...$3];
|
|
1745
|
+
});
|
|
1746
|
+
function NonPipelineArgumentList(state) {
|
|
1747
|
+
let eventData;
|
|
1748
|
+
if (state.events) {
|
|
1749
|
+
const result = state.events.enter?.("NonPipelineArgumentList", state);
|
|
1750
|
+
if (result) {
|
|
1751
|
+
if (result.cache)
|
|
1752
|
+
return result.cache;
|
|
1753
|
+
eventData = result.data;
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
if (state.tokenize) {
|
|
1757
|
+
const result = $TOKEN("NonPipelineArgumentList", state, NonPipelineArgumentList$0(state) || NonPipelineArgumentList$1(state) || NonPipelineArgumentList$2(state) || NonPipelineArgumentList$3(state));
|
|
1758
|
+
if (state.events)
|
|
1759
|
+
state.events.exit?.("NonPipelineArgumentList", state, result, eventData);
|
|
1760
|
+
return result;
|
|
1761
|
+
} else {
|
|
1762
|
+
const result = NonPipelineArgumentList$0(state) || NonPipelineArgumentList$1(state) || NonPipelineArgumentList$2(state) || NonPipelineArgumentList$3(state);
|
|
1763
|
+
if (state.events)
|
|
1764
|
+
state.events.exit?.("NonPipelineArgumentList", state, result, eventData);
|
|
1765
|
+
return result;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1735
1768
|
var NestedArgumentList$0 = $TS($S(PushIndent, $Q(NestedArgument), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
1736
1769
|
var args = $2;
|
|
1737
1770
|
if (args.length)
|
|
@@ -1783,13 +1816,11 @@ ${input.slice(result.pos)}
|
|
|
1783
1816
|
return result;
|
|
1784
1817
|
}
|
|
1785
1818
|
}
|
|
1786
|
-
var
|
|
1787
|
-
|
|
1788
|
-
});
|
|
1789
|
-
function InlineArgumentExpressions(state) {
|
|
1819
|
+
var SingleLineArgumentExpressions$0 = $S($Q(TrailingComment), ArgumentPart, $Q($S($Q(TrailingComment), Comma, $Q(TrailingComment), ArgumentPart)));
|
|
1820
|
+
function SingleLineArgumentExpressions(state) {
|
|
1790
1821
|
let eventData;
|
|
1791
1822
|
if (state.events) {
|
|
1792
|
-
const result = state.events.enter?.("
|
|
1823
|
+
const result = state.events.enter?.("SingleLineArgumentExpressions", state);
|
|
1793
1824
|
if (result) {
|
|
1794
1825
|
if (result.cache)
|
|
1795
1826
|
return result.cache;
|
|
@@ -1797,22 +1828,28 @@ ${input.slice(result.pos)}
|
|
|
1797
1828
|
}
|
|
1798
1829
|
}
|
|
1799
1830
|
if (state.tokenize) {
|
|
1800
|
-
const result = $TOKEN("
|
|
1831
|
+
const result = $TOKEN("SingleLineArgumentExpressions", state, SingleLineArgumentExpressions$0(state));
|
|
1801
1832
|
if (state.events)
|
|
1802
|
-
state.events.exit?.("
|
|
1833
|
+
state.events.exit?.("SingleLineArgumentExpressions", state, result, eventData);
|
|
1803
1834
|
return result;
|
|
1804
1835
|
} else {
|
|
1805
|
-
const result =
|
|
1836
|
+
const result = SingleLineArgumentExpressions$0(state);
|
|
1806
1837
|
if (state.events)
|
|
1807
|
-
state.events.exit?.("
|
|
1838
|
+
state.events.exit?.("SingleLineArgumentExpressions", state, result, eventData);
|
|
1808
1839
|
return result;
|
|
1809
1840
|
}
|
|
1810
1841
|
}
|
|
1811
|
-
var
|
|
1812
|
-
|
|
1842
|
+
var ArgumentPart$0 = $S(DotDotDot, ExtendedExpression);
|
|
1843
|
+
var ArgumentPart$1 = $TS($S(ExtendedExpression, $E(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
1844
|
+
if ($2) {
|
|
1845
|
+
return [$2, $1];
|
|
1846
|
+
}
|
|
1847
|
+
return $1;
|
|
1848
|
+
});
|
|
1849
|
+
function ArgumentPart(state) {
|
|
1813
1850
|
let eventData;
|
|
1814
1851
|
if (state.events) {
|
|
1815
|
-
const result = state.events.enter?.("
|
|
1852
|
+
const result = state.events.enter?.("ArgumentPart", state);
|
|
1816
1853
|
if (result) {
|
|
1817
1854
|
if (result.cache)
|
|
1818
1855
|
return result.cache;
|
|
@@ -1820,28 +1857,28 @@ ${input.slice(result.pos)}
|
|
|
1820
1857
|
}
|
|
1821
1858
|
}
|
|
1822
1859
|
if (state.tokenize) {
|
|
1823
|
-
const result = $TOKEN("
|
|
1860
|
+
const result = $TOKEN("ArgumentPart", state, ArgumentPart$0(state) || ArgumentPart$1(state));
|
|
1824
1861
|
if (state.events)
|
|
1825
|
-
state.events.exit?.("
|
|
1862
|
+
state.events.exit?.("ArgumentPart", state, result, eventData);
|
|
1826
1863
|
return result;
|
|
1827
1864
|
} else {
|
|
1828
|
-
const result =
|
|
1865
|
+
const result = ArgumentPart$0(state) || ArgumentPart$1(state);
|
|
1829
1866
|
if (state.events)
|
|
1830
|
-
state.events.exit?.("
|
|
1867
|
+
state.events.exit?.("ArgumentPart", state, result, eventData);
|
|
1831
1868
|
return result;
|
|
1832
1869
|
}
|
|
1833
1870
|
}
|
|
1834
|
-
var
|
|
1835
|
-
var
|
|
1871
|
+
var NonPipelineArgumentPart$0 = $S(DotDotDot, NonPipelineExtendedExpression);
|
|
1872
|
+
var NonPipelineArgumentPart$1 = $TS($S(NonPipelineExtendedExpression, $E(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
1836
1873
|
if ($2) {
|
|
1837
1874
|
return [$2, $1];
|
|
1838
1875
|
}
|
|
1839
1876
|
return $1;
|
|
1840
1877
|
});
|
|
1841
|
-
function
|
|
1878
|
+
function NonPipelineArgumentPart(state) {
|
|
1842
1879
|
let eventData;
|
|
1843
1880
|
if (state.events) {
|
|
1844
|
-
const result = state.events.enter?.("
|
|
1881
|
+
const result = state.events.enter?.("NonPipelineArgumentPart", state);
|
|
1845
1882
|
if (result) {
|
|
1846
1883
|
if (result.cache)
|
|
1847
1884
|
return result.cache;
|
|
@@ -1849,14 +1886,14 @@ ${input.slice(result.pos)}
|
|
|
1849
1886
|
}
|
|
1850
1887
|
}
|
|
1851
1888
|
if (state.tokenize) {
|
|
1852
|
-
const result = $TOKEN("
|
|
1889
|
+
const result = $TOKEN("NonPipelineArgumentPart", state, NonPipelineArgumentPart$0(state) || NonPipelineArgumentPart$1(state));
|
|
1853
1890
|
if (state.events)
|
|
1854
|
-
state.events.exit?.("
|
|
1891
|
+
state.events.exit?.("NonPipelineArgumentPart", state, result, eventData);
|
|
1855
1892
|
return result;
|
|
1856
1893
|
} else {
|
|
1857
|
-
const result =
|
|
1894
|
+
const result = NonPipelineArgumentPart$0(state) || NonPipelineArgumentPart$1(state);
|
|
1858
1895
|
if (state.events)
|
|
1859
|
-
state.events.exit?.("
|
|
1896
|
+
state.events.exit?.("NonPipelineArgumentPart", state, result, eventData);
|
|
1860
1897
|
return result;
|
|
1861
1898
|
}
|
|
1862
1899
|
}
|
|
@@ -6286,17 +6323,8 @@ ${input.slice(result.pos)}
|
|
|
6286
6323
|
const inclusive = range.token === "..";
|
|
6287
6324
|
range.token = ",";
|
|
6288
6325
|
if (s.type === "Literal" && e.type === "Literal") {
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
start = s.raw.match(/^'(.*)'$/)[1];
|
|
6292
|
-
} else {
|
|
6293
|
-
start = JSON.parse(s.raw);
|
|
6294
|
-
}
|
|
6295
|
-
if (e.raw[0] === "'") {
|
|
6296
|
-
end = e.raw.match(/^'(.*)'$/)[1];
|
|
6297
|
-
} else {
|
|
6298
|
-
end = JSON.parse(e.raw);
|
|
6299
|
-
}
|
|
6326
|
+
const start = module.literalValue(s);
|
|
6327
|
+
const end = module.literalValue(e);
|
|
6300
6328
|
if (typeof start !== typeof end) {
|
|
6301
6329
|
throw new Error("Range start and end must be of the same type");
|
|
6302
6330
|
}
|
|
@@ -6964,6 +6992,7 @@ ${input.slice(result.pos)}
|
|
|
6964
6992
|
return $0.map(([prop, delim]) => {
|
|
6965
6993
|
return {
|
|
6966
6994
|
...prop,
|
|
6995
|
+
delim,
|
|
6967
6996
|
children: [...prop.children, delim]
|
|
6968
6997
|
};
|
|
6969
6998
|
});
|
|
@@ -7042,7 +7071,8 @@ ${input.slice(result.pos)}
|
|
|
7042
7071
|
type: "SpreadProperty",
|
|
7043
7072
|
children: [ws, dots, exp],
|
|
7044
7073
|
names: exp.names,
|
|
7045
|
-
|
|
7074
|
+
dots,
|
|
7075
|
+
value: exp
|
|
7046
7076
|
};
|
|
7047
7077
|
});
|
|
7048
7078
|
var PropertyDefinition$5 = $TS($S(__, CallExpression), function($skip, $loc, $0, $1, $2) {
|
|
@@ -15161,7 +15191,7 @@ ${input.slice(result.pos)}
|
|
|
15161
15191
|
}
|
|
15162
15192
|
break;
|
|
15163
15193
|
case "SpreadProperty":
|
|
15164
|
-
parts.push(["{", part.value, "}"]);
|
|
15194
|
+
parts.push(["{", part.dots, part.value, "}"]);
|
|
15165
15195
|
break;
|
|
15166
15196
|
case "MethodDefinition":
|
|
15167
15197
|
try {
|
|
@@ -18465,53 +18495,54 @@ ${input.slice(result.pos)}
|
|
|
18465
18495
|
children: [" as const"]
|
|
18466
18496
|
};
|
|
18467
18497
|
module.prelude = [];
|
|
18498
|
+
const preludeVar = "var ";
|
|
18468
18499
|
const declareRef = {
|
|
18469
18500
|
indexOf(indexOfRef) {
|
|
18470
18501
|
const typeSuffix = {
|
|
18471
18502
|
ts: true,
|
|
18472
18503
|
children: [": <T>(this: T[], searchElement: T) => boolean"]
|
|
18473
18504
|
};
|
|
18474
|
-
module.prelude.push(["", [
|
|
18505
|
+
module.prelude.push(["", [preludeVar, indexOfRef, typeSuffix, " = [].indexOf", module.asAny, ";\n"]]);
|
|
18475
18506
|
},
|
|
18476
18507
|
hasProp(hasPropRef) {
|
|
18477
18508
|
const typeSuffix = {
|
|
18478
18509
|
ts: true,
|
|
18479
18510
|
children: [": <T>(this: T, prop: keyof T) => boolean"]
|
|
18480
18511
|
};
|
|
18481
|
-
module.prelude.push(["", [
|
|
18512
|
+
module.prelude.push(["", [preludeVar, hasPropRef, typeSuffix, " = {}.hasOwnProperty", module.asAny, ";\n"]]);
|
|
18482
18513
|
},
|
|
18483
18514
|
is(isRef) {
|
|
18484
18515
|
const typeSuffix = {
|
|
18485
18516
|
ts: true,
|
|
18486
18517
|
children: [": { <B, A extends B> (a: A, b: B): b is A, <A, B> (a: A, b: B): a is A & B }"]
|
|
18487
18518
|
};
|
|
18488
|
-
module.prelude.push(["", [
|
|
18519
|
+
module.prelude.push(["", [preludeVar, isRef, typeSuffix, " = Object.is", module.asAny, ";\n"]]);
|
|
18489
18520
|
},
|
|
18490
18521
|
modulo(moduloRef) {
|
|
18491
18522
|
const typeSuffix = {
|
|
18492
18523
|
ts: true,
|
|
18493
18524
|
children: [": (a: number, b: number) => number"]
|
|
18494
18525
|
};
|
|
18495
|
-
module.prelude.push(["", [
|
|
18526
|
+
module.prelude.push(["", [preludeVar, moduloRef, typeSuffix, " = (a, b) => (a % b + b) % b;", "\n"]]);
|
|
18496
18527
|
},
|
|
18497
18528
|
xor(xorRef) {
|
|
18498
18529
|
const typeSuffix = {
|
|
18499
18530
|
ts: true,
|
|
18500
18531
|
children: [": (a: unknown, b: unknown) => boolean"]
|
|
18501
18532
|
};
|
|
18502
|
-
module.prelude.push(["", [
|
|
18533
|
+
module.prelude.push(["", [preludeVar, xorRef, typeSuffix, " = (a, b) => a ? !b && a : b;", "\n"]]);
|
|
18503
18534
|
},
|
|
18504
18535
|
xnor(xnorRef) {
|
|
18505
18536
|
const typeSuffix = {
|
|
18506
18537
|
ts: true,
|
|
18507
18538
|
children: [": (a: unknown, b: unknown) => boolean"]
|
|
18508
18539
|
};
|
|
18509
|
-
module.prelude.push(["", [
|
|
18540
|
+
module.prelude.push(["", [preludeVar, xnorRef, typeSuffix, " = (a, b) => a ? b : !b || a;", "\n"]]);
|
|
18510
18541
|
},
|
|
18511
18542
|
returnSymbol(ref) {
|
|
18512
18543
|
module.prelude.push({
|
|
18513
18544
|
children: [
|
|
18514
|
-
|
|
18545
|
+
preludeVar,
|
|
18515
18546
|
ref,
|
|
18516
18547
|
` = Symbol("return")';
|
|
18517
18548
|
`
|
|
@@ -18705,35 +18736,43 @@ ${input.slice(result.pos)}
|
|
|
18705
18736
|
const prefix = children.slice(0, i).concat(glob.children[0]);
|
|
18706
18737
|
const parts = [];
|
|
18707
18738
|
for (const part of glob.object.content) {
|
|
18708
|
-
if (part.type === "SpreadProperty") {
|
|
18709
|
-
throw new Error("Glob pattern cannot have ...spread property");
|
|
18710
|
-
}
|
|
18711
18739
|
if (part.type === "MethodDefinition") {
|
|
18712
18740
|
throw new Error("Glob pattern cannot have method definition");
|
|
18713
18741
|
}
|
|
18714
18742
|
if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
|
|
18715
18743
|
throw new Error("Glob pattern must have call or member expression value");
|
|
18716
18744
|
}
|
|
18717
|
-
const { name } = part;
|
|
18718
18745
|
let value = part.value ?? part.name;
|
|
18719
18746
|
const wValue = module.getTrimmingSpace(part.value);
|
|
18720
18747
|
value = prefix.concat(module.insertTrimmingSpace(value, ""));
|
|
18721
18748
|
if (wValue)
|
|
18722
18749
|
value.unshift(wValue);
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
value,
|
|
18727
|
-
names: part.names,
|
|
18728
|
-
children: [
|
|
18729
|
-
module.isWhitespaceOrEmpty(part.children[0]) && part.children[0],
|
|
18730
|
-
name,
|
|
18731
|
-
module.isWhitespaceOrEmpty(part.children[2]) && part.children[2],
|
|
18732
|
-
part.children[3]?.token === ":" ? part.children[3] : ":",
|
|
18750
|
+
if (part.type === "SpreadProperty") {
|
|
18751
|
+
parts.push({
|
|
18752
|
+
type: part.type,
|
|
18733
18753
|
value,
|
|
18734
|
-
part.
|
|
18735
|
-
|
|
18736
|
-
|
|
18754
|
+
dots: part.dots,
|
|
18755
|
+
delim: part.delim,
|
|
18756
|
+
names: part.names,
|
|
18757
|
+
children: part.children.slice(0, 2).concat(value, part.delim)
|
|
18758
|
+
});
|
|
18759
|
+
} else {
|
|
18760
|
+
parts.push({
|
|
18761
|
+
type: part.type,
|
|
18762
|
+
name: part.name,
|
|
18763
|
+
value,
|
|
18764
|
+
delim: part.delim,
|
|
18765
|
+
names: part.names,
|
|
18766
|
+
children: [
|
|
18767
|
+
module.isWhitespaceOrEmpty(part.children[0]) && part.children[0],
|
|
18768
|
+
part.name,
|
|
18769
|
+
module.isWhitespaceOrEmpty(part.children[2]) && part.children[2],
|
|
18770
|
+
part.children[3]?.token === ":" ? part.children[3] : ":",
|
|
18771
|
+
value,
|
|
18772
|
+
part.delim
|
|
18773
|
+
]
|
|
18774
|
+
});
|
|
18775
|
+
}
|
|
18737
18776
|
}
|
|
18738
18777
|
const object = {
|
|
18739
18778
|
type: "ObjectExpression",
|
|
@@ -18802,6 +18841,43 @@ ${input.slice(result.pos)}
|
|
|
18802
18841
|
return { children };
|
|
18803
18842
|
}
|
|
18804
18843
|
};
|
|
18844
|
+
module.literalValue = function(literal) {
|
|
18845
|
+
let { raw } = literal;
|
|
18846
|
+
switch (raw) {
|
|
18847
|
+
case "null":
|
|
18848
|
+
return null;
|
|
18849
|
+
case "true":
|
|
18850
|
+
return true;
|
|
18851
|
+
case "false":
|
|
18852
|
+
return false;
|
|
18853
|
+
}
|
|
18854
|
+
if (raw.startsWith('"') && raw.endsWith('"') || raw.startsWith("'") && raw.endsWith("'")) {
|
|
18855
|
+
return raw.slice(1, -1);
|
|
18856
|
+
}
|
|
18857
|
+
const numeric = literal.children.find(
|
|
18858
|
+
(child) => child.type === "NumericLiteral"
|
|
18859
|
+
);
|
|
18860
|
+
if (numeric) {
|
|
18861
|
+
raw = raw.replace(/_/g, "");
|
|
18862
|
+
const { token } = numeric;
|
|
18863
|
+
if (token.endsWith("n")) {
|
|
18864
|
+
return BigInt(raw.slice(0, -1));
|
|
18865
|
+
} else if (token.match(/[\.eE]/)) {
|
|
18866
|
+
return parseFloat(raw);
|
|
18867
|
+
} else if (token.startsWith("0")) {
|
|
18868
|
+
switch (token.charAt(1).toLowerCase()) {
|
|
18869
|
+
case "x":
|
|
18870
|
+
return parseInt(raw.replace(/0[xX]/, ""), 16);
|
|
18871
|
+
case "b":
|
|
18872
|
+
return parseInt(raw.replace(/0[bB]/, ""), 2);
|
|
18873
|
+
case "o":
|
|
18874
|
+
return parseInt(raw.replace(/0[oO]/, ""), 8);
|
|
18875
|
+
}
|
|
18876
|
+
}
|
|
18877
|
+
return parseInt(raw, 10);
|
|
18878
|
+
}
|
|
18879
|
+
throw new Error("Unrecognized literal " + JSON.stringify(literal));
|
|
18880
|
+
};
|
|
18805
18881
|
module.expressionizeIfClause = function(clause, b, e) {
|
|
18806
18882
|
const children = clause.children.slice(1);
|
|
18807
18883
|
children.push("?", b);
|
package/dist/civet
CHANGED
|
File without changes
|
package/dist/main.js
CHANGED
|
@@ -443,11 +443,12 @@ ${input.slice(result.pos)}
|
|
|
443
443
|
NonSuppressedTrailingMemberExpressions,
|
|
444
444
|
CommaDelimiter,
|
|
445
445
|
ArgumentList,
|
|
446
|
+
NonPipelineArgumentList,
|
|
446
447
|
NestedArgumentList,
|
|
447
448
|
NestedArgument,
|
|
448
|
-
InlineArgumentExpressions,
|
|
449
449
|
SingleLineArgumentExpressions,
|
|
450
450
|
ArgumentPart,
|
|
451
|
+
NonPipelineArgumentPart,
|
|
451
452
|
BinaryOpExpression,
|
|
452
453
|
BinaryOpRHS,
|
|
453
454
|
RHS,
|
|
@@ -1490,7 +1491,7 @@ ${input.slice(result.pos)}
|
|
|
1490
1491
|
return result;
|
|
1491
1492
|
}
|
|
1492
1493
|
}
|
|
1493
|
-
var ImplicitArguments$0 = $TS($S($E($S(TypeArguments, $N(ImplementsToken))), ApplicationStart, InsertOpenParen, $Q(_),
|
|
1494
|
+
var ImplicitArguments$0 = $TS($S($E($S(TypeArguments, $N(ImplementsToken))), ApplicationStart, InsertOpenParen, $Q(_), NonPipelineArgumentList, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
1494
1495
|
var ta = $1;
|
|
1495
1496
|
var open = $3;
|
|
1496
1497
|
var ws = $4;
|
|
@@ -1708,7 +1709,9 @@ ${input.slice(result.pos)}
|
|
|
1708
1709
|
return module2.insertTrimmingSpace($1, "");
|
|
1709
1710
|
});
|
|
1710
1711
|
var ArgumentList$2 = NestedArgumentList;
|
|
1711
|
-
var ArgumentList$3 =
|
|
1712
|
+
var ArgumentList$3 = $TS($S($Q(TrailingComment), ArgumentPart, $Q($S(CommaDelimiter, $Q(TrailingComment), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
1713
|
+
return [...$1, $2, ...$3];
|
|
1714
|
+
});
|
|
1712
1715
|
function ArgumentList(state) {
|
|
1713
1716
|
let eventData;
|
|
1714
1717
|
if (state.events) {
|
|
@@ -1731,6 +1734,36 @@ ${input.slice(result.pos)}
|
|
|
1731
1734
|
return result;
|
|
1732
1735
|
}
|
|
1733
1736
|
}
|
|
1737
|
+
var NonPipelineArgumentList$0 = $S(NonPipelineArgumentPart, $P($S(CommaDelimiter, $C(NestedImplicitObjectLiteral, NestedArgumentList))));
|
|
1738
|
+
var NonPipelineArgumentList$1 = $TS($S(NestedImplicitObjectLiteral), function($skip, $loc, $0, $1) {
|
|
1739
|
+
return module2.insertTrimmingSpace($1, "");
|
|
1740
|
+
});
|
|
1741
|
+
var NonPipelineArgumentList$2 = NestedArgumentList;
|
|
1742
|
+
var NonPipelineArgumentList$3 = $TS($S($Q(TrailingComment), NonPipelineArgumentPart, $Q($S(CommaDelimiter, $Q(TrailingComment), NonPipelineArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
1743
|
+
return [...$1, $2, ...$3];
|
|
1744
|
+
});
|
|
1745
|
+
function NonPipelineArgumentList(state) {
|
|
1746
|
+
let eventData;
|
|
1747
|
+
if (state.events) {
|
|
1748
|
+
const result = state.events.enter?.("NonPipelineArgumentList", state);
|
|
1749
|
+
if (result) {
|
|
1750
|
+
if (result.cache)
|
|
1751
|
+
return result.cache;
|
|
1752
|
+
eventData = result.data;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
if (state.tokenize) {
|
|
1756
|
+
const result = $TOKEN("NonPipelineArgumentList", state, NonPipelineArgumentList$0(state) || NonPipelineArgumentList$1(state) || NonPipelineArgumentList$2(state) || NonPipelineArgumentList$3(state));
|
|
1757
|
+
if (state.events)
|
|
1758
|
+
state.events.exit?.("NonPipelineArgumentList", state, result, eventData);
|
|
1759
|
+
return result;
|
|
1760
|
+
} else {
|
|
1761
|
+
const result = NonPipelineArgumentList$0(state) || NonPipelineArgumentList$1(state) || NonPipelineArgumentList$2(state) || NonPipelineArgumentList$3(state);
|
|
1762
|
+
if (state.events)
|
|
1763
|
+
state.events.exit?.("NonPipelineArgumentList", state, result, eventData);
|
|
1764
|
+
return result;
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1734
1767
|
var NestedArgumentList$0 = $TS($S(PushIndent, $Q(NestedArgument), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
1735
1768
|
var args = $2;
|
|
1736
1769
|
if (args.length)
|
|
@@ -1782,13 +1815,11 @@ ${input.slice(result.pos)}
|
|
|
1782
1815
|
return result;
|
|
1783
1816
|
}
|
|
1784
1817
|
}
|
|
1785
|
-
var
|
|
1786
|
-
|
|
1787
|
-
});
|
|
1788
|
-
function InlineArgumentExpressions(state) {
|
|
1818
|
+
var SingleLineArgumentExpressions$0 = $S($Q(TrailingComment), ArgumentPart, $Q($S($Q(TrailingComment), Comma, $Q(TrailingComment), ArgumentPart)));
|
|
1819
|
+
function SingleLineArgumentExpressions(state) {
|
|
1789
1820
|
let eventData;
|
|
1790
1821
|
if (state.events) {
|
|
1791
|
-
const result = state.events.enter?.("
|
|
1822
|
+
const result = state.events.enter?.("SingleLineArgumentExpressions", state);
|
|
1792
1823
|
if (result) {
|
|
1793
1824
|
if (result.cache)
|
|
1794
1825
|
return result.cache;
|
|
@@ -1796,22 +1827,28 @@ ${input.slice(result.pos)}
|
|
|
1796
1827
|
}
|
|
1797
1828
|
}
|
|
1798
1829
|
if (state.tokenize) {
|
|
1799
|
-
const result = $TOKEN("
|
|
1830
|
+
const result = $TOKEN("SingleLineArgumentExpressions", state, SingleLineArgumentExpressions$0(state));
|
|
1800
1831
|
if (state.events)
|
|
1801
|
-
state.events.exit?.("
|
|
1832
|
+
state.events.exit?.("SingleLineArgumentExpressions", state, result, eventData);
|
|
1802
1833
|
return result;
|
|
1803
1834
|
} else {
|
|
1804
|
-
const result =
|
|
1835
|
+
const result = SingleLineArgumentExpressions$0(state);
|
|
1805
1836
|
if (state.events)
|
|
1806
|
-
state.events.exit?.("
|
|
1837
|
+
state.events.exit?.("SingleLineArgumentExpressions", state, result, eventData);
|
|
1807
1838
|
return result;
|
|
1808
1839
|
}
|
|
1809
1840
|
}
|
|
1810
|
-
var
|
|
1811
|
-
|
|
1841
|
+
var ArgumentPart$0 = $S(DotDotDot, ExtendedExpression);
|
|
1842
|
+
var ArgumentPart$1 = $TS($S(ExtendedExpression, $E(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
1843
|
+
if ($2) {
|
|
1844
|
+
return [$2, $1];
|
|
1845
|
+
}
|
|
1846
|
+
return $1;
|
|
1847
|
+
});
|
|
1848
|
+
function ArgumentPart(state) {
|
|
1812
1849
|
let eventData;
|
|
1813
1850
|
if (state.events) {
|
|
1814
|
-
const result = state.events.enter?.("
|
|
1851
|
+
const result = state.events.enter?.("ArgumentPart", state);
|
|
1815
1852
|
if (result) {
|
|
1816
1853
|
if (result.cache)
|
|
1817
1854
|
return result.cache;
|
|
@@ -1819,28 +1856,28 @@ ${input.slice(result.pos)}
|
|
|
1819
1856
|
}
|
|
1820
1857
|
}
|
|
1821
1858
|
if (state.tokenize) {
|
|
1822
|
-
const result = $TOKEN("
|
|
1859
|
+
const result = $TOKEN("ArgumentPart", state, ArgumentPart$0(state) || ArgumentPart$1(state));
|
|
1823
1860
|
if (state.events)
|
|
1824
|
-
state.events.exit?.("
|
|
1861
|
+
state.events.exit?.("ArgumentPart", state, result, eventData);
|
|
1825
1862
|
return result;
|
|
1826
1863
|
} else {
|
|
1827
|
-
const result =
|
|
1864
|
+
const result = ArgumentPart$0(state) || ArgumentPart$1(state);
|
|
1828
1865
|
if (state.events)
|
|
1829
|
-
state.events.exit?.("
|
|
1866
|
+
state.events.exit?.("ArgumentPart", state, result, eventData);
|
|
1830
1867
|
return result;
|
|
1831
1868
|
}
|
|
1832
1869
|
}
|
|
1833
|
-
var
|
|
1834
|
-
var
|
|
1870
|
+
var NonPipelineArgumentPart$0 = $S(DotDotDot, NonPipelineExtendedExpression);
|
|
1871
|
+
var NonPipelineArgumentPart$1 = $TS($S(NonPipelineExtendedExpression, $E(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
1835
1872
|
if ($2) {
|
|
1836
1873
|
return [$2, $1];
|
|
1837
1874
|
}
|
|
1838
1875
|
return $1;
|
|
1839
1876
|
});
|
|
1840
|
-
function
|
|
1877
|
+
function NonPipelineArgumentPart(state) {
|
|
1841
1878
|
let eventData;
|
|
1842
1879
|
if (state.events) {
|
|
1843
|
-
const result = state.events.enter?.("
|
|
1880
|
+
const result = state.events.enter?.("NonPipelineArgumentPart", state);
|
|
1844
1881
|
if (result) {
|
|
1845
1882
|
if (result.cache)
|
|
1846
1883
|
return result.cache;
|
|
@@ -1848,14 +1885,14 @@ ${input.slice(result.pos)}
|
|
|
1848
1885
|
}
|
|
1849
1886
|
}
|
|
1850
1887
|
if (state.tokenize) {
|
|
1851
|
-
const result = $TOKEN("
|
|
1888
|
+
const result = $TOKEN("NonPipelineArgumentPart", state, NonPipelineArgumentPart$0(state) || NonPipelineArgumentPart$1(state));
|
|
1852
1889
|
if (state.events)
|
|
1853
|
-
state.events.exit?.("
|
|
1890
|
+
state.events.exit?.("NonPipelineArgumentPart", state, result, eventData);
|
|
1854
1891
|
return result;
|
|
1855
1892
|
} else {
|
|
1856
|
-
const result =
|
|
1893
|
+
const result = NonPipelineArgumentPart$0(state) || NonPipelineArgumentPart$1(state);
|
|
1857
1894
|
if (state.events)
|
|
1858
|
-
state.events.exit?.("
|
|
1895
|
+
state.events.exit?.("NonPipelineArgumentPart", state, result, eventData);
|
|
1859
1896
|
return result;
|
|
1860
1897
|
}
|
|
1861
1898
|
}
|
|
@@ -6285,17 +6322,8 @@ ${input.slice(result.pos)}
|
|
|
6285
6322
|
const inclusive = range.token === "..";
|
|
6286
6323
|
range.token = ",";
|
|
6287
6324
|
if (s.type === "Literal" && e.type === "Literal") {
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
start = s.raw.match(/^'(.*)'$/)[1];
|
|
6291
|
-
} else {
|
|
6292
|
-
start = JSON.parse(s.raw);
|
|
6293
|
-
}
|
|
6294
|
-
if (e.raw[0] === "'") {
|
|
6295
|
-
end = e.raw.match(/^'(.*)'$/)[1];
|
|
6296
|
-
} else {
|
|
6297
|
-
end = JSON.parse(e.raw);
|
|
6298
|
-
}
|
|
6325
|
+
const start = module2.literalValue(s);
|
|
6326
|
+
const end = module2.literalValue(e);
|
|
6299
6327
|
if (typeof start !== typeof end) {
|
|
6300
6328
|
throw new Error("Range start and end must be of the same type");
|
|
6301
6329
|
}
|
|
@@ -6963,6 +6991,7 @@ ${input.slice(result.pos)}
|
|
|
6963
6991
|
return $0.map(([prop, delim]) => {
|
|
6964
6992
|
return {
|
|
6965
6993
|
...prop,
|
|
6994
|
+
delim,
|
|
6966
6995
|
children: [...prop.children, delim]
|
|
6967
6996
|
};
|
|
6968
6997
|
});
|
|
@@ -7041,7 +7070,8 @@ ${input.slice(result.pos)}
|
|
|
7041
7070
|
type: "SpreadProperty",
|
|
7042
7071
|
children: [ws, dots, exp],
|
|
7043
7072
|
names: exp.names,
|
|
7044
|
-
|
|
7073
|
+
dots,
|
|
7074
|
+
value: exp
|
|
7045
7075
|
};
|
|
7046
7076
|
});
|
|
7047
7077
|
var PropertyDefinition$5 = $TS($S(__, CallExpression), function($skip, $loc, $0, $1, $2) {
|
|
@@ -15160,7 +15190,7 @@ ${input.slice(result.pos)}
|
|
|
15160
15190
|
}
|
|
15161
15191
|
break;
|
|
15162
15192
|
case "SpreadProperty":
|
|
15163
|
-
parts.push(["{", part.value, "}"]);
|
|
15193
|
+
parts.push(["{", part.dots, part.value, "}"]);
|
|
15164
15194
|
break;
|
|
15165
15195
|
case "MethodDefinition":
|
|
15166
15196
|
try {
|
|
@@ -18464,53 +18494,54 @@ ${input.slice(result.pos)}
|
|
|
18464
18494
|
children: [" as const"]
|
|
18465
18495
|
};
|
|
18466
18496
|
module2.prelude = [];
|
|
18497
|
+
const preludeVar = "var ";
|
|
18467
18498
|
const declareRef = {
|
|
18468
18499
|
indexOf(indexOfRef) {
|
|
18469
18500
|
const typeSuffix = {
|
|
18470
18501
|
ts: true,
|
|
18471
18502
|
children: [": <T>(this: T[], searchElement: T) => boolean"]
|
|
18472
18503
|
};
|
|
18473
|
-
module2.prelude.push(["", [
|
|
18504
|
+
module2.prelude.push(["", [preludeVar, indexOfRef, typeSuffix, " = [].indexOf", module2.asAny, ";\n"]]);
|
|
18474
18505
|
},
|
|
18475
18506
|
hasProp(hasPropRef) {
|
|
18476
18507
|
const typeSuffix = {
|
|
18477
18508
|
ts: true,
|
|
18478
18509
|
children: [": <T>(this: T, prop: keyof T) => boolean"]
|
|
18479
18510
|
};
|
|
18480
|
-
module2.prelude.push(["", [
|
|
18511
|
+
module2.prelude.push(["", [preludeVar, hasPropRef, typeSuffix, " = {}.hasOwnProperty", module2.asAny, ";\n"]]);
|
|
18481
18512
|
},
|
|
18482
18513
|
is(isRef) {
|
|
18483
18514
|
const typeSuffix = {
|
|
18484
18515
|
ts: true,
|
|
18485
18516
|
children: [": { <B, A extends B> (a: A, b: B): b is A, <A, B> (a: A, b: B): a is A & B }"]
|
|
18486
18517
|
};
|
|
18487
|
-
module2.prelude.push(["", [
|
|
18518
|
+
module2.prelude.push(["", [preludeVar, isRef, typeSuffix, " = Object.is", module2.asAny, ";\n"]]);
|
|
18488
18519
|
},
|
|
18489
18520
|
modulo(moduloRef) {
|
|
18490
18521
|
const typeSuffix = {
|
|
18491
18522
|
ts: true,
|
|
18492
18523
|
children: [": (a: number, b: number) => number"]
|
|
18493
18524
|
};
|
|
18494
|
-
module2.prelude.push(["", [
|
|
18525
|
+
module2.prelude.push(["", [preludeVar, moduloRef, typeSuffix, " = (a, b) => (a % b + b) % b;", "\n"]]);
|
|
18495
18526
|
},
|
|
18496
18527
|
xor(xorRef) {
|
|
18497
18528
|
const typeSuffix = {
|
|
18498
18529
|
ts: true,
|
|
18499
18530
|
children: [": (a: unknown, b: unknown) => boolean"]
|
|
18500
18531
|
};
|
|
18501
|
-
module2.prelude.push(["", [
|
|
18532
|
+
module2.prelude.push(["", [preludeVar, xorRef, typeSuffix, " = (a, b) => a ? !b && a : b;", "\n"]]);
|
|
18502
18533
|
},
|
|
18503
18534
|
xnor(xnorRef) {
|
|
18504
18535
|
const typeSuffix = {
|
|
18505
18536
|
ts: true,
|
|
18506
18537
|
children: [": (a: unknown, b: unknown) => boolean"]
|
|
18507
18538
|
};
|
|
18508
|
-
module2.prelude.push(["", [
|
|
18539
|
+
module2.prelude.push(["", [preludeVar, xnorRef, typeSuffix, " = (a, b) => a ? b : !b || a;", "\n"]]);
|
|
18509
18540
|
},
|
|
18510
18541
|
returnSymbol(ref) {
|
|
18511
18542
|
module2.prelude.push({
|
|
18512
18543
|
children: [
|
|
18513
|
-
|
|
18544
|
+
preludeVar,
|
|
18514
18545
|
ref,
|
|
18515
18546
|
` = Symbol("return")';
|
|
18516
18547
|
`
|
|
@@ -18704,35 +18735,43 @@ ${input.slice(result.pos)}
|
|
|
18704
18735
|
const prefix = children.slice(0, i).concat(glob.children[0]);
|
|
18705
18736
|
const parts = [];
|
|
18706
18737
|
for (const part of glob.object.content) {
|
|
18707
|
-
if (part.type === "SpreadProperty") {
|
|
18708
|
-
throw new Error("Glob pattern cannot have ...spread property");
|
|
18709
|
-
}
|
|
18710
18738
|
if (part.type === "MethodDefinition") {
|
|
18711
18739
|
throw new Error("Glob pattern cannot have method definition");
|
|
18712
18740
|
}
|
|
18713
18741
|
if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
|
|
18714
18742
|
throw new Error("Glob pattern must have call or member expression value");
|
|
18715
18743
|
}
|
|
18716
|
-
const { name } = part;
|
|
18717
18744
|
let value = part.value ?? part.name;
|
|
18718
18745
|
const wValue = module2.getTrimmingSpace(part.value);
|
|
18719
18746
|
value = prefix.concat(module2.insertTrimmingSpace(value, ""));
|
|
18720
18747
|
if (wValue)
|
|
18721
18748
|
value.unshift(wValue);
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
value,
|
|
18726
|
-
names: part.names,
|
|
18727
|
-
children: [
|
|
18728
|
-
module2.isWhitespaceOrEmpty(part.children[0]) && part.children[0],
|
|
18729
|
-
name,
|
|
18730
|
-
module2.isWhitespaceOrEmpty(part.children[2]) && part.children[2],
|
|
18731
|
-
part.children[3]?.token === ":" ? part.children[3] : ":",
|
|
18749
|
+
if (part.type === "SpreadProperty") {
|
|
18750
|
+
parts.push({
|
|
18751
|
+
type: part.type,
|
|
18732
18752
|
value,
|
|
18733
|
-
part.
|
|
18734
|
-
|
|
18735
|
-
|
|
18753
|
+
dots: part.dots,
|
|
18754
|
+
delim: part.delim,
|
|
18755
|
+
names: part.names,
|
|
18756
|
+
children: part.children.slice(0, 2).concat(value, part.delim)
|
|
18757
|
+
});
|
|
18758
|
+
} else {
|
|
18759
|
+
parts.push({
|
|
18760
|
+
type: part.type,
|
|
18761
|
+
name: part.name,
|
|
18762
|
+
value,
|
|
18763
|
+
delim: part.delim,
|
|
18764
|
+
names: part.names,
|
|
18765
|
+
children: [
|
|
18766
|
+
module2.isWhitespaceOrEmpty(part.children[0]) && part.children[0],
|
|
18767
|
+
part.name,
|
|
18768
|
+
module2.isWhitespaceOrEmpty(part.children[2]) && part.children[2],
|
|
18769
|
+
part.children[3]?.token === ":" ? part.children[3] : ":",
|
|
18770
|
+
value,
|
|
18771
|
+
part.delim
|
|
18772
|
+
]
|
|
18773
|
+
});
|
|
18774
|
+
}
|
|
18736
18775
|
}
|
|
18737
18776
|
const object = {
|
|
18738
18777
|
type: "ObjectExpression",
|
|
@@ -18801,6 +18840,43 @@ ${input.slice(result.pos)}
|
|
|
18801
18840
|
return { children };
|
|
18802
18841
|
}
|
|
18803
18842
|
};
|
|
18843
|
+
module2.literalValue = function(literal) {
|
|
18844
|
+
let { raw } = literal;
|
|
18845
|
+
switch (raw) {
|
|
18846
|
+
case "null":
|
|
18847
|
+
return null;
|
|
18848
|
+
case "true":
|
|
18849
|
+
return true;
|
|
18850
|
+
case "false":
|
|
18851
|
+
return false;
|
|
18852
|
+
}
|
|
18853
|
+
if (raw.startsWith('"') && raw.endsWith('"') || raw.startsWith("'") && raw.endsWith("'")) {
|
|
18854
|
+
return raw.slice(1, -1);
|
|
18855
|
+
}
|
|
18856
|
+
const numeric = literal.children.find(
|
|
18857
|
+
(child) => child.type === "NumericLiteral"
|
|
18858
|
+
);
|
|
18859
|
+
if (numeric) {
|
|
18860
|
+
raw = raw.replace(/_/g, "");
|
|
18861
|
+
const { token } = numeric;
|
|
18862
|
+
if (token.endsWith("n")) {
|
|
18863
|
+
return BigInt(raw.slice(0, -1));
|
|
18864
|
+
} else if (token.match(/[\.eE]/)) {
|
|
18865
|
+
return parseFloat(raw);
|
|
18866
|
+
} else if (token.startsWith("0")) {
|
|
18867
|
+
switch (token.charAt(1).toLowerCase()) {
|
|
18868
|
+
case "x":
|
|
18869
|
+
return parseInt(raw.replace(/0[xX]/, ""), 16);
|
|
18870
|
+
case "b":
|
|
18871
|
+
return parseInt(raw.replace(/0[bB]/, ""), 2);
|
|
18872
|
+
case "o":
|
|
18873
|
+
return parseInt(raw.replace(/0[oO]/, ""), 8);
|
|
18874
|
+
}
|
|
18875
|
+
}
|
|
18876
|
+
return parseInt(raw, 10);
|
|
18877
|
+
}
|
|
18878
|
+
throw new Error("Unrecognized literal " + JSON.stringify(literal));
|
|
18879
|
+
};
|
|
18804
18880
|
module2.expressionizeIfClause = function(clause, b, e) {
|
|
18805
18881
|
const children = clause.children.slice(1);
|
|
18806
18882
|
children.push("?", b);
|
package/dist/main.mjs
CHANGED
|
@@ -441,11 +441,12 @@ ${input.slice(result.pos)}
|
|
|
441
441
|
NonSuppressedTrailingMemberExpressions,
|
|
442
442
|
CommaDelimiter,
|
|
443
443
|
ArgumentList,
|
|
444
|
+
NonPipelineArgumentList,
|
|
444
445
|
NestedArgumentList,
|
|
445
446
|
NestedArgument,
|
|
446
|
-
InlineArgumentExpressions,
|
|
447
447
|
SingleLineArgumentExpressions,
|
|
448
448
|
ArgumentPart,
|
|
449
|
+
NonPipelineArgumentPart,
|
|
449
450
|
BinaryOpExpression,
|
|
450
451
|
BinaryOpRHS,
|
|
451
452
|
RHS,
|
|
@@ -1488,7 +1489,7 @@ ${input.slice(result.pos)}
|
|
|
1488
1489
|
return result;
|
|
1489
1490
|
}
|
|
1490
1491
|
}
|
|
1491
|
-
var ImplicitArguments$0 = $TS($S($E($S(TypeArguments, $N(ImplementsToken))), ApplicationStart, InsertOpenParen, $Q(_),
|
|
1492
|
+
var ImplicitArguments$0 = $TS($S($E($S(TypeArguments, $N(ImplementsToken))), ApplicationStart, InsertOpenParen, $Q(_), NonPipelineArgumentList, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
|
|
1492
1493
|
var ta = $1;
|
|
1493
1494
|
var open = $3;
|
|
1494
1495
|
var ws = $4;
|
|
@@ -1706,7 +1707,9 @@ ${input.slice(result.pos)}
|
|
|
1706
1707
|
return module.insertTrimmingSpace($1, "");
|
|
1707
1708
|
});
|
|
1708
1709
|
var ArgumentList$2 = NestedArgumentList;
|
|
1709
|
-
var ArgumentList$3 =
|
|
1710
|
+
var ArgumentList$3 = $TS($S($Q(TrailingComment), ArgumentPart, $Q($S(CommaDelimiter, $Q(TrailingComment), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
1711
|
+
return [...$1, $2, ...$3];
|
|
1712
|
+
});
|
|
1710
1713
|
function ArgumentList(state) {
|
|
1711
1714
|
let eventData;
|
|
1712
1715
|
if (state.events) {
|
|
@@ -1729,6 +1732,36 @@ ${input.slice(result.pos)}
|
|
|
1729
1732
|
return result;
|
|
1730
1733
|
}
|
|
1731
1734
|
}
|
|
1735
|
+
var NonPipelineArgumentList$0 = $S(NonPipelineArgumentPart, $P($S(CommaDelimiter, $C(NestedImplicitObjectLiteral, NestedArgumentList))));
|
|
1736
|
+
var NonPipelineArgumentList$1 = $TS($S(NestedImplicitObjectLiteral), function($skip, $loc, $0, $1) {
|
|
1737
|
+
return module.insertTrimmingSpace($1, "");
|
|
1738
|
+
});
|
|
1739
|
+
var NonPipelineArgumentList$2 = NestedArgumentList;
|
|
1740
|
+
var NonPipelineArgumentList$3 = $TS($S($Q(TrailingComment), NonPipelineArgumentPart, $Q($S(CommaDelimiter, $Q(TrailingComment), NonPipelineArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
|
|
1741
|
+
return [...$1, $2, ...$3];
|
|
1742
|
+
});
|
|
1743
|
+
function NonPipelineArgumentList(state) {
|
|
1744
|
+
let eventData;
|
|
1745
|
+
if (state.events) {
|
|
1746
|
+
const result = state.events.enter?.("NonPipelineArgumentList", state);
|
|
1747
|
+
if (result) {
|
|
1748
|
+
if (result.cache)
|
|
1749
|
+
return result.cache;
|
|
1750
|
+
eventData = result.data;
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
if (state.tokenize) {
|
|
1754
|
+
const result = $TOKEN("NonPipelineArgumentList", state, NonPipelineArgumentList$0(state) || NonPipelineArgumentList$1(state) || NonPipelineArgumentList$2(state) || NonPipelineArgumentList$3(state));
|
|
1755
|
+
if (state.events)
|
|
1756
|
+
state.events.exit?.("NonPipelineArgumentList", state, result, eventData);
|
|
1757
|
+
return result;
|
|
1758
|
+
} else {
|
|
1759
|
+
const result = NonPipelineArgumentList$0(state) || NonPipelineArgumentList$1(state) || NonPipelineArgumentList$2(state) || NonPipelineArgumentList$3(state);
|
|
1760
|
+
if (state.events)
|
|
1761
|
+
state.events.exit?.("NonPipelineArgumentList", state, result, eventData);
|
|
1762
|
+
return result;
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1732
1765
|
var NestedArgumentList$0 = $TS($S(PushIndent, $Q(NestedArgument), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
|
|
1733
1766
|
var args = $2;
|
|
1734
1767
|
if (args.length)
|
|
@@ -1780,13 +1813,11 @@ ${input.slice(result.pos)}
|
|
|
1780
1813
|
return result;
|
|
1781
1814
|
}
|
|
1782
1815
|
}
|
|
1783
|
-
var
|
|
1784
|
-
|
|
1785
|
-
});
|
|
1786
|
-
function InlineArgumentExpressions(state) {
|
|
1816
|
+
var SingleLineArgumentExpressions$0 = $S($Q(TrailingComment), ArgumentPart, $Q($S($Q(TrailingComment), Comma, $Q(TrailingComment), ArgumentPart)));
|
|
1817
|
+
function SingleLineArgumentExpressions(state) {
|
|
1787
1818
|
let eventData;
|
|
1788
1819
|
if (state.events) {
|
|
1789
|
-
const result = state.events.enter?.("
|
|
1820
|
+
const result = state.events.enter?.("SingleLineArgumentExpressions", state);
|
|
1790
1821
|
if (result) {
|
|
1791
1822
|
if (result.cache)
|
|
1792
1823
|
return result.cache;
|
|
@@ -1794,22 +1825,28 @@ ${input.slice(result.pos)}
|
|
|
1794
1825
|
}
|
|
1795
1826
|
}
|
|
1796
1827
|
if (state.tokenize) {
|
|
1797
|
-
const result = $TOKEN("
|
|
1828
|
+
const result = $TOKEN("SingleLineArgumentExpressions", state, SingleLineArgumentExpressions$0(state));
|
|
1798
1829
|
if (state.events)
|
|
1799
|
-
state.events.exit?.("
|
|
1830
|
+
state.events.exit?.("SingleLineArgumentExpressions", state, result, eventData);
|
|
1800
1831
|
return result;
|
|
1801
1832
|
} else {
|
|
1802
|
-
const result =
|
|
1833
|
+
const result = SingleLineArgumentExpressions$0(state);
|
|
1803
1834
|
if (state.events)
|
|
1804
|
-
state.events.exit?.("
|
|
1835
|
+
state.events.exit?.("SingleLineArgumentExpressions", state, result, eventData);
|
|
1805
1836
|
return result;
|
|
1806
1837
|
}
|
|
1807
1838
|
}
|
|
1808
|
-
var
|
|
1809
|
-
|
|
1839
|
+
var ArgumentPart$0 = $S(DotDotDot, ExtendedExpression);
|
|
1840
|
+
var ArgumentPart$1 = $TS($S(ExtendedExpression, $E(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
1841
|
+
if ($2) {
|
|
1842
|
+
return [$2, $1];
|
|
1843
|
+
}
|
|
1844
|
+
return $1;
|
|
1845
|
+
});
|
|
1846
|
+
function ArgumentPart(state) {
|
|
1810
1847
|
let eventData;
|
|
1811
1848
|
if (state.events) {
|
|
1812
|
-
const result = state.events.enter?.("
|
|
1849
|
+
const result = state.events.enter?.("ArgumentPart", state);
|
|
1813
1850
|
if (result) {
|
|
1814
1851
|
if (result.cache)
|
|
1815
1852
|
return result.cache;
|
|
@@ -1817,28 +1854,28 @@ ${input.slice(result.pos)}
|
|
|
1817
1854
|
}
|
|
1818
1855
|
}
|
|
1819
1856
|
if (state.tokenize) {
|
|
1820
|
-
const result = $TOKEN("
|
|
1857
|
+
const result = $TOKEN("ArgumentPart", state, ArgumentPart$0(state) || ArgumentPart$1(state));
|
|
1821
1858
|
if (state.events)
|
|
1822
|
-
state.events.exit?.("
|
|
1859
|
+
state.events.exit?.("ArgumentPart", state, result, eventData);
|
|
1823
1860
|
return result;
|
|
1824
1861
|
} else {
|
|
1825
|
-
const result =
|
|
1862
|
+
const result = ArgumentPart$0(state) || ArgumentPart$1(state);
|
|
1826
1863
|
if (state.events)
|
|
1827
|
-
state.events.exit?.("
|
|
1864
|
+
state.events.exit?.("ArgumentPart", state, result, eventData);
|
|
1828
1865
|
return result;
|
|
1829
1866
|
}
|
|
1830
1867
|
}
|
|
1831
|
-
var
|
|
1832
|
-
var
|
|
1868
|
+
var NonPipelineArgumentPart$0 = $S(DotDotDot, NonPipelineExtendedExpression);
|
|
1869
|
+
var NonPipelineArgumentPart$1 = $TS($S(NonPipelineExtendedExpression, $E(DotDotDot)), function($skip, $loc, $0, $1, $2) {
|
|
1833
1870
|
if ($2) {
|
|
1834
1871
|
return [$2, $1];
|
|
1835
1872
|
}
|
|
1836
1873
|
return $1;
|
|
1837
1874
|
});
|
|
1838
|
-
function
|
|
1875
|
+
function NonPipelineArgumentPart(state) {
|
|
1839
1876
|
let eventData;
|
|
1840
1877
|
if (state.events) {
|
|
1841
|
-
const result = state.events.enter?.("
|
|
1878
|
+
const result = state.events.enter?.("NonPipelineArgumentPart", state);
|
|
1842
1879
|
if (result) {
|
|
1843
1880
|
if (result.cache)
|
|
1844
1881
|
return result.cache;
|
|
@@ -1846,14 +1883,14 @@ ${input.slice(result.pos)}
|
|
|
1846
1883
|
}
|
|
1847
1884
|
}
|
|
1848
1885
|
if (state.tokenize) {
|
|
1849
|
-
const result = $TOKEN("
|
|
1886
|
+
const result = $TOKEN("NonPipelineArgumentPart", state, NonPipelineArgumentPart$0(state) || NonPipelineArgumentPart$1(state));
|
|
1850
1887
|
if (state.events)
|
|
1851
|
-
state.events.exit?.("
|
|
1888
|
+
state.events.exit?.("NonPipelineArgumentPart", state, result, eventData);
|
|
1852
1889
|
return result;
|
|
1853
1890
|
} else {
|
|
1854
|
-
const result =
|
|
1891
|
+
const result = NonPipelineArgumentPart$0(state) || NonPipelineArgumentPart$1(state);
|
|
1855
1892
|
if (state.events)
|
|
1856
|
-
state.events.exit?.("
|
|
1893
|
+
state.events.exit?.("NonPipelineArgumentPart", state, result, eventData);
|
|
1857
1894
|
return result;
|
|
1858
1895
|
}
|
|
1859
1896
|
}
|
|
@@ -6283,17 +6320,8 @@ ${input.slice(result.pos)}
|
|
|
6283
6320
|
const inclusive = range.token === "..";
|
|
6284
6321
|
range.token = ",";
|
|
6285
6322
|
if (s.type === "Literal" && e.type === "Literal") {
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
start = s.raw.match(/^'(.*)'$/)[1];
|
|
6289
|
-
} else {
|
|
6290
|
-
start = JSON.parse(s.raw);
|
|
6291
|
-
}
|
|
6292
|
-
if (e.raw[0] === "'") {
|
|
6293
|
-
end = e.raw.match(/^'(.*)'$/)[1];
|
|
6294
|
-
} else {
|
|
6295
|
-
end = JSON.parse(e.raw);
|
|
6296
|
-
}
|
|
6323
|
+
const start = module.literalValue(s);
|
|
6324
|
+
const end = module.literalValue(e);
|
|
6297
6325
|
if (typeof start !== typeof end) {
|
|
6298
6326
|
throw new Error("Range start and end must be of the same type");
|
|
6299
6327
|
}
|
|
@@ -6961,6 +6989,7 @@ ${input.slice(result.pos)}
|
|
|
6961
6989
|
return $0.map(([prop, delim]) => {
|
|
6962
6990
|
return {
|
|
6963
6991
|
...prop,
|
|
6992
|
+
delim,
|
|
6964
6993
|
children: [...prop.children, delim]
|
|
6965
6994
|
};
|
|
6966
6995
|
});
|
|
@@ -7039,7 +7068,8 @@ ${input.slice(result.pos)}
|
|
|
7039
7068
|
type: "SpreadProperty",
|
|
7040
7069
|
children: [ws, dots, exp],
|
|
7041
7070
|
names: exp.names,
|
|
7042
|
-
|
|
7071
|
+
dots,
|
|
7072
|
+
value: exp
|
|
7043
7073
|
};
|
|
7044
7074
|
});
|
|
7045
7075
|
var PropertyDefinition$5 = $TS($S(__, CallExpression), function($skip, $loc, $0, $1, $2) {
|
|
@@ -15158,7 +15188,7 @@ ${input.slice(result.pos)}
|
|
|
15158
15188
|
}
|
|
15159
15189
|
break;
|
|
15160
15190
|
case "SpreadProperty":
|
|
15161
|
-
parts.push(["{", part.value, "}"]);
|
|
15191
|
+
parts.push(["{", part.dots, part.value, "}"]);
|
|
15162
15192
|
break;
|
|
15163
15193
|
case "MethodDefinition":
|
|
15164
15194
|
try {
|
|
@@ -18462,53 +18492,54 @@ ${input.slice(result.pos)}
|
|
|
18462
18492
|
children: [" as const"]
|
|
18463
18493
|
};
|
|
18464
18494
|
module.prelude = [];
|
|
18495
|
+
const preludeVar = "var ";
|
|
18465
18496
|
const declareRef = {
|
|
18466
18497
|
indexOf(indexOfRef) {
|
|
18467
18498
|
const typeSuffix = {
|
|
18468
18499
|
ts: true,
|
|
18469
18500
|
children: [": <T>(this: T[], searchElement: T) => boolean"]
|
|
18470
18501
|
};
|
|
18471
|
-
module.prelude.push(["", [
|
|
18502
|
+
module.prelude.push(["", [preludeVar, indexOfRef, typeSuffix, " = [].indexOf", module.asAny, ";\n"]]);
|
|
18472
18503
|
},
|
|
18473
18504
|
hasProp(hasPropRef) {
|
|
18474
18505
|
const typeSuffix = {
|
|
18475
18506
|
ts: true,
|
|
18476
18507
|
children: [": <T>(this: T, prop: keyof T) => boolean"]
|
|
18477
18508
|
};
|
|
18478
|
-
module.prelude.push(["", [
|
|
18509
|
+
module.prelude.push(["", [preludeVar, hasPropRef, typeSuffix, " = {}.hasOwnProperty", module.asAny, ";\n"]]);
|
|
18479
18510
|
},
|
|
18480
18511
|
is(isRef) {
|
|
18481
18512
|
const typeSuffix = {
|
|
18482
18513
|
ts: true,
|
|
18483
18514
|
children: [": { <B, A extends B> (a: A, b: B): b is A, <A, B> (a: A, b: B): a is A & B }"]
|
|
18484
18515
|
};
|
|
18485
|
-
module.prelude.push(["", [
|
|
18516
|
+
module.prelude.push(["", [preludeVar, isRef, typeSuffix, " = Object.is", module.asAny, ";\n"]]);
|
|
18486
18517
|
},
|
|
18487
18518
|
modulo(moduloRef) {
|
|
18488
18519
|
const typeSuffix = {
|
|
18489
18520
|
ts: true,
|
|
18490
18521
|
children: [": (a: number, b: number) => number"]
|
|
18491
18522
|
};
|
|
18492
|
-
module.prelude.push(["", [
|
|
18523
|
+
module.prelude.push(["", [preludeVar, moduloRef, typeSuffix, " = (a, b) => (a % b + b) % b;", "\n"]]);
|
|
18493
18524
|
},
|
|
18494
18525
|
xor(xorRef) {
|
|
18495
18526
|
const typeSuffix = {
|
|
18496
18527
|
ts: true,
|
|
18497
18528
|
children: [": (a: unknown, b: unknown) => boolean"]
|
|
18498
18529
|
};
|
|
18499
|
-
module.prelude.push(["", [
|
|
18530
|
+
module.prelude.push(["", [preludeVar, xorRef, typeSuffix, " = (a, b) => a ? !b && a : b;", "\n"]]);
|
|
18500
18531
|
},
|
|
18501
18532
|
xnor(xnorRef) {
|
|
18502
18533
|
const typeSuffix = {
|
|
18503
18534
|
ts: true,
|
|
18504
18535
|
children: [": (a: unknown, b: unknown) => boolean"]
|
|
18505
18536
|
};
|
|
18506
|
-
module.prelude.push(["", [
|
|
18537
|
+
module.prelude.push(["", [preludeVar, xnorRef, typeSuffix, " = (a, b) => a ? b : !b || a;", "\n"]]);
|
|
18507
18538
|
},
|
|
18508
18539
|
returnSymbol(ref) {
|
|
18509
18540
|
module.prelude.push({
|
|
18510
18541
|
children: [
|
|
18511
|
-
|
|
18542
|
+
preludeVar,
|
|
18512
18543
|
ref,
|
|
18513
18544
|
` = Symbol("return")';
|
|
18514
18545
|
`
|
|
@@ -18702,35 +18733,43 @@ ${input.slice(result.pos)}
|
|
|
18702
18733
|
const prefix = children.slice(0, i).concat(glob.children[0]);
|
|
18703
18734
|
const parts = [];
|
|
18704
18735
|
for (const part of glob.object.content) {
|
|
18705
|
-
if (part.type === "SpreadProperty") {
|
|
18706
|
-
throw new Error("Glob pattern cannot have ...spread property");
|
|
18707
|
-
}
|
|
18708
18736
|
if (part.type === "MethodDefinition") {
|
|
18709
18737
|
throw new Error("Glob pattern cannot have method definition");
|
|
18710
18738
|
}
|
|
18711
18739
|
if (part.value && !["CallExpression", "MemberExpression", "Identifier"].includes(part.value.type)) {
|
|
18712
18740
|
throw new Error("Glob pattern must have call or member expression value");
|
|
18713
18741
|
}
|
|
18714
|
-
const { name } = part;
|
|
18715
18742
|
let value = part.value ?? part.name;
|
|
18716
18743
|
const wValue = module.getTrimmingSpace(part.value);
|
|
18717
18744
|
value = prefix.concat(module.insertTrimmingSpace(value, ""));
|
|
18718
18745
|
if (wValue)
|
|
18719
18746
|
value.unshift(wValue);
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
value,
|
|
18724
|
-
names: part.names,
|
|
18725
|
-
children: [
|
|
18726
|
-
module.isWhitespaceOrEmpty(part.children[0]) && part.children[0],
|
|
18727
|
-
name,
|
|
18728
|
-
module.isWhitespaceOrEmpty(part.children[2]) && part.children[2],
|
|
18729
|
-
part.children[3]?.token === ":" ? part.children[3] : ":",
|
|
18747
|
+
if (part.type === "SpreadProperty") {
|
|
18748
|
+
parts.push({
|
|
18749
|
+
type: part.type,
|
|
18730
18750
|
value,
|
|
18731
|
-
part.
|
|
18732
|
-
|
|
18733
|
-
|
|
18751
|
+
dots: part.dots,
|
|
18752
|
+
delim: part.delim,
|
|
18753
|
+
names: part.names,
|
|
18754
|
+
children: part.children.slice(0, 2).concat(value, part.delim)
|
|
18755
|
+
});
|
|
18756
|
+
} else {
|
|
18757
|
+
parts.push({
|
|
18758
|
+
type: part.type,
|
|
18759
|
+
name: part.name,
|
|
18760
|
+
value,
|
|
18761
|
+
delim: part.delim,
|
|
18762
|
+
names: part.names,
|
|
18763
|
+
children: [
|
|
18764
|
+
module.isWhitespaceOrEmpty(part.children[0]) && part.children[0],
|
|
18765
|
+
part.name,
|
|
18766
|
+
module.isWhitespaceOrEmpty(part.children[2]) && part.children[2],
|
|
18767
|
+
part.children[3]?.token === ":" ? part.children[3] : ":",
|
|
18768
|
+
value,
|
|
18769
|
+
part.delim
|
|
18770
|
+
]
|
|
18771
|
+
});
|
|
18772
|
+
}
|
|
18734
18773
|
}
|
|
18735
18774
|
const object = {
|
|
18736
18775
|
type: "ObjectExpression",
|
|
@@ -18799,6 +18838,43 @@ ${input.slice(result.pos)}
|
|
|
18799
18838
|
return { children };
|
|
18800
18839
|
}
|
|
18801
18840
|
};
|
|
18841
|
+
module.literalValue = function(literal) {
|
|
18842
|
+
let { raw } = literal;
|
|
18843
|
+
switch (raw) {
|
|
18844
|
+
case "null":
|
|
18845
|
+
return null;
|
|
18846
|
+
case "true":
|
|
18847
|
+
return true;
|
|
18848
|
+
case "false":
|
|
18849
|
+
return false;
|
|
18850
|
+
}
|
|
18851
|
+
if (raw.startsWith('"') && raw.endsWith('"') || raw.startsWith("'") && raw.endsWith("'")) {
|
|
18852
|
+
return raw.slice(1, -1);
|
|
18853
|
+
}
|
|
18854
|
+
const numeric = literal.children.find(
|
|
18855
|
+
(child) => child.type === "NumericLiteral"
|
|
18856
|
+
);
|
|
18857
|
+
if (numeric) {
|
|
18858
|
+
raw = raw.replace(/_/g, "");
|
|
18859
|
+
const { token } = numeric;
|
|
18860
|
+
if (token.endsWith("n")) {
|
|
18861
|
+
return BigInt(raw.slice(0, -1));
|
|
18862
|
+
} else if (token.match(/[\.eE]/)) {
|
|
18863
|
+
return parseFloat(raw);
|
|
18864
|
+
} else if (token.startsWith("0")) {
|
|
18865
|
+
switch (token.charAt(1).toLowerCase()) {
|
|
18866
|
+
case "x":
|
|
18867
|
+
return parseInt(raw.replace(/0[xX]/, ""), 16);
|
|
18868
|
+
case "b":
|
|
18869
|
+
return parseInt(raw.replace(/0[bB]/, ""), 2);
|
|
18870
|
+
case "o":
|
|
18871
|
+
return parseInt(raw.replace(/0[oO]/, ""), 8);
|
|
18872
|
+
}
|
|
18873
|
+
}
|
|
18874
|
+
return parseInt(raw, 10);
|
|
18875
|
+
}
|
|
18876
|
+
throw new Error("Unrecognized literal " + JSON.stringify(literal));
|
|
18877
|
+
};
|
|
18802
18878
|
module.expressionizeIfClause = function(clause, b, e) {
|
|
18803
18879
|
const children = clause.children.slice(1);
|
|
18804
18880
|
children.push("?", b);
|