@danielx/civet 0.8.4 → 0.8.6

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/main.mjs CHANGED
@@ -1038,6 +1038,9 @@ function makeLeftHandSideExpression(expression) {
1038
1038
  expression = item;
1039
1039
  }
1040
1040
  if (isASTNodeObject(expression)) {
1041
+ if (expression.token) {
1042
+ return expression;
1043
+ }
1041
1044
  if (expression.parenthesized) {
1042
1045
  return expression;
1043
1046
  }
@@ -1560,86 +1563,90 @@ function gatherBindingPatternTypeSuffix(pattern) {
1560
1563
  let count = 0;
1561
1564
  switch (pattern.type) {
1562
1565
  case "ArrayBindingPattern": {
1563
- const results = [];
1564
- for (let ref2 = pattern.elements, i2 = 0, len1 = ref2.length; i2 < len1; i2++) {
1565
- const elem = ref2[i2];
1566
- let { typeSuffix } = elem;
1567
- typeSuffix ??= elem.binding?.typeSuffix;
1568
- if (typeSuffix) {
1569
- count++;
1570
- }
1571
- let typeElement = [typeSuffix?.t, elem.delim];
1572
- if (typeSuffix?.optional) {
1573
- typeElement[0] = parenthesizeType(typeElement[0]);
1574
- typeElement.unshift("undefined |");
1566
+ {
1567
+ const results = [];
1568
+ for (let ref2 = pattern.elements, i2 = 0, len1 = ref2.length; i2 < len1; i2++) {
1569
+ const elem = ref2[i2];
1570
+ let { typeSuffix } = elem;
1571
+ typeSuffix ??= elem.binding?.typeSuffix;
1572
+ if (typeSuffix) {
1573
+ count++;
1574
+ }
1575
+ let typeElement = [typeSuffix?.t, elem.delim];
1576
+ if (typeSuffix?.optional) {
1577
+ typeElement[0] = parenthesizeType(typeElement[0]);
1578
+ typeElement.unshift("undefined |");
1579
+ }
1580
+ if (elem.type === "BindingRestElement") {
1581
+ typeElement[0] ??= "unknown[]";
1582
+ typeElement.unshift(elem.dots);
1583
+ } else {
1584
+ typeElement[0] ??= "unknown";
1585
+ }
1586
+ results.push(typeElement);
1575
1587
  }
1576
- if (elem.type === "BindingRestElement") {
1577
- typeElement[0] ??= "unknown[]";
1578
- typeElement.unshift(elem.dots);
1579
- } else {
1580
- typeElement[0] ??= "unknown";
1588
+ ;
1589
+ const types = results;
1590
+ if (count) {
1591
+ const t = [": [", types, "]"];
1592
+ pattern.typeSuffix = {
1593
+ type: "TypeSuffix",
1594
+ ts: true,
1595
+ t,
1596
+ children: [t]
1597
+ };
1581
1598
  }
1582
- results.push(typeElement);
1583
- }
1584
- ;
1585
- const types = results;
1586
- if (count) {
1587
- const t = [": [", types, "]"];
1588
- pattern.typeSuffix = {
1589
- type: "TypeSuffix",
1590
- ts: true,
1591
- t,
1592
- children: [t]
1593
- };
1594
1599
  }
1595
1600
  ;
1596
1601
  break;
1597
1602
  }
1598
1603
  case "ObjectBindingPattern": {
1599
- let restType;
1600
- const results1 = [];
1601
- for (let ref3 = pattern.properties, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1602
- const prop = ref3[i3];
1603
- let { typeSuffix } = prop;
1604
- typeSuffix ??= prop.value?.typeSuffix;
1605
- if (typeSuffix) {
1606
- count++;
1607
- }
1608
- typeSuffix ??= {
1609
- type: "TypeSuffix",
1610
- ts: true,
1611
- children: [": unknown"]
1612
- };
1613
- switch (prop.type) {
1614
- case "BindingProperty": {
1615
- const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
1616
- results1.push([...ws, prop.name, typeSuffix, prop.delim]);
1617
- break;
1618
- }
1619
- case "AtBindingProperty": {
1620
- const ws = prop.children.slice(0, prop.children.indexOf(prop.binding));
1621
- results1.push([...ws, prop.ref.id, typeSuffix, prop.delim]);
1622
- break;
1604
+ {
1605
+ let restType;
1606
+ const results1 = [];
1607
+ for (let ref3 = pattern.properties, i3 = 0, len22 = ref3.length; i3 < len22; i3++) {
1608
+ const prop = ref3[i3];
1609
+ let { typeSuffix } = prop;
1610
+ typeSuffix ??= prop.value?.typeSuffix;
1611
+ if (typeSuffix) {
1612
+ count++;
1623
1613
  }
1624
- case "BindingRestProperty": {
1625
- restType = prop.typeSuffix?.t;
1626
- continue;
1614
+ typeSuffix ??= {
1615
+ type: "TypeSuffix",
1616
+ ts: true,
1617
+ children: [": unknown"]
1618
+ };
1619
+ switch (prop.type) {
1620
+ case "BindingProperty": {
1621
+ const ws = prop.children.slice(0, prop.children.indexOf(prop.name));
1622
+ results1.push([...ws, prop.name, typeSuffix, prop.delim]);
1623
+ break;
1624
+ }
1625
+ case "AtBindingProperty": {
1626
+ const ws = prop.children.slice(0, prop.children.indexOf(prop.binding));
1627
+ results1.push([...ws, prop.ref.id, typeSuffix, prop.delim]);
1628
+ break;
1629
+ }
1630
+ case "BindingRestProperty": {
1631
+ restType = prop.typeSuffix?.t;
1632
+ continue;
1633
+ }
1627
1634
  }
1628
1635
  }
1629
- }
1630
- ;
1631
- const types = results1;
1632
- if (count) {
1633
- const t = ["{", types, "}"];
1634
- if (restType != null) {
1635
- t.push(" & ", parenthesizeType(trimFirstSpace(restType)));
1636
+ ;
1637
+ const types = results1;
1638
+ if (count) {
1639
+ const t = ["{", types, "}"];
1640
+ if (restType != null) {
1641
+ t.push(" & ", parenthesizeType(trimFirstSpace(restType)));
1642
+ }
1643
+ pattern.typeSuffix = {
1644
+ type: "TypeSuffix",
1645
+ ts: true,
1646
+ t,
1647
+ children: [": ", t]
1648
+ };
1636
1649
  }
1637
- pattern.typeSuffix = {
1638
- type: "TypeSuffix",
1639
- ts: true,
1640
- t,
1641
- children: [": ", t]
1642
- };
1643
1650
  }
1644
1651
  ;
1645
1652
  break;
@@ -1709,6 +1716,34 @@ var declareHelper = {
1709
1716
  "\n"
1710
1717
  ]]);
1711
1718
  },
1719
+ rslice(rsliceRef) {
1720
+ const RSliceable = makeRef("RSliceable");
1721
+ state.prelude.push(["", [
1722
+ ts(["type ", RSliceable, "<R> = string | {length: number; slice(start: number, end: number): {reverse(): R}}\n"]),
1723
+ preludeVar,
1724
+ rsliceRef,
1725
+ ts([": <R, T extends string | ", RSliceable, "<R>>(a: T, start?: number, end?: number) => T extends string ? string : T extends ", RSliceable, "<infer R> ? R : never"]),
1726
+ " = ((a, start, end) => {\n",
1727
+ " const l = a.length\n",
1728
+ " start = ",
1729
+ getHelperRef("modulo"),
1730
+ "(start ?? -1, l)\n",
1731
+ " end = ",
1732
+ getHelperRef("modulo"),
1733
+ "((end ?? -1) + 1, l)\n",
1734
+ " if (typeof a === 'string') {\n",
1735
+ ` let r = ""
1736
+ `,
1737
+ " for (let i = start; i >= end; --i) r += a[i]\n",
1738
+ " return r",
1739
+ asAny,
1740
+ "\n",
1741
+ " } else {\n",
1742
+ " return a.slice(end, start + 1).reverse()\n",
1743
+ " }\n",
1744
+ "});\n"
1745
+ ]]);
1746
+ },
1712
1747
  div(divRef) {
1713
1748
  state.prelude.push(["", [
1714
1749
  // [indent, statement]
@@ -1835,6 +1870,9 @@ function getHelperRef(base) {
1835
1870
  declareHelper[base](ref);
1836
1871
  return state.helperRefs[base] = ref;
1837
1872
  }
1873
+ function peekHelperRef(base) {
1874
+ return state.helperRefs[base];
1875
+ }
1838
1876
  function extractPreludeFor(node) {
1839
1877
  let helpers = new Set(Object.values(state.helperRefs));
1840
1878
  helpers = new Set(gatherRecursive(node, helpers.has.bind(helpers)));
@@ -5781,7 +5819,131 @@ function handleThisPrivateShorthands(value) {
5781
5819
  return [value, value.thisShorthand];
5782
5820
  }
5783
5821
  function processTryBlock($0) {
5784
- let [t, , b, c, e, f] = $0;
5822
+ let [t, , b, cs, e, f] = $0;
5823
+ let c;
5824
+ let m;
5825
+ if (cs.some(($) => (m = $.binding?.parameter, typeof m === "object" && m != null && "type" in m && m.type === "CatchPattern"))) {
5826
+ const ref = makeRef("e");
5827
+ const binding = {
5828
+ type: "CatchBinding",
5829
+ children: ["(", ref, ")"],
5830
+ parameter: ref
5831
+ };
5832
+ const condition = {
5833
+ type: "ParenthesizedExpression",
5834
+ children: ["(", ref, ")"],
5835
+ expression: ref
5836
+ };
5837
+ let defaultClause = false;
5838
+ const clauses = cs.map((clause) => {
5839
+ let ref1;
5840
+ if ((ref1 = clause.binding?.parameter) && typeof ref1 === "object" && "type" in ref1 && ref1.type === "CatchPattern" && "patterns" in ref1) {
5841
+ const { type, patterns } = ref1;
5842
+ return {
5843
+ type: "PatternClause",
5844
+ patterns,
5845
+ block: clause.block,
5846
+ children: [patterns, clause.block]
5847
+ };
5848
+ } else {
5849
+ defaultClause = true;
5850
+ const parameter = clause.binding?.parameter;
5851
+ if (parameter != null) {
5852
+ assert.equal(
5853
+ parameter.type,
5854
+ "CatchParameter",
5855
+ `Invalid catch parameter ${parameter.type}`
5856
+ );
5857
+ const { binding: pattern, typeSuffix } = parameter;
5858
+ const initializer = {
5859
+ type: "Initializer",
5860
+ expression: ref,
5861
+ children: ["", " = ", ref]
5862
+ };
5863
+ const bindings = [{
5864
+ type: "Binding",
5865
+ names: pattern.names,
5866
+ pattern,
5867
+ typeSuffix,
5868
+ initializer,
5869
+ children: [pattern, typeSuffix, initializer],
5870
+ splices: [],
5871
+ thisAssignments: []
5872
+ }];
5873
+ clause.block.expressions.unshift(["", {
5874
+ type: "Declaration",
5875
+ children: ["let", " ", bindings],
5876
+ bindings,
5877
+ names: bindings[0].names,
5878
+ decl: "let"
5879
+ }, ";"]);
5880
+ }
5881
+ return {
5882
+ type: "DefaultClause",
5883
+ block: clause.block,
5884
+ children: ["default: ", clause.block]
5885
+ };
5886
+ }
5887
+ });
5888
+ if (!defaultClause) {
5889
+ const expressions = [[
5890
+ "",
5891
+ {
5892
+ type: "ThrowStatement",
5893
+ children: ["throw", " ", ref]
5894
+ }
5895
+ ]];
5896
+ const block2 = {
5897
+ type: "BlockStatement",
5898
+ expressions,
5899
+ children: [" {", expressions, "}"],
5900
+ bare: false
5901
+ };
5902
+ clauses.push({
5903
+ type: "DefaultClause",
5904
+ block: block2,
5905
+ children: ["default: ", block2]
5906
+ });
5907
+ }
5908
+ const caseBlock = {
5909
+ type: "CaseBlock",
5910
+ clauses,
5911
+ children: [" {", clauses, "}"]
5912
+ };
5913
+ const patternSwitch = {
5914
+ type: "SwitchStatement",
5915
+ condition,
5916
+ caseBlock,
5917
+ children: ["switch", condition, caseBlock]
5918
+ };
5919
+ const block = {
5920
+ type: "BlockStatement",
5921
+ bare: false,
5922
+ expressions: [["", patternSwitch]],
5923
+ children: [" {", patternSwitch, "}"]
5924
+ };
5925
+ c = makeNode({
5926
+ type: "CatchClause",
5927
+ children: [
5928
+ cs[0].children[0],
5929
+ // whitespace
5930
+ cs[0].children[1],
5931
+ // catch token
5932
+ binding,
5933
+ block
5934
+ ],
5935
+ binding,
5936
+ block
5937
+ });
5938
+ } else {
5939
+ c = cs[0];
5940
+ if (cs.length > 1) {
5941
+ c = append(c, {
5942
+ type: "Error",
5943
+ message: "Only one catch clause allowed unless using pattern matching"
5944
+ });
5945
+ }
5946
+ }
5785
5947
  if (!c && (e || !f)) {
5786
5948
  const emptyCatchBlock = makeEmptyBlock();
5787
5949
  c = {
@@ -5880,8 +6042,9 @@ function processCallMemberExpression(node) {
5880
6042
  }
5881
6043
  }
5882
6044
  }
5883
- for (let i = 0; i < children.length; i++) {
5884
- const glob = children[i];
6045
+ for (let i3 = 0, len22 = children.length; i3 < len22; i3++) {
6046
+ const i = i3;
6047
+ const glob = children[i3];
5885
6048
  if (glob?.type === "PropertyGlob") {
5886
6049
  let prefix = children.slice(0, i);
5887
6050
  const parts = [];
@@ -5952,14 +6115,14 @@ function processCallMemberExpression(node) {
5952
6115
  });
5953
6116
  }
5954
6117
  }
5955
- let ref1;
6118
+ let ref2;
5956
6119
  let object = {
5957
6120
  type: "ObjectExpression",
5958
6121
  children: [
5959
6122
  glob.object.children[0],
5960
6123
  // {
5961
6124
  ...parts,
5962
- (ref1 = glob.object.children)[ref1.length - 1]
6125
+ (ref2 = glob.object.children)[ref2.length - 1]
5963
6126
  // whitespace and }
5964
6127
  ],
5965
6128
  properties: parts,
@@ -6001,6 +6164,33 @@ function processCallMemberExpression(node) {
6001
6164
  ...children.slice(i + 1)
6002
6165
  ]
6003
6166
  });
6167
+ } else if (typeof glob === "object" && glob != null && "type" in glob && glob.type === "SliceExpression" && "reversed" in glob && glob.reversed === true) {
6168
+ const args = [
6169
+ { ...node, children: node.children.slice(0, i) },
6170
+ { ...glob.children[0], token: ", " },
6171
+ ...glob.children.slice(1, -1)
6172
+ ];
6173
+ let ref3;
6174
+ return makeNode({
6175
+ ...node,
6176
+ children: [
6177
+ {
6178
+ type: "CallExpression",
6179
+ children: [
6180
+ getHelperRef("rslice"),
6181
+ makeNode({
6182
+ type: "Call",
6183
+ args,
6184
+ children: [
6185
+ "(",
6186
+ args,
6187
+ (ref3 = glob.children)[ref3.length - 1]
6188
+ ]
6189
+ })
6190
+ ]
6191
+ }
6192
+ ]
6193
+ });
6004
6194
  }
6005
6195
  }
6006
6196
  return node;
@@ -6011,9 +6201,9 @@ function replaceNode(node, newNode, parent) {
6011
6201
  throw new Error("replaceNode failed: node has no parent");
6012
6202
  }
6013
6203
  function recurse(children) {
6014
- for (let i3 = 0, len22 = children.length; i3 < len22; i3++) {
6015
- const i = i3;
6016
- const child = children[i3];
6204
+ for (let i4 = 0, len3 = children.length; i4 < len3; i4++) {
6205
+ const i = i4;
6206
+ const child = children[i4];
6017
6207
  if (child === node) {
6018
6208
  children[i] = newNode;
6019
6209
  return true;
@@ -6105,8 +6295,8 @@ function convertNamedImportsToObject(node, pattern) {
6105
6295
  return { type: "Error", message: "cannot use `type` in dynamic import" };
6106
6296
  } else {
6107
6297
  const { source, binding } = specifier;
6108
- let ref2;
6109
- const delim = (ref2 = specifier.children)[ref2.length - 1];
6298
+ let ref4;
6299
+ const delim = (ref4 = specifier.children)[ref4.length - 1];
6110
6300
  return {
6111
6301
  type: pattern ? "BindingProperty" : "Property",
6112
6302
  name: source,
@@ -6116,7 +6306,7 @@ function convertNamedImportsToObject(node, pattern) {
6116
6306
  };
6117
6307
  }
6118
6308
  });
6119
- let ref3;
6309
+ let ref5;
6120
6310
  return {
6121
6311
  type: pattern ? "ObjectBindingPattern" : "ObjectExpression",
6122
6312
  names: node.names,
@@ -6125,7 +6315,7 @@ function convertNamedImportsToObject(node, pattern) {
6125
6315
  node.children[0],
6126
6316
  // {
6127
6317
  properties,
6128
- (ref3 = node.children)[ref3.length - 1]
6318
+ (ref5 = node.children)[ref5.length - 1]
6129
6319
  // }
6130
6320
  ]
6131
6321
  };
@@ -6231,8 +6421,8 @@ function processAssignments(statements) {
6231
6421
  while (expr.type === "ParenthesizedExpression") {
6232
6422
  expr = expr.expression;
6233
6423
  }
6234
- let m;
6235
- if (m = expr.type, m === "AssignmentExpression" || m === "UpdateExpression") {
6424
+ let m1;
6425
+ if (m1 = expr.type, m1 === "AssignmentExpression" || m1 === "UpdateExpression") {
6236
6426
  if (expr.type === "UpdateExpression" && expr.children[0] === expr.assigned) {
6237
6427
  pre.push("(");
6238
6428
  post.push([", ", lhs, ")"]);
@@ -6246,15 +6436,15 @@ function processAssignments(statements) {
6246
6436
  return;
6247
6437
  }
6248
6438
  const pre = [], post = [];
6249
- let ref4;
6439
+ let ref6;
6250
6440
  switch (exp.type) {
6251
6441
  case "AssignmentExpression": {
6252
6442
  if (!exp.lhs)
6253
6443
  return;
6254
6444
  exp.lhs.forEach((lhsPart, i) => {
6255
- let ref5;
6256
- if (ref5 = extractAssignment(lhsPart[1])) {
6257
- const newLhs = ref5;
6445
+ let ref7;
6446
+ if (ref7 = extractAssignment(lhsPart[1])) {
6447
+ const newLhs = ref7;
6258
6448
  return lhsPart[1] = newLhs;
6259
6449
  }
6260
6450
  ;
@@ -6263,8 +6453,8 @@ function processAssignments(statements) {
6263
6453
  break;
6264
6454
  }
6265
6455
  case "UpdateExpression": {
6266
- if (ref4 = extractAssignment(exp.assigned)) {
6267
- const newLhs = ref4;
6456
+ if (ref6 = extractAssignment(exp.assigned)) {
6457
+ const newLhs = ref6;
6268
6458
  const i = exp.children.indexOf(exp.assigned);
6269
6459
  exp.assigned = exp.children[i] = newLhs;
6270
6460
  }
@@ -6280,7 +6470,7 @@ function processAssignments(statements) {
6280
6470
  const { assigned } = exp;
6281
6471
  const ref = makeRef();
6282
6472
  const newMemberExp = unchainOptionalMemberExpression(assigned, ref, (children) => {
6283
- return exp.children.map(($) => $ === assigned ? children : $);
6473
+ return exp.children.map(($3) => $3 === assigned ? children : $3);
6284
6474
  });
6285
6475
  if (newMemberExp !== assigned) {
6286
6476
  if (newMemberExp.usesRef) {
@@ -6304,23 +6494,23 @@ function processAssignments(statements) {
6304
6494
  (exp) => {
6305
6495
  let { lhs: $1, expression: $2 } = exp, tail = [], len3 = $1.length;
6306
6496
  let block;
6307
- let ref6;
6308
- if (exp.parent?.type === "BlockStatement" && !(ref6 = $1[$1.length - 1])?.[ref6.length - 1]?.special) {
6497
+ let ref8;
6498
+ if (exp.parent?.type === "BlockStatement" && !(ref8 = $1[$1.length - 1])?.[ref8.length - 1]?.special) {
6309
6499
  block = makeBlockFragment();
6310
- let ref7;
6311
- if (ref7 = prependStatementExpressionBlock(
6500
+ let ref9;
6501
+ if (ref9 = prependStatementExpressionBlock(
6312
6502
  { type: "Initializer", expression: $2, children: [void 0, void 0, $2] },
6313
6503
  block
6314
6504
  )) {
6315
- const ref = ref7;
6316
- exp.children = exp.children.map(($3) => $3 === $2 ? ref : $3);
6505
+ const ref = ref9;
6506
+ exp.children = exp.children.map(($4) => $4 === $2 ? ref : $4);
6317
6507
  $2 = ref;
6318
6508
  } else {
6319
6509
  block = void 0;
6320
6510
  }
6321
6511
  }
6322
- let ref8;
6323
- if ($1.some(($4) => (ref8 = $4)[ref8.length - 1].special)) {
6512
+ let ref10;
6513
+ if ($1.some(($5) => (ref10 = $5)[ref10.length - 1].special)) {
6324
6514
  if ($1.length !== 1)
6325
6515
  throw new Error("Only one assignment with id= is allowed");
6326
6516
  const [, lhs, , op] = $1[0];
@@ -6345,8 +6535,8 @@ function processAssignments(statements) {
6345
6535
  if (!(op.token === "=")) {
6346
6536
  continue;
6347
6537
  }
6348
- let m1;
6349
- if (m1 = lhs.type, m1 === "ObjectExpression" || m1 === "ObjectBindingPattern") {
6538
+ let m2;
6539
+ if (m2 = lhs.type, m2 === "ObjectExpression" || m2 === "ObjectBindingPattern") {
6350
6540
  if (!wrapped) {
6351
6541
  wrapped = true;
6352
6542
  lhs.children.splice(0, 0, "(");
@@ -6360,10 +6550,17 @@ function processAssignments(statements) {
6360
6550
  const lastAssignment = $1[i];
6361
6551
  if (lastAssignment[3].token === "=") {
6362
6552
  const lhs = lastAssignment[1];
6363
- let m2;
6553
+ let m3;
6364
6554
  if (lhs.type === "MemberExpression") {
6365
6555
  const members = lhs.children;
6366
6556
  const lastMember = members[members.length - 1];
6557
+ if (typeof lastMember === "object" && lastMember != null && "type" in lastMember && lastMember.type === "CallExpression" && "children" in lastMember && Array.isArray(lastMember.children) && lastMember.children.length >= 1 && lastMember.children[0] === peekHelperRef("rslice")) {
6558
+ lastMember.children.push({
6559
+ type: "Error",
6560
+ message: "Slice range cannot be decreasing in assignment"
6561
+ });
6562
+ break;
6563
+ }
6367
6564
  if (lastMember.type === "SliceExpression") {
6368
6565
  const { start, end, children: c } = lastMember;
6369
6566
  c[0].token = ".splice(";
@@ -6386,9 +6583,9 @@ function processAssignments(statements) {
6386
6583
  exp.names = [];
6387
6584
  break;
6388
6585
  }
6389
- } else if (m2 = lhs.type, m2 === "ObjectBindingPattern" || m2 === "ArrayBindingPattern") {
6586
+ } else if (m3 = lhs.type, m3 === "ObjectBindingPattern" || m3 === "ArrayBindingPattern") {
6390
6587
  processBindingPatternLHS(lhs, tail);
6391
- gatherRecursiveAll(lhs, ($5) => $5.type === "Ref").forEach(refsToDeclare.add.bind(refsToDeclare));
6588
+ gatherRecursiveAll(lhs, ($6) => $6.type === "Ref").forEach(refsToDeclare.add.bind(refsToDeclare));
6392
6589
  }
6393
6590
  }
6394
6591
  i--;
@@ -6421,7 +6618,7 @@ function processAssignments(statements) {
6421
6618
  }
6422
6619
  if (refsToDeclare.size) {
6423
6620
  if (exp.hoistDec) {
6424
- exp.hoistDec.children.push([...refsToDeclare].map(($6) => [",", $6]));
6621
+ exp.hoistDec.children.push([...refsToDeclare].map(($7) => [",", $7]));
6425
6622
  } else {
6426
6623
  exp.hoistDec = {
6427
6624
  type: "Declaration",
@@ -6495,9 +6692,9 @@ function unchainOptionalMemberExpression(exp, ref, innerExp) {
6495
6692
  }
6496
6693
  j++;
6497
6694
  }
6498
- let ref9;
6499
- if (ref9 = conditions.length) {
6500
- const l = ref9;
6695
+ let ref11;
6696
+ if (ref11 = conditions.length) {
6697
+ const l = ref11;
6501
6698
  const cs = flatJoin(conditions, " && ");
6502
6699
  return {
6503
6700
  ...exp,
@@ -6536,27 +6733,27 @@ function processTypes(node) {
6536
6733
  if (!unary.suffix.length) {
6537
6734
  return;
6538
6735
  }
6539
- let ref10;
6540
- let m3;
6541
- if (m3 = (ref10 = unary.suffix)[ref10.length - 1], typeof m3 === "object" && m3 != null && "token" in m3 && m3.token === "?") {
6542
- const { token } = m3;
6736
+ let ref12;
6737
+ let m4;
6738
+ if (m4 = (ref12 = unary.suffix)[ref12.length - 1], typeof m4 === "object" && m4 != null && "token" in m4 && m4.token === "?") {
6739
+ const { token } = m4;
6543
6740
  let last;
6544
6741
  let count = 0;
6545
- let ref11;
6546
- while (unary.suffix.length && (ref11 = unary.suffix)[ref11.length - 1]?.token === "?") {
6742
+ let ref13;
6743
+ while (unary.suffix.length && (ref13 = unary.suffix)[ref13.length - 1]?.token === "?") {
6547
6744
  last = unary.suffix.pop();
6548
6745
  count++;
6549
6746
  }
6550
- let ref12;
6551
- while (unary.suffix.length && (ref12 = unary.suffix)[ref12.length - 1]?.type === "NonNullAssertion") {
6747
+ let ref14;
6748
+ while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
6552
6749
  unary.suffix.pop();
6553
6750
  }
6554
- let ref13;
6751
+ let ref15;
6555
6752
  if (unary.suffix.length || unary.prefix.length)
6556
- ref13 = unary;
6753
+ ref15 = unary;
6557
6754
  else
6558
- ref13 = unary.t;
6559
- const t = ref13;
6755
+ ref15 = unary.t;
6756
+ const t = ref15;
6560
6757
  if (unary.parent?.type === "TypeTuple") {
6561
6758
  if (count === 1) {
6562
6759
  unary.suffix.push(last);
@@ -6582,14 +6779,14 @@ function processTypes(node) {
6582
6779
  ]
6583
6780
  });
6584
6781
  }
6585
- } else if (typeof m3 === "object" && m3 != null && "type" in m3 && m3.type === "NonNullAssertion") {
6586
- const { type } = m3;
6587
- let ref14;
6588
- while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
6782
+ } else if (typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "NonNullAssertion") {
6783
+ const { type } = m4;
6784
+ let ref16;
6785
+ while (unary.suffix.length && (ref16 = unary.suffix)[ref16.length - 1]?.type === "NonNullAssertion") {
6589
6786
  unary.suffix.pop();
6590
6787
  }
6591
- let ref15;
6592
- while (unary.suffix.length && (ref15 = unary.suffix)[ref15.length - 1]?.token === "?") {
6788
+ let ref17;
6789
+ while (unary.suffix.length && (ref17 = unary.suffix)[ref17.length - 1]?.token === "?") {
6593
6790
  unary.suffix.pop();
6594
6791
  }
6595
6792
  const t = trimFirstSpace(
@@ -6615,14 +6812,14 @@ function processTypes(node) {
6615
6812
  });
6616
6813
  }
6617
6814
  function processStatementExpressions(statements) {
6618
- gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
6815
+ gatherRecursiveAll(statements, ($8) => $8.type === "StatementExpression").forEach((_exp) => {
6619
6816
  const exp = _exp;
6620
6817
  const { statement } = exp;
6621
- let ref16;
6818
+ let ref18;
6622
6819
  switch (statement.type) {
6623
6820
  case "IfStatement": {
6624
- if (ref16 = expressionizeIfStatement(statement)) {
6625
- const expression = ref16;
6821
+ if (ref18 = expressionizeIfStatement(statement)) {
6822
+ const expression = ref18;
6626
6823
  return replaceNode(statement, expression, exp);
6627
6824
  } else {
6628
6825
  return replaceNode(statement, wrapIIFE([["", statement]]), exp);
@@ -6691,7 +6888,7 @@ function processProgram(root) {
6691
6888
  if (config2.iife || config2.repl) {
6692
6889
  rootIIFE = wrapIIFE(root.expressions, root.topLevelAwait);
6693
6890
  const newExpressions = [["", rootIIFE]];
6694
- root.children = root.children.map(($8) => $8 === root.expressions ? newExpressions : $8);
6891
+ root.children = root.children.map(($9) => $9 === root.expressions ? newExpressions : $9);
6695
6892
  root.expressions = newExpressions;
6696
6893
  }
6697
6894
  addParentPointers(root);
@@ -6731,17 +6928,17 @@ async function processProgramAsync(root) {
6731
6928
  await processComptime(statements);
6732
6929
  }
6733
6930
  function processRepl(root, rootIIFE) {
6734
- const topBlock = gatherRecursive(rootIIFE, ($9) => $9.type === "BlockStatement")[0];
6931
+ const topBlock = gatherRecursive(rootIIFE, ($10) => $10.type === "BlockStatement")[0];
6735
6932
  let i = 0;
6736
- for (let ref17 = gatherRecursiveWithinFunction(topBlock, ($10) => $10.type === "Declaration"), i4 = 0, len3 = ref17.length; i4 < len3; i4++) {
6737
- const decl = ref17[i4];
6933
+ for (let ref19 = gatherRecursiveWithinFunction(topBlock, ($11) => $11.type === "Declaration"), i5 = 0, len4 = ref19.length; i5 < len4; i5++) {
6934
+ const decl = ref19[i5];
6738
6935
  if (decl.parent === topBlock || decl.decl === "var") {
6739
6936
  decl.children.shift();
6740
6937
  root.expressions.splice(i++, 0, ["", `var ${decl.names.join(",")};`]);
6741
6938
  }
6742
6939
  }
6743
- for (let ref18 = gatherRecursive(topBlock, ($11) => $11.type === "FunctionExpression"), i5 = 0, len4 = ref18.length; i5 < len4; i5++) {
6744
- const func = ref18[i5];
6940
+ for (let ref20 = gatherRecursive(topBlock, ($12) => $12.type === "FunctionExpression"), i6 = 0, len5 = ref20.length; i6 < len5; i6++) {
6941
+ const func = ref20[i6];
6745
6942
  if (func.name && func.parent?.type === "BlockStatement") {
6746
6943
  if (func.parent === topBlock) {
6747
6944
  replaceNode(func, void 0);
@@ -6753,17 +6950,17 @@ function processRepl(root, rootIIFE) {
6753
6950
  }
6754
6951
  }
6755
6952
  }
6756
- for (let ref19 = gatherRecursiveWithinFunction(topBlock, ($12) => $12.type === "ClassExpression"), i6 = 0, len5 = ref19.length; i6 < len5; i6++) {
6757
- const classExp = ref19[i6];
6758
- let m4;
6759
- if (classExp.name && classExp.parent === topBlock || (m4 = classExp.parent, typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "ReturnStatement" && "parent" in m4 && m4.parent === topBlock)) {
6953
+ for (let ref21 = gatherRecursiveWithinFunction(topBlock, ($13) => $13.type === "ClassExpression"), i7 = 0, len6 = ref21.length; i7 < len6; i7++) {
6954
+ const classExp = ref21[i7];
6955
+ let m5;
6956
+ if (classExp.name && classExp.parent === topBlock || (m5 = classExp.parent, typeof m5 === "object" && m5 != null && "type" in m5 && m5.type === "ReturnStatement" && "parent" in m5 && m5.parent === topBlock)) {
6760
6957
  classExp.children.unshift(classExp.name, "=");
6761
6958
  root.expressions.splice(i++, 0, ["", `var ${classExp.name};`]);
6762
6959
  }
6763
6960
  }
6764
6961
  }
6765
6962
  function populateRefs(statements) {
6766
- const refNodes = gatherRecursive(statements, ($13) => $13.type === "Ref");
6963
+ const refNodes = gatherRecursive(statements, ($14) => $14.type === "Ref");
6767
6964
  if (refNodes.length) {
6768
6965
  const ids = gatherRecursive(statements, (s) => s.type === "Identifier");
6769
6966
  const names = new Set(ids.flatMap(({ names: names2 }) => names2 || []));
@@ -6786,11 +6983,11 @@ function populateRefs(statements) {
6786
6983
  function processPlaceholders(statements) {
6787
6984
  const placeholderMap = /* @__PURE__ */ new Map();
6788
6985
  const liftedIfs = /* @__PURE__ */ new Set();
6789
- gatherRecursiveAll(statements, ($14) => $14.type === "Placeholder").forEach((_exp) => {
6986
+ gatherRecursiveAll(statements, ($15) => $15.type === "Placeholder").forEach((_exp) => {
6790
6987
  const exp = _exp;
6791
6988
  let ancestor;
6792
6989
  if (exp.subtype === ".") {
6793
- ({ ancestor } = findAncestor(exp, ($15) => $15.type === "Call"));
6990
+ ({ ancestor } = findAncestor(exp, ($16) => $16.type === "Call"));
6794
6991
  ancestor = ancestor?.parent;
6795
6992
  while (ancestor?.parent?.type === "UnaryExpression" || ancestor?.parent?.type === "NewExpression") {
6796
6993
  ancestor = ancestor.parent;
@@ -6809,10 +7006,10 @@ function processPlaceholders(statements) {
6809
7006
  if (type === "IfStatement") {
6810
7007
  liftedIfs.add(ancestor2);
6811
7008
  }
6812
- let m5;
6813
7009
  let m6;
7010
+ let m7;
6814
7011
  return type === "Call" || // Block, except for if/else blocks when condition already lifted
6815
- type === "BlockStatement" && !((m5 = ancestor2.parent, typeof m5 === "object" && m5 != null && "type" in m5 && m5.type === "IfStatement") && liftedIfs.has(ancestor2.parent)) && !((m6 = ancestor2.parent, typeof m6 === "object" && m6 != null && "type" in m6 && m6.type === "ElseClause" && "parent" in m6 && typeof m6.parent === "object" && m6.parent != null && "type" in m6.parent && m6.parent.type === "IfStatement") && liftedIfs.has(ancestor2.parent.parent)) || type === "PipelineExpression" || // Declaration
7012
+ type === "BlockStatement" && !((m6 = ancestor2.parent, typeof m6 === "object" && m6 != null && "type" in m6 && m6.type === "IfStatement") && liftedIfs.has(ancestor2.parent)) && !((m7 = ancestor2.parent, typeof m7 === "object" && m7 != null && "type" in m7 && m7.type === "ElseClause" && "parent" in m7 && typeof m7.parent === "object" && m7.parent != null && "type" in m7.parent && m7.parent.type === "IfStatement") && liftedIfs.has(ancestor2.parent.parent)) || type === "PipelineExpression" || // Declaration
6816
7013
  type === "Initializer" || // Right-hand side of assignment
6817
7014
  type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
6818
7015
  }));
@@ -6888,11 +7085,11 @@ function processPlaceholders(statements) {
6888
7085
  for (const [ancestor, placeholders] of placeholderMap) {
6889
7086
  let ref = makeRef("$");
6890
7087
  let typeSuffix;
6891
- for (let i7 = 0, len6 = placeholders.length; i7 < len6; i7++) {
6892
- const placeholder = placeholders[i7];
7088
+ for (let i8 = 0, len7 = placeholders.length; i8 < len7; i8++) {
7089
+ const placeholder = placeholders[i8];
6893
7090
  typeSuffix ??= placeholder.typeSuffix;
6894
- let ref20;
6895
- replaceNode((ref20 = placeholder.children)[ref20.length - 1], ref);
7091
+ let ref22;
7092
+ replaceNode((ref22 = placeholder.children)[ref22.length - 1], ref);
6896
7093
  }
6897
7094
  const { parent } = ancestor;
6898
7095
  const body = maybeUnwrap(ancestor);
@@ -6913,16 +7110,16 @@ function processPlaceholders(statements) {
6913
7110
  }
6914
7111
  case "PipelineExpression": {
6915
7112
  const i = findChildIndex(parent, ancestor);
6916
- let ref21;
7113
+ let ref23;
6917
7114
  if (i === 1) {
6918
- ref21 = ancestor === parent.children[i];
7115
+ ref23 = ancestor === parent.children[i];
6919
7116
  } else if (i === 2) {
6920
- ref21 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
7117
+ ref23 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
6921
7118
  } else {
6922
- ref21 = void 0;
7119
+ ref23 = void 0;
6923
7120
  }
6924
7121
  ;
6925
- outer = ref21;
7122
+ outer = ref23;
6926
7123
  break;
6927
7124
  }
6928
7125
  case "AssignmentExpression":
@@ -6937,9 +7134,9 @@ function processPlaceholders(statements) {
6937
7134
  fnExp = makeLeftHandSideExpression(fnExp);
6938
7135
  }
6939
7136
  replaceNode(ancestor, fnExp, parent);
6940
- let ref22;
6941
- if (ref22 = getTrimmingSpace(body)) {
6942
- const ws = ref22;
7137
+ let ref24;
7138
+ if (ref24 = getTrimmingSpace(body)) {
7139
+ const ws = ref24;
6943
7140
  inplaceInsertTrimmingSpace(body, "");
6944
7141
  inplacePrepend(ws, fnExp);
6945
7142
  }
@@ -6984,8 +7181,8 @@ function reorderBindingRestProperty(props) {
6984
7181
  }
6985
7182
  ];
6986
7183
  }
6987
- let ref23;
6988
- if (Array.isArray(rest.delim) && (ref23 = rest.delim)[ref23.length - 1]?.token === ",") {
7184
+ let ref25;
7185
+ if (Array.isArray(rest.delim) && (ref25 = rest.delim)[ref25.length - 1]?.token === ",") {
6989
7186
  rest.delim = rest.delim.slice(0, -1);
6990
7187
  rest.children = [...rest.children.slice(0, -1), rest.delim];
6991
7188
  }
@@ -7010,9 +7207,9 @@ function replaceNodes(root, predicate, replacer) {
7010
7207
  return root;
7011
7208
  }
7012
7209
  }
7013
- for (let i8 = 0, len7 = array.length; i8 < len7; i8++) {
7014
- const i = i8;
7015
- const node = array[i8];
7210
+ for (let i9 = 0, len8 = array.length; i9 < len8; i9++) {
7211
+ const i = i9;
7212
+ const node = array[i9];
7016
7213
  if (!(node != null)) {
7017
7214
  return;
7018
7215
  }
@@ -7036,9 +7233,9 @@ function replaceNodesRecursive(root, predicate, replacer) {
7036
7233
  return root;
7037
7234
  }
7038
7235
  }
7039
- for (let i9 = 0, len8 = array.length; i9 < len8; i9++) {
7040
- const i = i9;
7041
- const node = array[i9];
7236
+ for (let i10 = 0, len9 = array.length; i10 < len9; i10++) {
7237
+ const i = i10;
7238
+ const node = array[i10];
7042
7239
  if (!(node != null)) {
7043
7240
  continue;
7044
7241
  }
@@ -7456,7 +7653,7 @@ var grammar = {
7456
7653
  IgnoreColon,
7457
7654
  TryStatement,
7458
7655
  CatchClause,
7459
- CatchBind,
7656
+ CatchBinding,
7460
7657
  FinallyClause,
7461
7658
  CatchParameter,
7462
7659
  Condition,
@@ -7516,6 +7713,8 @@ var grammar = {
7516
7713
  NamedImports,
7517
7714
  OperatorNamedImports,
7518
7715
  FromClause,
7716
+ ImpliedFromClause,
7717
+ ImpliedFrom,
7519
7718
  ImportAssertion,
7520
7719
  TypeAndImportSpecifier,
7521
7720
  ImportSpecifier,
@@ -7800,6 +7999,7 @@ var grammar = {
7800
7999
  TypeSuffix,
7801
8000
  MaybeNestedType,
7802
8001
  MaybeNestedTypePrimary,
8002
+ MaybeNestedTypeUnary,
7803
8003
  ReturnTypeSuffix,
7804
8004
  ReturnType,
7805
8005
  TypePredicate,
@@ -8199,7 +8399,7 @@ var $R28 = (0, import_lib4.$R)(new RegExp("(?!\\+\\+|--)[!~+-](?!\\s)", "suy"));
8199
8399
  var $R29 = (0, import_lib4.$R)(new RegExp("[:.]", "suy"));
8200
8400
  var $R30 = (0, import_lib4.$R)(new RegExp("(?=for|if|loop|unless|until|while)", "suy"));
8201
8401
  var $R31 = (0, import_lib4.$R)(new RegExp("(?=loop|comptime|do|for|until|while)", "suy"));
8202
- var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s]+', "suy"));
8402
+ var $R32 = (0, import_lib4.$R)(new RegExp('[^;"\\s=>]+', "suy"));
8203
8403
  var $R33 = (0, import_lib4.$R)(new RegExp("(?=[0-9.])", "suy"));
8204
8404
  var $R34 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)n", "suy"));
8205
8405
  var $R35 = (0, import_lib4.$R)(new RegExp("(?:0|[1-9](?:_[0-9]|[0-9])*)(?=\\.(?:\\p{ID_Start}|[_$]))", "suy"));
@@ -9708,14 +9908,22 @@ var CallExpression$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Super, Arguments
9708
9908
  var CallExpression$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, _, NamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
9709
9909
  return dynamizeImportDeclarationExpression($0);
9710
9910
  });
9711
- var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$EXPECT)($L15, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
9911
+ var CallExpression$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(FromClause, __, Import, _, NamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
9912
+ var from = $1;
9913
+ var fws = $2;
9914
+ var i = $3;
9915
+ var iws = $4;
9916
+ var imports = $5;
9917
+ return dynamizeImportDeclarationExpression([i, iws, imports, fws, from]);
9918
+ });
9919
+ var CallExpression$3 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$EXPECT)($L15, 'CallExpression "import"'), ArgumentsWithTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
9712
9920
  var rest = $3;
9713
9921
  return processCallMemberExpression({
9714
9922
  type: "CallExpression",
9715
9923
  children: [$1, ...$2, ...rest.flat()]
9716
9924
  });
9717
9925
  });
9718
- var CallExpression$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(MemberExpression, AllowedTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
9926
+ var CallExpression$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(MemberExpression, AllowedTrailingMemberExpressions, (0, import_lib4.$Q)(CallExpressionRest)), function($skip, $loc, $0, $1, $2, $3) {
9719
9927
  var member = $1;
9720
9928
  var trailing = $2;
9721
9929
  var rest = $3;
@@ -9728,7 +9936,7 @@ var CallExpression$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(MemberExpression
9728
9936
  }
9729
9937
  return member;
9730
9938
  });
9731
- var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3];
9939
+ var CallExpression$$ = [CallExpression$0, CallExpression$1, CallExpression$2, CallExpression$3, CallExpression$4];
9732
9940
  function CallExpression(ctx, state2) {
9733
9941
  return (0, import_lib4.$EVENT_C)(ctx, state2, "CallExpression", CallExpression$$);
9734
9942
  }
@@ -9858,11 +10066,12 @@ var MemberBracketContent$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(OpenBracke
9858
10066
  var ws = $3;
9859
10067
  var close = $4;
9860
10068
  if (expression.type === "SliceParameters") {
9861
- const { start, end, children } = expression;
10069
+ const { start, end, reversed, children } = expression;
9862
10070
  return {
9863
10071
  type: "SliceExpression",
9864
10072
  start,
9865
10073
  end,
10074
+ reversed,
9866
10075
  children: [
9867
10076
  { ...open, token: ".slice(" },
9868
10077
  ...children,
@@ -9879,78 +10088,57 @@ var MemberBracketContent$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(OpenBracke
9879
10088
  function MemberBracketContent(ctx, state2) {
9880
10089
  return (0, import_lib4.$EVENT)(ctx, state2, "MemberBracketContent", MemberBracketContent$0);
9881
10090
  }
9882
- var SliceParameters$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Expression, __, RangeDots, (0, import_lib4.$E)(Expression)), function($skip, $loc, $0, $1, $2, $3, $4) {
9883
- var start = $1;
9884
- var ws = $2;
9885
- var dots = $3;
9886
- var end = $4;
10091
+ var SliceParameters$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Loc, (0, import_lib4.$E)(Expression), __, RangeDots, Loc, (0, import_lib4.$E)(Expression)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
10092
+ var ls = $1;
10093
+ var start = $2;
10094
+ var ws = $3;
10095
+ var dots = $4;
10096
+ var le = $5;
10097
+ var end = $6;
10098
+ const reversed = dots.increasing === false;
10099
+ const sign = reversed ? "-" : "+";
9887
10100
  let children;
10101
+ start ??= {
10102
+ $loc: ls.$loc,
10103
+ token: reversed ? "-1" : "0"
10104
+ };
10105
+ if (!end) {
10106
+ if (reversed) {
10107
+ end = {
10108
+ $loc: le.$loc,
10109
+ token: "0"
10110
+ };
10111
+ } else if (!dots.right.inclusive && !dots.triple) {
10112
+ end = {
10113
+ $loc: le.$loc,
10114
+ token: "-1"
10115
+ };
10116
+ }
10117
+ }
9888
10118
  if (!dots.left.inclusive) {
9889
- start = ["1 + ", makeLeftHandSideExpression(start)];
10119
+ start = [makeLeftHandSideExpression(start), ` ${sign} 1`];
9890
10120
  }
9891
10121
  if (end) {
9892
10122
  const inc = [];
9893
10123
  if (dots.right.inclusive) {
9894
- end = ["1 + ", makeLeftHandSideExpression(end)];
9895
- inc.push(" || 1/0");
10124
+ end = [makeLeftHandSideExpression(end), ` ${sign} 1`];
10125
+ if (!reversed)
10126
+ inc.push(" || 1/0");
9896
10127
  }
9897
10128
  children = [start, [...ws, dots.children[0], { token: ", ", $loc: dots.$loc }], [dots.children[1], end, ...inc]];
9898
10129
  } else {
9899
10130
  children = [start, ws];
9900
10131
  }
9901
- if (dots.increasing === false) {
9902
- children.push({
9903
- type: "Error",
9904
- message: "Slice range cannot be decreasing",
9905
- $loc: dots.$loc
9906
- });
9907
- }
9908
10132
  return {
9909
10133
  type: "SliceParameters",
9910
10134
  start,
9911
10135
  end,
10136
+ reversed,
9912
10137
  children
9913
10138
  };
9914
10139
  });
9915
- var SliceParameters$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(Loc, __, (0, import_lib4.$C)(DotDotDot, DotDot), Expression), function($skip, $loc, $0, $1, $2, $3, $4) {
9916
- var l = $1;
9917
- var ws = $2;
9918
- var sep = $3;
9919
- var end = $4;
9920
- const inclusive = sep.token === "..";
9921
- const inc = [];
9922
- if (inclusive) {
9923
- end = ["1 + ", end];
9924
- inc.push(" || 1/0");
9925
- }
9926
- const start = {
9927
- $loc: l.$loc,
9928
- token: "0"
9929
- };
9930
- return {
9931
- type: "SliceParameters",
9932
- start,
9933
- end,
9934
- children: [start, [...ws, { ...sep, token: ", " }], [end, ...inc]]
9935
- };
9936
- });
9937
- var SliceParameters$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(Loc, __, (0, import_lib4.$C)(DotDot, DotDotDot), (0, import_lib4.$Y)((0, import_lib4.$S)(__, CloseBracket))), function($skip, $loc, $0, $1, $2, $3, $4) {
9938
- var l = $1;
9939
- var ws = $2;
9940
- const start = {
9941
- $loc: l.$loc,
9942
- token: "0"
9943
- };
9944
- return {
9945
- type: "SliceParameters",
9946
- start,
9947
- end: void 0,
9948
- children: [start, ws]
9949
- };
9950
- });
9951
- var SliceParameters$$ = [SliceParameters$0, SliceParameters$1, SliceParameters$2];
9952
10140
  function SliceParameters(ctx, state2) {
9953
- return (0, import_lib4.$EVENT_C)(ctx, state2, "SliceParameters", SliceParameters$$);
10141
+ return (0, import_lib4.$EVENT)(ctx, state2, "SliceParameters", SliceParameters$0);
9954
10142
  }
9955
10143
  var AccessStart$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(PropertyAccessModifier), Dot, (0, import_lib4.$N)((0, import_lib4.$EXPECT)($R11, "AccessStart /[.\\s]/"))), function($skip, $loc, $0, $1, $2, $3) {
9956
10144
  var modifier = $1;
@@ -11619,6 +11807,7 @@ var RangeDots$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(DotDotDot), function(
11619
11807
  left: { inclusive: true, raw: "" },
11620
11808
  right: { inclusive: false, raw: "." },
11621
11809
  increasing: void 0,
11810
+ triple: true,
11622
11811
  children: []
11623
11812
  };
11624
11813
  });
@@ -13777,9 +13966,12 @@ var ForBinding$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(
13777
13966
  function ForBinding(ctx, state2) {
13778
13967
  return (0, import_lib4.$EVENT)(ctx, state2, "ForBinding", ForBinding$0);
13779
13968
  }
13780
- var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, (0, import_lib4.$C)(EmptyCondition, Condition), CaseBlock), function($skip, $loc, $0, $1, $2, $3) {
13781
- var condition = $2;
13782
- var caseBlock = $3;
13969
+ var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, ForbidNewlineBinaryOp, (0, import_lib4.$E)((0, import_lib4.$C)(EmptyCondition, Condition)), RestoreNewlineBinaryOp, CaseBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
13970
+ var s = $1;
13971
+ var condition = $3;
13972
+ var caseBlock = $5;
13973
+ if (!condition)
13974
+ return $skip;
13783
13975
  if (condition.type === "EmptyCondition") {
13784
13976
  caseBlock.clauses.forEach(({ cases }) => {
13785
13977
  if (cases) {
@@ -13799,7 +13991,8 @@ var SwitchStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Switch, (0, imp
13799
13991
  }
13800
13992
  return {
13801
13993
  type: "SwitchStatement",
13802
- children: $0,
13994
+ children: [s, condition, caseBlock],
13995
+ // omit NewlineBinaryOp control
13803
13996
  condition,
13804
13997
  caseBlock
13805
13998
  };
@@ -13896,12 +14089,14 @@ var CaseClause$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(Default, ImpliedColo
13896
14089
  };
13897
14090
  });
13898
14091
  var CaseClause$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(Else, ImpliedColon, (0, import_lib4.$C)(ThenClause, BracedBlock, EmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
14092
+ var e = $1;
14093
+ var colon = $2;
13899
14094
  var block = $3;
13900
- $1.token = "default";
14095
+ e = { ...e, token: "default" };
13901
14096
  return {
13902
14097
  type: "DefaultClause",
13903
14098
  block,
13904
- children: $0
14099
+ children: [e, colon, block]
13905
14100
  };
13906
14101
  });
13907
14102
  var CaseClause$$ = [CaseClause$0, CaseClause$1, CaseClause$2, CaseClause$3, CaseClause$4];
@@ -13972,36 +14167,56 @@ var IgnoreColon$0 = (0, import_lib4.$TV)((0, import_lib4.$E)((0, import_lib4.$S)
13972
14167
  function IgnoreColon(ctx, state2) {
13973
14168
  return (0, import_lib4.$EVENT)(ctx, state2, "IgnoreColon", IgnoreColon$0);
13974
14169
  }
13975
- var TryStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Try, (0, import_lib4.$N)((0, import_lib4.$EXPECT)($L16, 'TryStatement ":"')), NoPostfixBracedOrEmptyBlock, (0, import_lib4.$E)(CatchClause), (0, import_lib4.$E)(ElseClause), (0, import_lib4.$E)(FinallyClause)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
14170
+ var TryStatement$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Try, (0, import_lib4.$N)((0, import_lib4.$EXPECT)($L16, 'TryStatement ":"')), NoPostfixBracedOrEmptyBlock, (0, import_lib4.$Q)(CatchClause), (0, import_lib4.$E)(ElseClause), (0, import_lib4.$E)(FinallyClause)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
13976
14171
  return processTryBlock($0);
13977
14172
  });
13978
14173
  function TryStatement(ctx, state2) {
13979
14174
  return (0, import_lib4.$EVENT)(ctx, state2, "TryStatement", TryStatement$0);
13980
14175
  }
13981
- var CatchClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(Nested, _), Catch, (0, import_lib4.$E)(CatchBind), (0, import_lib4.$C)(BracedThenClause, BracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4) {
14176
+ var CatchClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(Nested, _), Catch, (0, import_lib4.$E)(CatchBinding), (0, import_lib4.$C)(BracedThenClause, BracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3, $4) {
14177
+ var binding = $3;
13982
14178
  var block = $4;
13983
14179
  return {
13984
14180
  type: "CatchClause",
13985
14181
  children: $0,
13986
- block
14182
+ block,
14183
+ binding
13987
14184
  };
13988
14185
  });
13989
14186
  function CatchClause(ctx, state2) {
13990
14187
  return (0, import_lib4.$EVENT)(ctx, state2, "CatchClause", CatchClause$0);
13991
14188
  }
13992
- var CatchBind$0 = (0, import_lib4.$S)((0, import_lib4.$E)(_), OpenParen, __, CatchParameter, __, CloseParen);
13993
- var CatchBind$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(_, InsertOpenParen, (0, import_lib4.$N)(EOS), ForbidIndentedApplication, (0, import_lib4.$E)(CatchParameter), RestoreIndentedApplication, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
14189
+ var CatchBinding$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), OpenParen, __, AllowAll, (0, import_lib4.$E)(CatchParameter), RestoreAll, __, CloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
14190
+ var ws1 = $1;
14191
+ var open = $2;
14192
+ var ws2 = $3;
14193
+ var parameter = $5;
14194
+ var ws3 = $7;
14195
+ var close = $8;
14196
+ if (!parameter)
14197
+ return $skip;
14198
+ return {
14199
+ type: "CatchBinding",
14200
+ parameter,
14201
+ children: [ws1, open, ws2, parameter, ws3, close]
14202
+ };
14203
+ });
14204
+ var CatchBinding$1 = (0, import_lib4.$TS)((0, import_lib4.$S)(_, InsertOpenParen, (0, import_lib4.$N)(EOS), ForbidIndentedApplication, (0, import_lib4.$E)(CatchParameter), RestoreIndentedApplication, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
13994
14205
  var ws = $1;
13995
14206
  var open = $2;
13996
- var param = $5;
14207
+ var parameter = $5;
13997
14208
  var close = $7;
13998
- if (!param)
14209
+ if (!parameter)
13999
14210
  return $skip;
14000
- return [ws, open, param, close];
14211
+ return {
14212
+ type: "CatchBinding",
14213
+ parameter,
14214
+ children: [ws, open, parameter, close]
14215
+ };
14001
14216
  });
14002
- var CatchBind$$ = [CatchBind$0, CatchBind$1];
14003
- function CatchBind(ctx, state2) {
14004
- return (0, import_lib4.$EVENT_C)(ctx, state2, "CatchBind", CatchBind$$);
14217
+ var CatchBinding$$ = [CatchBinding$0, CatchBinding$1];
14218
+ function CatchBinding(ctx, state2) {
14219
+ return (0, import_lib4.$EVENT_C)(ctx, state2, "CatchBinding", CatchBinding$$);
14005
14220
  }
14006
14221
  var FinallyClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(Nested, _), Finally, (0, import_lib4.$C)(BracedThenClause, BracedOrEmptyBlock)), function($skip, $loc, $0, $1, $2, $3) {
14007
14222
  var block = $3;
@@ -14014,9 +14229,34 @@ var FinallyClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$
14014
14229
  function FinallyClause(ctx, state2) {
14015
14230
  return (0, import_lib4.$EVENT)(ctx, state2, "FinallyClause", FinallyClause$0);
14016
14231
  }
14017
- var CatchParameter$0 = (0, import_lib4.$S)(BindingIdentifier, (0, import_lib4.$E)(TypeSuffix));
14018
- var CatchParameter$1 = (0, import_lib4.$S)(BindingPattern, (0, import_lib4.$E)(TypeSuffix));
14019
- var CatchParameter$$ = [CatchParameter$0, CatchParameter$1];
14232
+ var CatchParameter$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(BindingIdentifier, (0, import_lib4.$E)(TypeSuffix)), function($skip, $loc, $0, $1, $2) {
14233
+ var binding = $1;
14234
+ var typeSuffix = $2;
14235
+ return {
14236
+ type: "CatchParameter",
14237
+ binding,
14238
+ typeSuffix,
14239
+ children: $0
14240
+ };
14241
+ });
14242
+ var CatchParameter$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)(ObjectBindingPattern, ArrayBindingPattern), TypeSuffix), function($skip, $loc, $0, $1, $2) {
14243
+ var binding = $1;
14244
+ var typeSuffix = $2;
14245
+ return {
14246
+ type: "CatchParameter",
14247
+ binding,
14248
+ typeSuffix,
14249
+ children: [binding, typeSuffix]
14250
+ };
14251
+ });
14252
+ var CatchParameter$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(PatternExpressionList), function($skip, $loc, $0, $1) {
14253
+ return {
14254
+ type: "CatchPattern",
14255
+ children: $0,
14256
+ patterns: $1
14257
+ };
14258
+ });
14259
+ var CatchParameter$$ = [CatchParameter$0, CatchParameter$1, CatchParameter$2];
14020
14260
  function CatchParameter(ctx, state2) {
14021
14261
  return (0, import_lib4.$EVENT_C)(ctx, state2, "CatchParameter", CatchParameter$$);
14022
14262
  }
@@ -14120,8 +14360,8 @@ var SingleLineExpressionWithIndentedApplicationForbidden$0 = (0, import_lib4.$TS
14120
14360
  function SingleLineExpressionWithIndentedApplicationForbidden(ctx, state2) {
14121
14361
  return (0, import_lib4.$EVENT)(ctx, state2, "SingleLineExpressionWithIndentedApplicationForbidden", SingleLineExpressionWithIndentedApplicationForbidden$0);
14122
14362
  }
14123
- var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(ForbidBracedApplication, ForbidIndentedApplication, ForbidNewlineBinaryOp, (0, import_lib4.$E)(Expression), RestoreNewlineBinaryOp, RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
14124
- var exp = $4;
14363
+ var ExpressionWithObjectApplicationForbidden$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(ForbidBracedApplication, ForbidIndentedApplication, (0, import_lib4.$E)(Expression), RestoreBracedApplication, RestoreIndentedApplication), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14364
+ var exp = $3;
14125
14365
  if (exp)
14126
14366
  return exp;
14127
14367
  return $skip;
@@ -14510,36 +14750,41 @@ var ImportDeclaration$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, _, Id
14510
14750
  children: [imp, $0.slice(1)]
14511
14751
  };
14512
14752
  });
14513
- var ImportDeclaration$1 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, TypeKeyword, __, ImportClause, __, FromClause), function(value) {
14514
- var imports = value[4];
14515
- var from = value[6];
14516
- return { "type": "ImportDeclaration", "ts": true, "children": value, "imports": imports, "from": from };
14517
- });
14518
- var ImportDeclaration$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, __, Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
14519
- var behavior = $4;
14520
- var imports = $6;
14521
- var from = $8;
14753
+ var ImportDeclaration$1 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)((0, import_lib4.$S)(Import, __), ImpliedImport), Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
14754
+ var i = $1;
14755
+ var behavior = $3;
14756
+ var ws1 = $4;
14757
+ var imports = $5;
14758
+ var ws2 = $6;
14759
+ var from = $7;
14522
14760
  imports.specifiers.forEach((spec) => {
14523
14761
  state.operators.set(spec.binding.name, spec.behavior ?? behavior);
14524
14762
  });
14525
14763
  return {
14526
14764
  type: "ImportDeclaration",
14527
- children: [$1, $2, trimFirstSpace($5), imports, $7, from],
14528
- // omit $3 = Operator and $4 = OperatorBehavior
14765
+ children: [i, trimFirstSpace(ws1), imports, ws2, from],
14766
+ // omit $2 = Operator and $3 = OperatorBehavior
14529
14767
  imports,
14530
14768
  from
14531
14769
  };
14532
14770
  });
14533
- var ImportDeclaration$3 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, ImportClause, __, FromClause), function(value) {
14534
- var imports = value[2];
14535
- var from = value[4];
14536
- return { "type": "ImportDeclaration", "children": value, "imports": imports, "from": from };
14771
+ var ImportDeclaration$2 = (0, import_lib4.$TS)((0, import_lib4.$S)(Import, __, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
14772
+ var t = $3;
14773
+ var imports = $4;
14774
+ var from = $6;
14775
+ return {
14776
+ type: "ImportDeclaration",
14777
+ children: $0,
14778
+ imports,
14779
+ from,
14780
+ ts: !!t
14781
+ };
14537
14782
  });
14538
- var ImportDeclaration$4 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, ModuleSpecifier), function(value) {
14783
+ var ImportDeclaration$3 = (0, import_lib4.$T)((0, import_lib4.$S)(Import, __, ModuleSpecifier), function(value) {
14539
14784
  var module = value[2];
14540
14785
  return { "type": "ImportDeclaration", "children": value, "module": module };
14541
14786
  });
14542
- var ImportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14787
+ var ImportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14543
14788
  var i = $1;
14544
14789
  var t = $2;
14545
14790
  var imports = $3;
@@ -14552,22 +14797,40 @@ var ImportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport
14552
14797
  const children = [i, t, imports, w, from];
14553
14798
  return { type: "ImportDeclaration", ts: !!t, children, imports, from };
14554
14799
  });
14555
- var ImportDeclaration$6 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedImport, Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
14556
- var i = $1;
14557
- var behavior = $3;
14558
- var imports = $5;
14559
- var from = $7;
14800
+ var ImportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Import, __, Operator, (0, import_lib4.$E)(OperatorBehavior), __, OperatorNamedImports), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
14801
+ var from = $1;
14802
+ var fws = $2;
14803
+ var i = $3;
14804
+ var iws = $4;
14805
+ var behavior = $6;
14806
+ var ows = $7;
14807
+ var imports = $8;
14560
14808
  imports.specifiers.forEach((spec) => {
14561
14809
  state.operators.set(spec.binding.name, spec.behavior ?? behavior);
14562
14810
  });
14563
14811
  return {
14564
14812
  type: "ImportDeclaration",
14565
- children: [$1, trimFirstSpace($4), imports, $6, from],
14566
- // omit $2 = Operator and $3 = OperatorBehavior
14813
+ children: [i, iws, trimFirstSpace(ows), imports, fws, from],
14814
+ // omit Operator and OperatorBehavior
14567
14815
  imports,
14568
14816
  from
14569
14817
  };
14570
14818
  });
14819
+ var ImportDeclaration$6 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Import, __, (0, import_lib4.$E)((0, import_lib4.$S)(TypeKeyword, __)), ImportClause), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
14820
+ var from = $1;
14821
+ var fws = $2;
14822
+ var i = $3;
14823
+ var iws = $4;
14824
+ var t = $5;
14825
+ var imports = $6;
14826
+ return {
14827
+ type: "ImportDeclaration",
14828
+ children: [i, iws, t, imports, fws, from],
14829
+ imports,
14830
+ from,
14831
+ ts: !!t
14832
+ };
14833
+ });
14571
14834
  var ImportDeclaration$$ = [ImportDeclaration$0, ImportDeclaration$1, ImportDeclaration$2, ImportDeclaration$3, ImportDeclaration$4, ImportDeclaration$5, ImportDeclaration$6];
14572
14835
  function ImportDeclaration(ctx, state2) {
14573
14836
  return (0, import_lib4.$EVENT_C)(ctx, state2, "ImportDeclaration", ImportDeclaration$$);
@@ -14652,6 +14915,21 @@ var FromClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)(From, __, ModuleSpec
14652
14915
  function FromClause(ctx, state2) {
14653
14916
  return (0, import_lib4.$EVENT)(ctx, state2, "FromClause", FromClause$0);
14654
14917
  }
14918
+ var ImpliedFromClause$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$C)((0, import_lib4.$S)(From, __), ImpliedFrom), ModuleSpecifier), function($skip, $loc, $0, $1, $2) {
14919
+ var module = $2;
14920
+ if (!Array.isArray(module))
14921
+ return $0;
14922
+ return [$1, ...module];
14923
+ });
14924
+ function ImpliedFromClause(ctx, state2) {
14925
+ return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFromClause", ImpliedFromClause$0);
14926
+ }
14927
+ var ImpliedFrom$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($L0, 'ImpliedFrom ""'), function($skip, $loc, $0, $1) {
14928
+ return { $loc, token: "from " };
14929
+ });
14930
+ function ImpliedFrom(ctx, state2) {
14931
+ return (0, import_lib4.$EVENT)(ctx, state2, "ImpliedFrom", ImpliedFrom$0);
14932
+ }
14655
14933
  var ImportAssertion$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), (0, import_lib4.$C)((0, import_lib4.$EXPECT)($L124, 'ImportAssertion "with"'), (0, import_lib4.$EXPECT)($L125, 'ImportAssertion "assert"')), NonIdContinue, (0, import_lib4.$E)(_), ObjectLiteral), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14656
14934
  var keyword = $2;
14657
14935
  var object = $5;
@@ -14784,7 +15062,7 @@ var UnprocessedModuleSpecifier$$ = [UnprocessedModuleSpecifier$0, UnprocessedMod
14784
15062
  function UnprocessedModuleSpecifier(ctx, state2) {
14785
15063
  return (0, import_lib4.$EVENT_C)(ctx, state2, "UnprocessedModuleSpecifier", UnprocessedModuleSpecifier$$);
14786
15064
  }
14787
- var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s]+/'), function($skip, $loc, $0, $1) {
15065
+ var UnquotedSpecifier$0 = (0, import_lib4.$TV)((0, import_lib4.$EXPECT)($R32, 'UnquotedSpecifier /[^;"\\s=>]+/'), function($skip, $loc, $0, $1) {
14788
15066
  var spec = $0;
14789
15067
  return { $loc, token: `"${spec}"` };
14790
15068
  });
@@ -14837,13 +15115,26 @@ var ExportDeclaration$2 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_li
14837
15115
  return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
14838
15116
  });
14839
15117
  var ExportDeclaration$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(Export, __, ExportFromClause, __, FromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
14840
- return { type: "ExportDeclaration", ts: $3.ts, children: $0 };
15118
+ var exports = $3;
15119
+ return { type: "ExportDeclaration", ts: exports.ts, children: $0 };
14841
15120
  });
14842
- var ExportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(Decorators), Export, __, (0, import_lib4.$C)(Declaration, VariableStatement, TypeAndNamedExports, ExportVarDec)), function($skip, $loc, $0, $1, $2, $3, $4) {
15121
+ var ExportDeclaration$4 = (0, import_lib4.$TS)((0, import_lib4.$S)(ImpliedFromClause, __, Export, __, ExportFromClause), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
15122
+ var from = $1;
15123
+ var fws = $2;
15124
+ var e = $3;
15125
+ var ews = $4;
15126
+ var exports = $5;
15127
+ return {
15128
+ type: "ExportDeclaration",
15129
+ ts: exports.ts,
15130
+ children: [e, ews, exports, " ", from, trimFirstSpace(fws)]
15131
+ };
15132
+ });
15133
+ var ExportDeclaration$5 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(Decorators), Export, __, (0, import_lib4.$C)(Declaration, VariableStatement, TypeAndNamedExports, ExportVarDec)), function($skip, $loc, $0, $1, $2, $3, $4) {
14843
15134
  var declaration = $4;
14844
15135
  return { type: "ExportDeclaration", declaration, ts: declaration.ts, children: $0 };
14845
15136
  });
14846
- var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4];
15137
+ var ExportDeclaration$$ = [ExportDeclaration$0, ExportDeclaration$1, ExportDeclaration$2, ExportDeclaration$3, ExportDeclaration$4, ExportDeclaration$5];
14847
15138
  function ExportDeclaration(ctx, state2) {
14848
15139
  return (0, import_lib4.$EVENT_C)(ctx, state2, "ExportDeclaration", ExportDeclaration$$);
14849
15140
  }
@@ -17422,6 +17713,19 @@ var MaybeNestedTypePrimary$$ = [MaybeNestedTypePrimary$0, MaybeNestedTypePrimary
17422
17713
  function MaybeNestedTypePrimary(ctx, state2) {
17423
17714
  return (0, import_lib4.$EVENT_C)(ctx, state2, "MaybeNestedTypePrimary", MaybeNestedTypePrimary$$);
17424
17715
  }
17716
+ var MaybeNestedTypeUnary$0 = NestedTypeBulletedTuple;
17717
+ var MaybeNestedTypeUnary$1 = NestedInterfaceBlock;
17718
+ var MaybeNestedTypeUnary$2 = NestedTypeBinaryChain;
17719
+ var MaybeNestedTypeUnary$3 = (0, import_lib4.$TS)((0, import_lib4.$S)(PushIndent, (0, import_lib4.$E)((0, import_lib4.$S)(Nested, Type)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
17720
+ if (!$2)
17721
+ return $skip;
17722
+ return $2;
17723
+ });
17724
+ var MaybeNestedTypeUnary$4 = (0, import_lib4.$S)(NotDedented, TypeUnary);
17725
+ var MaybeNestedTypeUnary$$ = [MaybeNestedTypeUnary$0, MaybeNestedTypeUnary$1, MaybeNestedTypeUnary$2, MaybeNestedTypeUnary$3, MaybeNestedTypeUnary$4];
17726
+ function MaybeNestedTypeUnary(ctx, state2) {
17727
+ return (0, import_lib4.$EVENT_C)(ctx, state2, "MaybeNestedTypeUnary", MaybeNestedTypeUnary$$);
17728
+ }
17425
17729
  var ReturnTypeSuffix$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)(_), (0, import_lib4.$E)(QuestionMark), (0, import_lib4.$E)(_), Colon, ReturnType), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17426
17730
  var optional = $2;
17427
17731
  var t = $5;
@@ -17476,7 +17780,7 @@ var Type$0 = TypeWithPostfix;
17476
17780
  function Type(ctx, state2) {
17477
17781
  return (0, import_lib4.$EVENT)(ctx, state2, "Type", Type$0);
17478
17782
  }
17479
- var TypeBinary$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)((0, import_lib4.$S)(NotDedented, TypeBinaryOp, __)), TypeUnary, (0, import_lib4.$Q)((0, import_lib4.$S)(NotDedented, TypeBinaryOp, __, TypeUnary))), function($skip, $loc, $0, $1, $2, $3) {
17783
+ var TypeBinary$0 = (0, import_lib4.$TS)((0, import_lib4.$S)((0, import_lib4.$E)((0, import_lib4.$S)(NotDedented, TypeBinaryOp, __)), TypeUnary, (0, import_lib4.$Q)((0, import_lib4.$S)(NotDedented, TypeBinaryOp, MaybeNestedTypeUnary))), function($skip, $loc, $0, $1, $2, $3) {
17480
17784
  var optionalPrefix = $1;
17481
17785
  var t = $2;
17482
17786
  var ops = $3;