@danielx/civet 0.7.34 → 0.7.36

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
@@ -544,11 +544,13 @@ __export(lib_exports, {
544
544
  processProgramAsync: () => processProgramAsync,
545
545
  processTryBlock: () => processTryBlock,
546
546
  processUnaryExpression: () => processUnaryExpression,
547
+ processUnaryNestedExpression: () => processUnaryNestedExpression,
547
548
  quoteString: () => quoteString,
548
549
  reorderBindingRestProperty: () => reorderBindingRestProperty,
549
550
  replaceNode: () => replaceNode,
550
551
  replaceNodes: () => replaceNodes,
551
552
  skipImplicitArguments: () => skipImplicitArguments,
553
+ stripTrailingImplicitComma: () => stripTrailingImplicitComma,
552
554
  trimFirstSpace: () => trimFirstSpace,
553
555
  typeOfJSX: () => typeOfJSX,
554
556
  wrapIIFE: () => wrapIIFE
@@ -685,6 +687,40 @@ function isWhitespaceOrEmpty(node) {
685
687
  return node.every(isWhitespaceOrEmpty);
686
688
  return false;
687
689
  }
690
+ function firstNonSpace(node) {
691
+ if (!(node != null)) {
692
+ return;
693
+ }
694
+ if (Array.isArray(node)) {
695
+ for (let i2 = 0, len22 = node.length; i2 < len22; i2++) {
696
+ const child = node[i2];
697
+ let ref1;
698
+ if (ref1 = firstNonSpace(child)) {
699
+ const first = ref1;
700
+ return first;
701
+ }
702
+ }
703
+ return void 0;
704
+ } else if (isParent(node)) {
705
+ let ref2;
706
+ if (ref2 = firstNonSpace(node.children)) {
707
+ const first = ref2;
708
+ return first;
709
+ } else {
710
+ return node;
711
+ }
712
+ } else if (isToken(node)) {
713
+ let m;
714
+ if (m = node.token, typeof m === "string" && /^[ \t]*$/.test(m)) {
715
+ return;
716
+ }
717
+ } else if (typeof node === "string") {
718
+ if (typeof node === "string" && /^[ \t]*$/.test(node)) {
719
+ return;
720
+ }
721
+ }
722
+ return node;
723
+ }
688
724
  function isExit(node) {
689
725
  if (!(node != null)) {
690
726
  return false;
@@ -722,6 +758,14 @@ function isComma(node) {
722
758
  ;
723
759
  return;
724
760
  }
761
+ function stripTrailingImplicitComma(children) {
762
+ const last = children[children.length - 1];
763
+ if (isComma(last) && last.implicit) {
764
+ return children.slice(0, -1);
765
+ } else {
766
+ return children;
767
+ }
768
+ }
725
769
  function insertTrimmingSpace(target, c) {
726
770
  if (!(target != null)) {
727
771
  return target;
@@ -894,8 +938,8 @@ function startsWithPredicate(node, predicate, skip = isWhitespaceOrEmpty) {
894
938
  return void 0;
895
939
  }
896
940
  if (Array.isArray(node)) {
897
- for (let i2 = 0, len22 = node.length; i2 < len22; i2++) {
898
- const child = node[i2];
941
+ for (let i3 = 0, len3 = node.length; i3 < len3; i3++) {
942
+ const child = node[i3];
899
943
  if (skip(child)) {
900
944
  continue;
901
945
  }
@@ -982,6 +1026,9 @@ function makeLeftHandSideExpression(expression) {
982
1026
  return expression;
983
1027
  }
984
1028
  }
1029
+ return parenthesizeExpression(expression);
1030
+ }
1031
+ function parenthesizeExpression(expression) {
985
1032
  return makeNode({
986
1033
  type: "ParenthesizedExpression",
987
1034
  children: ["(", expression, ")"],
@@ -997,8 +1044,8 @@ function updateParentPointers(node, parent, depth = 1) {
997
1044
  return;
998
1045
  }
999
1046
  if (Array.isArray(node)) {
1000
- for (let i3 = 0, len3 = node.length; i3 < len3; i3++) {
1001
- const child = node[i3];
1047
+ for (let i4 = 0, len4 = node.length; i4 < len4; i4++) {
1048
+ const child = node[i4];
1002
1049
  updateParentPointers(child, parent, depth);
1003
1050
  }
1004
1051
  return;
@@ -1008,8 +1055,8 @@ function updateParentPointers(node, parent, depth = 1) {
1008
1055
  node.parent = parent;
1009
1056
  }
1010
1057
  if (depth && isParent(node)) {
1011
- for (let ref1 = node.children, i4 = 0, len4 = ref1.length; i4 < len4; i4++) {
1012
- const child = ref1[i4];
1058
+ for (let ref3 = node.children, i5 = 0, len5 = ref3.length; i5 < len5; i5++) {
1059
+ const child = ref3[i5];
1013
1060
  updateParentPointers(child, node, depth - 1);
1014
1061
  }
1015
1062
  }
@@ -1139,8 +1186,8 @@ function wrapIIFE(expressions, asyncFlag, generator) {
1139
1186
  children.splice(1, 0, ".bind(this)");
1140
1187
  }
1141
1188
  if (gatherRecursiveWithinFunction(block, (a2) => typeof a2 === "object" && a2 != null && "token" in a2 && a2.token === "arguments").length) {
1142
- let ref2;
1143
- children[children.length - 1] = (ref2 = parameters.children)[ref2.length - 1] = "(arguments)";
1189
+ let ref4;
1190
+ children[children.length - 1] = (ref4 = parameters.children)[ref4.length - 1] = "(arguments)";
1144
1191
  }
1145
1192
  }
1146
1193
  const exp = makeNode({
@@ -1163,9 +1210,9 @@ function wrapWithReturn(expression) {
1163
1210
  }
1164
1211
  function flatJoin(array, separator) {
1165
1212
  const result = [];
1166
- for (let i5 = 0, len5 = array.length; i5 < len5; i5++) {
1167
- const i = i5;
1168
- const items = array[i5];
1213
+ for (let i6 = 0, len6 = array.length; i6 < len6; i6++) {
1214
+ const i = i6;
1215
+ const items = array[i6];
1169
1216
  if (i) {
1170
1217
  result.push(separator);
1171
1218
  }
@@ -1564,12 +1611,6 @@ function isVoidType(t) {
1564
1611
  function isPromiseVoidType(t) {
1565
1612
  return t?.type === "TypeIdentifier" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
1566
1613
  }
1567
- function isGeneratorVoidType(t) {
1568
- return t?.type === "TypeIdentifier" && (t.raw === "Iterator" || t.raw === "Generator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
1569
- }
1570
- function isAsyncGeneratorVoidType(t) {
1571
- return t?.type === "TypeIdentifier" && (t.raw === "AsyncIterator" || t.raw === "AsyncGenerator") && t.args?.types?.length >= 2 && isVoidType(t.args.types[1]);
1572
- }
1573
1614
  function implicitFunctionBlock(f) {
1574
1615
  if (f.abstract || f.block || f.signature?.optional)
1575
1616
  return;
@@ -1607,7 +1648,7 @@ function processReturn(f, implicitReturns) {
1607
1648
  const { async, generator, set } = modifier;
1608
1649
  const isMethod = f.type === "MethodDefinition";
1609
1650
  const isConstructor = isMethod && name === "constructor";
1610
- const isVoid = isVoidType(returnType2?.t) || async && (isPromiseVoidType(returnType2?.t) || generator && isAsyncGeneratorVoidType(returnType2?.t)) || !async && generator && isGeneratorVoidType(returnType2?.t);
1651
+ const isVoid = generator || isVoidType(returnType2?.t) || async && isPromiseVoidType(returnType2?.t);
1611
1652
  if (block?.type === "BlockStatement") {
1612
1653
  if (isVoid || set || isConstructor) {
1613
1654
  if (block.bare && block.implicitlyReturned) {
@@ -1623,10 +1664,7 @@ function processReturn(f, implicitReturns) {
1623
1664
  }
1624
1665
  function processReturnValue(func) {
1625
1666
  const { block } = func;
1626
- const values = gatherRecursiveWithinFunction(
1627
- block,
1628
- ({ type }) => type === "ReturnValue"
1629
- );
1667
+ const values = gatherRecursiveWithinFunction(block, ($) => $.type === "ReturnValue");
1630
1668
  if (!values.length) {
1631
1669
  return false;
1632
1670
  }
@@ -1636,7 +1674,7 @@ function processReturnValue(func) {
1636
1674
  value.children = [ref];
1637
1675
  const { ancestor, child } = findAncestor(
1638
1676
  value,
1639
- ({ type }) => type === "Declaration",
1677
+ ($1) => $1.type === "Declaration",
1640
1678
  isFunction
1641
1679
  );
1642
1680
  if (ancestor) {
@@ -1656,8 +1694,8 @@ function processReturnValue(func) {
1656
1694
  }
1657
1695
  }
1658
1696
  if (declaration) {
1659
- if (!(declaration.suffix != null)) {
1660
- declaration.children[1] = declaration.suffix = returnType;
1697
+ if (!(declaration.typeSuffix != null)) {
1698
+ declaration.children[1] = declaration.typeSuffix = returnType;
1661
1699
  }
1662
1700
  } else {
1663
1701
  block.expressions.unshift([
@@ -1997,7 +2035,7 @@ function processBreakContinueWith(statement) {
1997
2035
  let changed = false;
1998
2036
  for (const control of gatherRecursiveWithinFunction(
1999
2037
  statement.block,
2000
- ($) => $.type === "BreakStatement" || $.type === "ContinueStatement"
2038
+ ($2) => $2.type === "BreakStatement" || $2.type === "ContinueStatement"
2001
2039
  )) {
2002
2040
  let controlName2 = function() {
2003
2041
  switch (control.type) {
@@ -2032,7 +2070,7 @@ function processBreakContinueWith(statement) {
2032
2070
  )
2033
2071
  );
2034
2072
  updateParentPointers(control.with, control);
2035
- const i = control.children.findIndex(($1) => $1?.type === "Error");
2073
+ const i = control.children.findIndex(($3) => $3?.type === "Error");
2036
2074
  if (i >= 0) {
2037
2075
  control.children.splice(i, 1);
2038
2076
  }
@@ -2156,8 +2194,8 @@ function processSignature(f) {
2156
2194
  }
2157
2195
  if (hasYield(block) && !f.generator?.length) {
2158
2196
  if (f.type === "ArrowFunction") {
2159
- gatherRecursiveWithinFunction(block, ($2) => $2.type === "YieldExpression").forEach((y) => {
2160
- const i = y.children.findIndex(($3) => $3.type === "Yield");
2197
+ gatherRecursiveWithinFunction(block, ($4) => $4.type === "YieldExpression").forEach((y) => {
2198
+ const i = y.children.findIndex(($5) => $5.type === "Yield");
2161
2199
  return y.children.splice(i + 1, 0, {
2162
2200
  type: "Error",
2163
2201
  message: "Can't use yield inside of => arrow function"
@@ -2239,6 +2277,9 @@ function expressionizeIteration(exp) {
2239
2277
  function skipImplicitArguments(args) {
2240
2278
  if (args.length === 1) {
2241
2279
  let arg0 = args[0];
2280
+ if (arg0.type === "Argument") {
2281
+ arg0 = arg0.expression;
2282
+ }
2242
2283
  if (arg0.type === "StatementExpression") {
2243
2284
  arg0 = arg0.statement;
2244
2285
  }
@@ -2281,12 +2322,13 @@ function processCoffeeDo(ws, expression) {
2281
2322
  expression = {
2282
2323
  ...expression,
2283
2324
  parameters: newParameters,
2284
- children: expression.children.map(($4) => $4 === parameters ? newParameters : $4)
2325
+ children: expression.children.map(($6) => $6 === parameters ? newParameters : $6)
2285
2326
  };
2286
2327
  }
2287
2328
  return {
2288
2329
  type: "CallExpression",
2289
2330
  children: [
2331
+ ws,
2290
2332
  makeLeftHandSideExpression(expression),
2291
2333
  {
2292
2334
  type: "Call",
@@ -2302,7 +2344,7 @@ function makeAmpersandFunction(rhs) {
2302
2344
  ref = makeRef("$");
2303
2345
  inplacePrepend(ref, body);
2304
2346
  }
2305
- if (startsWithPredicate(body, ($5) => $5.type === "ObjectExpression")) {
2347
+ if (startsWithPredicate(body, ($7) => $7.type === "ObjectExpression")) {
2306
2348
  body = makeLeftHandSideExpression(body);
2307
2349
  }
2308
2350
  const parameters = makeNode({
@@ -3492,7 +3534,7 @@ function aliasBinding(p, ref) {
3492
3534
  function len2(arr, length) {
3493
3535
  return arr.length === length;
3494
3536
  }
3495
- function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
3537
+ function processAssignmentDeclaration(decl, pattern, typeSuffix, ws, assign, e) {
3496
3538
  decl = {
3497
3539
  ...decl,
3498
3540
  $loc: {
@@ -3504,7 +3546,7 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
3504
3546
  splices = splices.map((s) => [", ", s]);
3505
3547
  const thisAssignments = assignments.map((a) => ["", a, ";"]);
3506
3548
  if ("typeSuffix" in pattern) {
3507
- suffix ??= pattern.typeSuffix;
3549
+ typeSuffix ??= pattern.typeSuffix;
3508
3550
  }
3509
3551
  const initializer = makeNode({
3510
3552
  type: "Initializer",
@@ -3516,9 +3558,9 @@ function processAssignmentDeclaration(decl, pattern, suffix, ws, assign, e) {
3516
3558
  pattern,
3517
3559
  initializer,
3518
3560
  splices,
3519
- suffix,
3561
+ typeSuffix,
3520
3562
  thisAssignments,
3521
- children: [pattern, suffix, initializer]
3563
+ children: [pattern, typeSuffix, initializer]
3522
3564
  });
3523
3565
  const children = [decl, binding];
3524
3566
  return makeNode({
@@ -3535,9 +3577,9 @@ function processDeclarations(statements) {
3535
3577
  gatherRecursiveAll(statements, ($) => $.type === "Declaration").forEach((statement) => {
3536
3578
  const { bindings } = statement;
3537
3579
  return bindings?.forEach((binding) => {
3538
- const suffix = binding.suffix;
3539
- if (suffix && suffix.optional && suffix.t) {
3540
- convertOptionalType(suffix);
3580
+ const { typeSuffix } = binding;
3581
+ if (typeSuffix && typeSuffix.optional && typeSuffix.t) {
3582
+ convertOptionalType(typeSuffix);
3541
3583
  }
3542
3584
  const { initializer } = binding;
3543
3585
  if (initializer) {
@@ -3618,8 +3660,8 @@ function processDeclarationCondition(condition, rootCondition, parent) {
3618
3660
  }
3619
3661
  const { decl, bindings } = condition.declaration;
3620
3662
  const binding = bindings[0];
3621
- let { pattern, suffix, initializer } = binding;
3622
- const nullCheck = suffix?.optional && !suffix.t && !suffix.nonnull;
3663
+ let { pattern, typeSuffix, initializer } = binding;
3664
+ const nullCheck = typeSuffix?.optional && !typeSuffix.t && !typeSuffix.nonnull;
3623
3665
  if (!(initializer != null)) {
3624
3666
  condition.children = [
3625
3667
  {
@@ -3657,14 +3699,14 @@ function processDeclarationCondition(condition, rootCondition, parent) {
3657
3699
  if (nullCheck) {
3658
3700
  children.unshift("(");
3659
3701
  children.push(") != null");
3660
- suffix = void 0;
3702
+ typeSuffix = void 0;
3661
3703
  }
3662
3704
  Object.assign(condition, {
3663
3705
  type: "AssignmentExpression",
3664
3706
  children,
3665
3707
  hoistDec: !simple ? {
3666
3708
  type: "Declaration",
3667
- children: ["let ", ref, suffix],
3709
+ children: ["let ", ref, typeSuffix],
3668
3710
  names: []
3669
3711
  } : void 0,
3670
3712
  pattern,
@@ -3672,7 +3714,7 @@ function processDeclarationCondition(condition, rootCondition, parent) {
3672
3714
  });
3673
3715
  }
3674
3716
  updateParentPointers(condition, parent);
3675
- rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl, suffix);
3717
+ rootCondition.blockPrefix = getPatternBlockPrefix(pattern, ref, decl, typeSuffix);
3676
3718
  }
3677
3719
  function processDeclarationConditions(node) {
3678
3720
  gatherRecursiveAll(
@@ -4050,6 +4092,10 @@ function processUnaryExpression(pre, exp, post) {
4050
4092
  };
4051
4093
  pre = pre.slice(0, -1);
4052
4094
  } else {
4095
+ let m;
4096
+ if (m = firstNonSpace(exp), typeof m === "string" && /^[ \t]*\n/.test(m) || typeof m === "object" && m != null && "token" in m && typeof m.token === "string" && /^[ \t]*\n/.test(m.token)) {
4097
+ exp = parenthesizeExpression(exp);
4098
+ }
4053
4099
  exp = {
4054
4100
  type: "AwaitExpression",
4055
4101
  children: [...last.children, exp]
@@ -4065,6 +4111,77 @@ function processUnaryExpression(pre, exp, post) {
4065
4111
  children: [...pre, exp, post]
4066
4112
  };
4067
4113
  }
4114
+ function processUnaryNestedExpression(pre, args, post) {
4115
+ const isArray = args.type === "ArrayExpression";
4116
+ if (!isArray) {
4117
+ args = stripTrailingImplicitComma(args);
4118
+ }
4119
+ if (isArray || args.length > 2) {
4120
+ const last = pre[pre.length - 1];
4121
+ if (!(typeof last === "object" && last != null && "type" in last && last.type === "Await")) {
4122
+ return;
4123
+ }
4124
+ if (last.op) {
4125
+ if (!isArray) {
4126
+ args = {
4127
+ type: "ArrayExpression",
4128
+ children: ["[", args, "]"]
4129
+ };
4130
+ }
4131
+ } else {
4132
+ pre.pop();
4133
+ if (!isArray) {
4134
+ args = args;
4135
+ args = {
4136
+ type: "ArrayExpression",
4137
+ children: [
4138
+ "[",
4139
+ ...(() => {
4140
+ const results = [];
4141
+ for (let i = 0, len3 = args.length; i < len3; i++) {
4142
+ const arg = args[i];
4143
+ if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "Argument") {
4144
+ const expression = processUnaryExpression([last], arg.expression);
4145
+ results.push({
4146
+ ...arg,
4147
+ expression,
4148
+ children: arg.children.map(($) => $ === arg.expression ? expression : $)
4149
+ });
4150
+ } else {
4151
+ results.push(arg);
4152
+ }
4153
+ }
4154
+ return results;
4155
+ })(),
4156
+ "]"
4157
+ ]
4158
+ };
4159
+ } else {
4160
+ args = trimFirstSpace(args);
4161
+ args = {
4162
+ ...args,
4163
+ children: args.children.map(
4164
+ (arg) => {
4165
+ if (typeof arg === "object" && arg != null && "type" in arg && arg.type === "ArrayElement" && "expression" in arg && "children" in arg) {
4166
+ const { type, expression: exp, children } = arg;
4167
+ let expression = processUnaryExpression([last], trimFirstSpace(exp));
4168
+ expression = prepend(getTrimmingSpace(exp), expression);
4169
+ return {
4170
+ ...arg,
4171
+ expression,
4172
+ children: children.map(($1) => $1 === exp ? expression : $1)
4173
+ };
4174
+ } else {
4175
+ return arg;
4176
+ }
4177
+ }
4178
+ )
4179
+ };
4180
+ }
4181
+ }
4182
+ }
4183
+ return processUnaryExpression(pre, args, post);
4184
+ }
4068
4185
 
4069
4186
  // source/parser/pipe.civet
4070
4187
  function constructInvocation(fn, arg) {
@@ -4102,36 +4219,31 @@ function constructInvocation(fn, arg) {
4102
4219
  };
4103
4220
  }
4104
4221
  function constructPipeStep(fn, arg, returning) {
4222
+ if (!returning) {
4223
+ returning = null;
4224
+ }
4105
4225
  let children = [[fn.leadingComment, fn.expr, fn.trailingComment].map(skipIfOnlyWS), " ", arg];
4106
4226
  switch (fn.expr.token) {
4107
- case "yield":
4108
- case "await":
4109
- if (fn.expr.op) {
4110
- children = processUnaryExpression([fn.expr], arg, void 0);
4111
- }
4112
- if (returning) {
4113
- return [
4114
- children,
4115
- returning
4116
- ];
4117
- }
4227
+ case "await": {
4228
+ children = processUnaryExpression([fn.expr], arg, void 0);
4229
+ }
4230
+ case "yield": {
4118
4231
  return [
4119
4232
  children,
4120
- null
4233
+ returning
4121
4234
  ];
4122
- case "return":
4235
+ }
4236
+ case "return": {
4123
4237
  return [{
4124
4238
  type: "ReturnStatement",
4125
4239
  children
4126
4240
  }, null];
4241
+ }
4127
4242
  }
4128
- if (returning) {
4129
- return [
4130
- constructInvocation(fn, arg),
4131
- returning
4132
- ];
4133
- }
4134
- return [constructInvocation(fn, arg), null];
4243
+ return [
4244
+ constructInvocation(fn, arg),
4245
+ returning
4246
+ ];
4135
4247
  }
4136
4248
  function processPipelineExpressions(statements) {
4137
4249
  gatherRecursiveAll(statements, (n) => n.type === "PipelineExpression").forEach((s) => {
@@ -4388,7 +4500,29 @@ function processForInOf($0, getRef) {
4388
4500
  message: "'own' is only meaningful in for..in loops"
4389
4501
  };
4390
4502
  }
4391
- if (!declaration2 && !own) {
4503
+ const { binding } = declaration;
4504
+ let pattern = binding?.pattern;
4505
+ if (binding?.typeSuffix || inOf.token === "in" && declaration2 && pattern.type !== "Identifier") {
4506
+ const itemRef = makeRef(inOf.token === "in" ? "key" : "item");
4507
+ blockPrefix.push(["", {
4508
+ type: "Declaration",
4509
+ children: [declaration, " = ", itemRef],
4510
+ names: declaration.names
4511
+ }, ";"]);
4512
+ pattern = itemRef;
4513
+ declaration = {
4514
+ type: "ForDeclaration",
4515
+ binding: {
4516
+ type: "Binding",
4517
+ pattern,
4518
+ children: [pattern],
4519
+ names: []
4520
+ },
4521
+ children: ["const ", itemRef],
4522
+ names: []
4523
+ };
4524
+ }
4525
+ if (!(declaration2 || own)) {
4392
4526
  return {
4393
4527
  declaration,
4394
4528
  blockPrefix,
@@ -4427,29 +4561,6 @@ function processForInOf($0, getRef) {
4427
4561
  children: [" ", expRef2, " =", exp]
4428
4562
  };
4429
4563
  }
4430
- const { binding } = declaration;
4431
- let { pattern } = binding;
4432
- if (!(pattern.type === "Identifier")) {
4433
- const keyRef = makeRef("key");
4434
- blockPrefix.push(["", [
4435
- declaration,
4436
- " = ",
4437
- keyRef
4438
- ], ";"]);
4439
- pattern = keyRef;
4440
- declaration = {
4441
- type: "ForDeclaration",
4442
- binding: {
4443
- type: "Binding",
4444
- pattern,
4445
- children: [pattern],
4446
- names: [],
4447
- suffix: binding.suffix
4448
- },
4449
- children: ["const ", keyRef],
4450
- names: []
4451
- };
4452
- }
4453
4564
  if (own) {
4454
4565
  const hasPropRef = getRef("hasProp");
4455
4566
  blockPrefix.push(["", ["if (!", hasPropRef, "(", insertTrimmingSpace(expRef2, ""), ", ", insertTrimmingSpace(pattern, ""), ")) continue"], ";"]);
@@ -6131,44 +6242,82 @@ function attachPostfixStatementAsExpression(exp, post) {
6131
6242
  }
6132
6243
  function processTypes(node) {
6133
6244
  return gatherRecursiveAll(node, (n) => n.type === "TypeUnary").forEach((unary) => {
6134
- let last;
6135
- let count = 0;
6136
- let ref10;
6137
- while (unary.suffix.length && (ref10 = unary.suffix)[ref10.length - 1]?.token === "?") {
6138
- last = unary.suffix.pop();
6139
- count++;
6140
- }
6141
- if (!count) {
6245
+ if (!unary.suffix.length) {
6142
6246
  return;
6143
6247
  }
6144
- let ref11;
6145
- if (unary.suffix.length || unary.prefix.length)
6146
- ref11 = unary;
6147
- else
6148
- ref11 = unary.t;
6149
- const t = ref11;
6150
- if (unary.parent?.type === "TypeTuple") {
6151
- if (count === 1) {
6152
- unary.suffix.push(last);
6153
- return;
6248
+ let ref10;
6249
+ let m3;
6250
+ if (m3 = (ref10 = unary.suffix)[ref10.length - 1], typeof m3 === "object" && m3 != null && "token" in m3 && m3.token === "?") {
6251
+ const { token } = m3;
6252
+ let last;
6253
+ let count = 0;
6254
+ let ref11;
6255
+ while (unary.suffix.length && (ref11 = unary.suffix)[ref11.length - 1]?.token === "?") {
6256
+ last = unary.suffix.pop();
6257
+ count++;
6154
6258
  }
6155
- replaceNode(unary, [
6156
- getTrimmingSpace(unary),
6157
- "(",
6158
- parenthesizeType(trimFirstSpace(t)),
6159
- " | null)",
6160
- last
6161
- ]);
6162
- } else {
6163
- replaceNode(unary, {
6164
- type: "TypeParenthesized",
6165
- ts: true,
6166
- children: [
6259
+ let ref12;
6260
+ while (unary.suffix.length && (ref12 = unary.suffix)[ref12.length - 1]?.type === "NonNullAssertion") {
6261
+ unary.suffix.pop();
6262
+ }
6263
+ let ref13;
6264
+ if (unary.suffix.length || unary.prefix.length)
6265
+ ref13 = unary;
6266
+ else
6267
+ ref13 = unary.t;
6268
+ const t = ref13;
6269
+ if (unary.parent?.type === "TypeTuple") {
6270
+ if (count === 1) {
6271
+ unary.suffix.push(last);
6272
+ return;
6273
+ }
6274
+ replaceNode(unary, [
6167
6275
  getTrimmingSpace(unary),
6168
6276
  "(",
6169
6277
  parenthesizeType(trimFirstSpace(t)),
6170
- count === 1 ? " | undefined" : " | undefined | null",
6171
- ")"
6278
+ " | null)",
6279
+ last
6280
+ ]);
6281
+ } else {
6282
+ replaceNode(unary, {
6283
+ type: "TypeParenthesized",
6284
+ ts: true,
6285
+ children: [
6286
+ getTrimmingSpace(unary),
6287
+ "(",
6288
+ parenthesizeType(trimFirstSpace(t)),
6289
+ count === 1 ? " | undefined" : " | undefined | null",
6290
+ ")"
6291
+ ]
6292
+ });
6293
+ }
6294
+ } else if (typeof m3 === "object" && m3 != null && "type" in m3 && m3.type === "NonNullAssertion") {
6295
+ const { type } = m3;
6296
+ let ref14;
6297
+ while (unary.suffix.length && (ref14 = unary.suffix)[ref14.length - 1]?.type === "NonNullAssertion") {
6298
+ unary.suffix.pop();
6299
+ }
6300
+ let ref15;
6301
+ while (unary.suffix.length && (ref15 = unary.suffix)[ref15.length - 1]?.token === "?") {
6302
+ unary.suffix.pop();
6303
+ }
6304
+ const t = trimFirstSpace(
6305
+ unary.suffix.length || unary.prefix.length ? unary : unary.t
6306
+ );
6307
+ const args = {
6308
+ type: "TypeArguments",
6309
+ ts: true,
6310
+ types: [t],
6311
+ children: ["<", t, ">"]
6312
+ };
6313
+ replaceNode(unary, {
6314
+ type: "TypeIdentifier",
6315
+ raw: "NonNullable",
6316
+ args,
6317
+ children: [
6318
+ getTrimmingSpace(unary),
6319
+ "NonNullable",
6320
+ args
6172
6321
  ]
6173
6322
  });
6174
6323
  }
@@ -6178,11 +6327,11 @@ function processStatementExpressions(statements) {
6178
6327
  gatherRecursiveAll(statements, ($7) => $7.type === "StatementExpression").forEach((_exp) => {
6179
6328
  const exp = _exp;
6180
6329
  const { statement } = exp;
6181
- let ref12;
6330
+ let ref16;
6182
6331
  switch (statement.type) {
6183
6332
  case "IfStatement": {
6184
- if (ref12 = expressionizeIfStatement(statement)) {
6185
- const expression = ref12;
6333
+ if (ref16 = expressionizeIfStatement(statement)) {
6334
+ const expression = ref16;
6186
6335
  return replaceNode(statement, expression, exp);
6187
6336
  } else {
6188
6337
  return replaceNode(statement, wrapIIFE([["", statement]]), exp);
@@ -6245,6 +6394,7 @@ function processProgram(root) {
6245
6394
  assert.equal(state2.forbidBracedApplication.length, 1, "forbidBracedApplication");
6246
6395
  assert.equal(state2.forbidClassImplicitCall.length, 1, "forbidClassImplicitCall");
6247
6396
  assert.equal(state2.forbidIndentedApplication.length, 1, "forbidIndentedApplication");
6397
+ assert.equal(state2.forbidNestedBinaryOp.length, 1, "forbidNestedBinaryOp");
6248
6398
  assert.equal(state2.forbidNewlineBinaryOp.length, 1, "forbidNewlineBinaryOp");
6249
6399
  assert.equal(state2.forbidTrailingMemberProperty.length, 1, "forbidTrailingMemberProperty");
6250
6400
  assert.equal(state2.JSXTagStack.length, 1, "JSXTagStack");
@@ -6328,10 +6478,10 @@ function processPlaceholders(statements) {
6328
6478
  if (type === "IfStatement") {
6329
6479
  liftedIfs.add(ancestor2);
6330
6480
  }
6331
- let m3;
6332
6481
  let m4;
6482
+ let m5;
6333
6483
  return type === "Call" || // Block, except for if/else blocks when condition already lifted
6334
- type === "BlockStatement" && !((m3 = ancestor2.parent, typeof m3 === "object" && m3 != null && "type" in m3 && m3.type === "IfStatement") && liftedIfs.has(ancestor2.parent)) && !((m4 = ancestor2.parent, typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "ElseClause" && "parent" in m4 && typeof m4.parent === "object" && m4.parent != null && "type" in m4.parent && m4.parent.type === "IfStatement") && liftedIfs.has(ancestor2.parent.parent)) || type === "PipelineExpression" || // Declaration
6484
+ type === "BlockStatement" && !((m4 = ancestor2.parent, typeof m4 === "object" && m4 != null && "type" in m4 && m4.type === "IfStatement") && liftedIfs.has(ancestor2.parent)) && !((m5 = ancestor2.parent, typeof m5 === "object" && m5 != null && "type" in m5 && m5.type === "ElseClause" && "parent" in m5 && typeof m5.parent === "object" && m5.parent != null && "type" in m5.parent && m5.parent.type === "IfStatement") && liftedIfs.has(ancestor2.parent.parent)) || type === "PipelineExpression" || // Declaration
6335
6485
  type === "Initializer" || // Right-hand side of assignment
6336
6486
  type === "AssignmentExpression" && findChildIndex(ancestor2, child2) === ancestor2.children.indexOf(ancestor2.expression) || type === "ReturnStatement" || type === "YieldExpression";
6337
6487
  }));
@@ -6410,14 +6560,18 @@ function processPlaceholders(statements) {
6410
6560
  for (let i4 = 0, len3 = placeholders.length; i4 < len3; i4++) {
6411
6561
  const placeholder = placeholders[i4];
6412
6562
  typeSuffix ??= placeholder.typeSuffix;
6413
- let ref13;
6414
- replaceNode((ref13 = placeholder.children)[ref13.length - 1], ref);
6563
+ let ref17;
6564
+ replaceNode((ref17 = placeholder.children)[ref17.length - 1], ref);
6415
6565
  }
6416
6566
  const { parent } = ancestor;
6417
6567
  const body = maybeUnwrap(ancestor);
6418
6568
  let fnExp = makeAmpersandFunction({ ref, typeSuffix, body });
6419
6569
  let outer;
6420
6570
  switch (parent?.type) {
6571
+ case "Argument": {
6572
+ outer = ancestor === parent.expression;
6573
+ break;
6574
+ }
6421
6575
  case "Call": {
6422
6576
  outer = ancestor === parent.args[findChildIndex(parent.args, ancestor)];
6423
6577
  break;
@@ -6428,16 +6582,16 @@ function processPlaceholders(statements) {
6428
6582
  }
6429
6583
  case "PipelineExpression": {
6430
6584
  const i = findChildIndex(parent, ancestor);
6431
- let ref14;
6585
+ let ref18;
6432
6586
  if (i === 1) {
6433
- ref14 = ancestor === parent.children[i];
6587
+ ref18 = ancestor === parent.children[i];
6434
6588
  } else if (i === 2) {
6435
- ref14 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
6589
+ ref18 = ancestor === parent.children[i][findChildIndex(parent.children[i], ancestor)][3];
6436
6590
  } else {
6437
- ref14 = void 0;
6591
+ ref18 = void 0;
6438
6592
  }
6439
6593
  ;
6440
- outer = ref14;
6594
+ outer = ref18;
6441
6595
  break;
6442
6596
  }
6443
6597
  case "AssignmentExpression":
@@ -6452,9 +6606,9 @@ function processPlaceholders(statements) {
6452
6606
  fnExp = makeLeftHandSideExpression(fnExp);
6453
6607
  }
6454
6608
  replaceNode(ancestor, fnExp, parent);
6455
- let ref15;
6456
- if (ref15 = getTrimmingSpace(body)) {
6457
- const ws = ref15;
6609
+ let ref19;
6610
+ if (ref19 = getTrimmingSpace(body)) {
6611
+ const ws = ref19;
6458
6612
  inplaceInsertTrimmingSpace(body, "");
6459
6613
  inplacePrepend(ws, fnExp);
6460
6614
  }
@@ -6499,8 +6653,8 @@ function reorderBindingRestProperty(props) {
6499
6653
  }
6500
6654
  ];
6501
6655
  }
6502
- let ref16;
6503
- if (Array.isArray(rest.delim) && (ref16 = rest.delim)[ref16.length - 1]?.token === ",") {
6656
+ let ref20;
6657
+ if (Array.isArray(rest.delim) && (ref20 = rest.delim)[ref20.length - 1]?.token === ",") {
6504
6658
  rest.delim = rest.delim.slice(0, -1);
6505
6659
  rest.children = [...rest.children.slice(0, -1), rest.delim];
6506
6660
  }
@@ -6661,13 +6815,13 @@ var grammar = {
6661
6815
  AllowedTrailingCallExpressions,
6662
6816
  CommaDelimiter,
6663
6817
  ArgumentList,
6664
- NonPipelineArgumentList,
6665
6818
  NestedArgumentList,
6666
6819
  NestedArgument,
6667
6820
  SingleLineArgumentExpressions,
6821
+ WArgumentPart,
6668
6822
  ArgumentPart,
6669
- NonPipelineArgumentPart,
6670
6823
  BinaryOpExpression,
6824
+ BinaryOpNotDedented,
6671
6825
  BinaryOpRHS,
6672
6826
  IsLike,
6673
6827
  WRHS,
@@ -6676,6 +6830,8 @@ var grammar = {
6676
6830
  UnaryExpression,
6677
6831
  UnaryWithoutParenthesizedAssignment,
6678
6832
  UnaryBody,
6833
+ MaybeNestedCoffeeDoBody,
6834
+ CoffeeDoBody,
6679
6835
  UnaryWithoutParenthesizedAssignmentBody,
6680
6836
  ParenthesizedAssignment,
6681
6837
  UnaryPostfix,
@@ -6698,12 +6854,15 @@ var grammar = {
6698
6854
  FatArrowToken,
6699
6855
  TrailingDeclaration,
6700
6856
  TrailingPipe,
6857
+ TrailingPostfix,
6701
6858
  FatArrowBody,
6702
6859
  ConditionalExpression,
6703
6860
  TernaryRest,
6704
6861
  NestedTernaryRest,
6705
6862
  ShortCircuitExpression,
6706
6863
  PipelineExpression,
6864
+ PipelineExpressionBody,
6865
+ PipelineExpressionBodySameLine,
6707
6866
  PipelineHeadItem,
6708
6867
  PipelineTailItem,
6709
6868
  PrimaryExpression,
@@ -6913,7 +7072,6 @@ var grammar = {
6913
7072
  PostfixedNoCommaStatement,
6914
7073
  PostfixedExpression,
6915
7074
  PostfixedCommaExpression,
6916
- NonPipelinePostfixedExpression,
6917
7075
  PostfixStatement,
6918
7076
  _PostfixStatement,
6919
7077
  Statement,
@@ -6991,10 +7149,18 @@ var grammar = {
6991
7149
  AllowTrailingMemberProperty,
6992
7150
  RestoreTrailingMemberProperty,
6993
7151
  TrailingMemberPropertyAllowed,
7152
+ AllowNestedBinaryOp,
7153
+ ForbidNestedBinaryOp,
7154
+ RestoreNestedBinaryOp,
7155
+ NestedBinaryOpAllowed,
6994
7156
  AllowNewlineBinaryOp,
6995
7157
  ForbidNewlineBinaryOp,
6996
7158
  RestoreNewlineBinaryOp,
6997
7159
  NewlineBinaryOpAllowed,
7160
+ AllowPipeline,
7161
+ ForbidPipeline,
7162
+ RestorePipeline,
7163
+ PipelineAllowed,
6998
7164
  AllowAll,
6999
7165
  RestoreAll,
7000
7166
  CommaExpressionStatement,
@@ -7008,6 +7174,7 @@ var grammar = {
7008
7174
  MaybeNestedNonPipelineExtendedExpression,
7009
7175
  MaybeNestedPostfixedExpression,
7010
7176
  MaybeNestedExtendedExpression,
7177
+ NestedExtendedExpression,
7011
7178
  MaybeParenNestedExtendedExpression,
7012
7179
  ImportDeclaration,
7013
7180
  ImpliedImport,
@@ -7942,16 +8109,16 @@ var Arguments$$ = [Arguments$0, Arguments$1];
7942
8109
  function Arguments(ctx, state2) {
7943
8110
  return (0, import_lib3.$EVENT_C)(ctx, state2, "Arguments", Arguments$$);
7944
8111
  }
7945
- var ImplicitArguments$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ApplicationStart, InsertOpenParen, (0, import_lib3.$E)(Trimmed_), NonPipelineArgumentList, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
8112
+ var ImplicitArguments$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ApplicationStart, InsertOpenParen, (0, import_lib3.$E)(Trimmed_), ForbidNestedBinaryOp, ForbidPipeline, (0, import_lib3.$E)(ArgumentList), RestorePipeline, RestoreNestedBinaryOp, InsertCloseParen), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
7946
8113
  var open = $2;
7947
8114
  var ws = $3;
7948
- var args = $4;
7949
- var close = $5;
8115
+ var args = $6;
8116
+ var close = $9;
8117
+ if (!args)
8118
+ return $skip;
7950
8119
  if (skipImplicitArguments(args))
7951
8120
  return $skip;
7952
- let last = args[args.length - 1];
7953
- if (last?.token === "," && last.implicit)
7954
- args = args.slice(0, -1);
8121
+ args = stripTrailingImplicitComma(args);
7955
8122
  return {
7956
8123
  type: "Call",
7957
8124
  args,
@@ -8061,33 +8228,7 @@ var CommaDelimiter$0 = (0, import_lib3.$S)(NotDedented, Comma);
8061
8228
  function CommaDelimiter(ctx, state2) {
8062
8229
  return (0, import_lib3.$EVENT)(ctx, state2, "CommaDelimiter", CommaDelimiter$0);
8063
8230
  }
8064
- var ArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(ArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$N)(EOS), (0, import_lib3.$E)(_), ArgumentPart)), (0, import_lib3.$P)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral, NestedArgumentList)))), function($skip, $loc, $0, $1, $2, $3) {
8065
- return [
8066
- $1,
8067
- ...$2.flatMap(([comma, eos, ws, arg]) => [comma, prepend(ws, arg)]),
8068
- ...$3.flatMap(
8069
- ([comma, args]) => Array.isArray(args) ? [comma, ...args] : [comma, args]
8070
- )
8071
- ];
8072
- });
8073
- var ArgumentList$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(NestedBulletedArray), function($skip, $loc, $0, $1) {
8074
- return [trimFirstSpace($1)];
8075
- });
8076
- var ArgumentList$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(NestedImplicitObjectLiteral), function($skip, $loc, $0, $1) {
8077
- return [trimFirstSpace($1)];
8078
- });
8079
- var ArgumentList$3 = NestedArgumentList;
8080
- var ArgumentList$4 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$E)(_), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
8081
- return [
8082
- prepend($1, $2),
8083
- ...$3.flatMap(([comma, ws, arg]) => [comma, prepend(ws, arg)])
8084
- ];
8085
- });
8086
- var ArgumentList$$ = [ArgumentList$0, ArgumentList$1, ArgumentList$2, ArgumentList$3, ArgumentList$4];
8087
- function ArgumentList(ctx, state2) {
8088
- return (0, import_lib3.$EVENT_C)(ctx, state2, "ArgumentList", ArgumentList$$);
8089
- }
8090
- var NonPipelineArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), NonPipelineArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$N)(EOS), (0, import_lib3.$E)(_), NonPipelineArgumentPart)), (0, import_lib3.$P)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral, NestedArgumentList)))), function($skip, $loc, $0, $1, $2, $3, $4) {
8231
+ var ArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), ArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$N)(EOS), (0, import_lib3.$E)(_), ArgumentPart)), (0, import_lib3.$P)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral, NestedArgumentList)))), function($skip, $loc, $0, $1, $2, $3, $4) {
8091
8232
  return [
8092
8233
  $2,
8093
8234
  ...$3.flatMap(([comma, eos, ws, arg]) => [comma, prepend(ws, arg)]),
@@ -8096,7 +8237,7 @@ var NonPipelineArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, imp
8096
8237
  )
8097
8238
  ];
8098
8239
  });
8099
- var NonPipelineArgumentList$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral), (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral, NestedArgumentList)))), function($skip, $loc, $0, $1, $2) {
8240
+ var ArgumentList$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral), (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$C)(NestedBulletedArray, NestedImplicitObjectLiteral, NestedArgumentList)))), function($skip, $loc, $0, $1, $2) {
8100
8241
  return [
8101
8242
  trimFirstSpace($1),
8102
8243
  ...$2.flatMap(
@@ -8104,19 +8245,19 @@ var NonPipelineArgumentList$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, imp
8104
8245
  )
8105
8246
  ];
8106
8247
  });
8107
- var NonPipelineArgumentList$2 = NestedArgumentList;
8108
- var NonPipelineArgumentList$3 = (0, import_lib3.$TS)((0, import_lib3.$S)(NonPipelineArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$E)(_), NonPipelineArgumentPart))), function($skip, $loc, $0, $1, $2) {
8248
+ var ArgumentList$2 = NestedArgumentList;
8249
+ var ArgumentList$3 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)(CommaDelimiter, (0, import_lib3.$E)(_), ArgumentPart))), function($skip, $loc, $0, $1, $2, $3) {
8109
8250
  return [
8110
- $1,
8111
- ...$2.flatMap(([comma, ws, arg]) => [comma, prepend(ws, arg)])
8251
+ prepend($1, $2),
8252
+ ...$3.flatMap(([comma, ws, arg]) => [comma, prepend(ws, arg)])
8112
8253
  ];
8113
8254
  });
8114
- var NonPipelineArgumentList$$ = [NonPipelineArgumentList$0, NonPipelineArgumentList$1, NonPipelineArgumentList$2, NonPipelineArgumentList$3];
8115
- function NonPipelineArgumentList(ctx, state2) {
8116
- return (0, import_lib3.$EVENT_C)(ctx, state2, "NonPipelineArgumentList", NonPipelineArgumentList$$);
8255
+ var ArgumentList$$ = [ArgumentList$0, ArgumentList$1, ArgumentList$2, ArgumentList$3];
8256
+ function ArgumentList(ctx, state2) {
8257
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "ArgumentList", ArgumentList$$);
8117
8258
  }
8118
- var NestedArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$Q)(NestedArgument), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
8119
- var args = $2;
8259
+ var NestedArgumentList$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, AllowPipeline, (0, import_lib3.$Q)(NestedArgument), RestorePipeline, PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
8260
+ var args = $3;
8120
8261
  if (!args.length)
8121
8262
  return $skip;
8122
8263
  return args.flat();
@@ -8129,40 +8270,48 @@ var NestedArgument$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Nested, SingleLi
8129
8270
  var args = $2;
8130
8271
  var comma = $3;
8131
8272
  let [arg0, ...rest] = args;
8132
- arg0 = [indent, ...arg0];
8273
+ arg0 = prepend(indent, arg0);
8133
8274
  return [arg0, ...rest, comma];
8134
8275
  });
8135
8276
  function NestedArgument(ctx, state2) {
8136
8277
  return (0, import_lib3.$EVENT)(ctx, state2, "NestedArgument", NestedArgument$0);
8137
8278
  }
8138
- var SingleLineArgumentExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart), (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$S)((0, import_lib3.$E)(_), Comma), (0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart)))), function($skip, $loc, $0, $1, $2) {
8279
+ var SingleLineArgumentExpressions$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(WArgumentPart, (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$S)((0, import_lib3.$E)(_), Comma), WArgumentPart))), function($skip, $loc, $0, $1, $2) {
8139
8280
  return [$1, ...$2.flat()];
8140
8281
  });
8141
8282
  function SingleLineArgumentExpressions(ctx, state2) {
8142
8283
  return (0, import_lib3.$EVENT)(ctx, state2, "SingleLineArgumentExpressions", SingleLineArgumentExpressions$0);
8143
8284
  }
8144
- var ArgumentPart$0 = (0, import_lib3.$S)(DotDotDot, ExtendedExpression);
8285
+ var WArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), ArgumentPart), function($skip, $loc, $0, $1, $2) {
8286
+ return prepend($1, $2);
8287
+ });
8288
+ function WArgumentPart(ctx, state2) {
8289
+ return (0, import_lib3.$EVENT)(ctx, state2, "WArgumentPart", WArgumentPart$0);
8290
+ }
8291
+ var ArgumentPart$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(DotDotDot, ExtendedExpression), function($skip, $loc, $0, $1, $2) {
8292
+ var spread = $1;
8293
+ var expression = $2;
8294
+ return {
8295
+ type: "Argument",
8296
+ children: $0,
8297
+ expression,
8298
+ spread
8299
+ };
8300
+ });
8145
8301
  var ArgumentPart$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(ExtendedExpression, (0, import_lib3.$E)(DotDotDot)), function($skip, $loc, $0, $1, $2) {
8146
- if ($2) {
8147
- return [$2, $1];
8148
- }
8149
- return $1;
8302
+ var expression = $1;
8303
+ var spread = $2;
8304
+ return {
8305
+ type: "Argument",
8306
+ children: spread ? [spread, expression] : [expression],
8307
+ expression,
8308
+ spread
8309
+ };
8150
8310
  });
8151
8311
  var ArgumentPart$$ = [ArgumentPart$0, ArgumentPart$1];
8152
8312
  function ArgumentPart(ctx, state2) {
8153
8313
  return (0, import_lib3.$EVENT_C)(ctx, state2, "ArgumentPart", ArgumentPart$$);
8154
8314
  }
8155
- var NonPipelineArgumentPart$0 = (0, import_lib3.$S)(DotDotDot, NonPipelineExtendedExpression);
8156
- var NonPipelineArgumentPart$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(NonPipelineExtendedExpression, (0, import_lib3.$E)(DotDotDot)), function($skip, $loc, $0, $1, $2) {
8157
- if ($2) {
8158
- return [$2, $1];
8159
- }
8160
- return $1;
8161
- });
8162
- var NonPipelineArgumentPart$$ = [NonPipelineArgumentPart$0, NonPipelineArgumentPart$1];
8163
- function NonPipelineArgumentPart(ctx, state2) {
8164
- return (0, import_lib3.$EVENT_C)(ctx, state2, "NonPipelineArgumentPart", NonPipelineArgumentPart$$);
8165
- }
8166
8315
  var BinaryOpExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(UnaryExpression, (0, import_lib3.$Q)(BinaryOpRHS)), function($skip, $loc, $0, $1, $2) {
8167
8316
  if (!$2.length)
8168
8317
  return $1;
@@ -8171,7 +8320,13 @@ var BinaryOpExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(UnaryExpress
8171
8320
  function BinaryOpExpression(ctx, state2) {
8172
8321
  return (0, import_lib3.$EVENT)(ctx, state2, "BinaryOpExpression", BinaryOpExpression$0);
8173
8322
  }
8174
- var BinaryOpRHS$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(NotDedented, IsLike, (0, import_lib3.$E)(_), PatternExpressionList), function($skip, $loc, $0, $1, $2, $3, $4) {
8323
+ var BinaryOpNotDedented$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$C)(NestedBinaryOpAllowed, (0, import_lib3.$N)(Nested)), NotDedented), function(value) {
8324
+ return value[1];
8325
+ });
8326
+ function BinaryOpNotDedented(ctx, state2) {
8327
+ return (0, import_lib3.$EVENT)(ctx, state2, "BinaryOpNotDedented", BinaryOpNotDedented$0);
8328
+ }
8329
+ var BinaryOpRHS$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BinaryOpNotDedented, IsLike, (0, import_lib3.$E)(_), PatternExpressionList), function($skip, $loc, $0, $1, $2, $3, $4) {
8175
8330
  var ws1 = $1;
8176
8331
  var op = $2;
8177
8332
  var ws2 = $3;
@@ -8234,17 +8389,18 @@ var RHS$$ = [RHS$0, RHS$1];
8234
8389
  function RHS(ctx, state2) {
8235
8390
  return (0, import_lib3.$EVENT_C)(ctx, state2, "RHS", RHS$$);
8236
8391
  }
8237
- var UnaryExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(UnaryOp), UnaryBody, (0, import_lib3.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3) {
8392
+ var UnaryExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(IndentedApplicationAllowed, (0, import_lib3.$P)(UnaryOp), (0, import_lib3.$C)(ArrayLiteral, NestedArgumentList), (0, import_lib3.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3, $4) {
8393
+ var pre = $2;
8394
+ var args = $3;
8395
+ var post = $4;
8396
+ return processUnaryNestedExpression(pre, args, post) ?? $skip;
8397
+ });
8398
+ var UnaryExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$Q)(UnaryOp), UnaryBody, (0, import_lib3.$E)(UnaryPostfix)), function($skip, $loc, $0, $1, $2, $3) {
8238
8399
  var pre = $1;
8239
8400
  var exp = $2;
8240
8401
  var post = $3;
8241
8402
  return processUnaryExpression(pre, exp, post);
8242
8403
  });
8243
- var UnaryExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(CoffeeDoEnabled, Do, __, (0, import_lib3.$C)(ArrowFunction, (0, import_lib3.$S)(LeftHandSideExpression, (0, import_lib3.$N)((0, import_lib3.$S)(__, AssignmentOpSymbol))), ExtendedExpression)), function($skip, $loc, $0, $1, $2, $3, $4) {
8244
- var ws = $3;
8245
- var exp = $4;
8246
- return processCoffeeDo(ws, exp);
8247
- });
8248
8404
  var UnaryExpression$$ = [UnaryExpression$0, UnaryExpression$1];
8249
8405
  function UnaryExpression(ctx, state2) {
8250
8406
  return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryExpression", UnaryExpression$$);
@@ -8258,14 +8414,35 @@ var UnaryWithoutParenthesizedAssignment$0 = (0, import_lib3.$TS)((0, import_lib3
8258
8414
  function UnaryWithoutParenthesizedAssignment(ctx, state2) {
8259
8415
  return (0, import_lib3.$EVENT)(ctx, state2, "UnaryWithoutParenthesizedAssignment", UnaryWithoutParenthesizedAssignment$0);
8260
8416
  }
8261
- var UnaryBody$0 = ParenthesizedAssignment;
8262
- var UnaryBody$1 = ExpressionizedStatementWithTrailingCallExpressions;
8263
- var UnaryBody$2 = UpdateExpression;
8264
- var UnaryBody$3 = NestedNonAssignmentExtendedExpression;
8265
- var UnaryBody$$ = [UnaryBody$0, UnaryBody$1, UnaryBody$2, UnaryBody$3];
8417
+ var UnaryBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(CoffeeDoEnabled, Do, MaybeNestedCoffeeDoBody), function($skip, $loc, $0, $1, $2, $3) {
8418
+ var body = $3;
8419
+ return processCoffeeDo(...body);
8420
+ });
8421
+ var UnaryBody$1 = ParenthesizedAssignment;
8422
+ var UnaryBody$2 = ExpressionizedStatementWithTrailingCallExpressions;
8423
+ var UnaryBody$3 = UpdateExpression;
8424
+ var UnaryBody$4 = NestedNonAssignmentExtendedExpression;
8425
+ var UnaryBody$$ = [UnaryBody$0, UnaryBody$1, UnaryBody$2, UnaryBody$3, UnaryBody$4];
8266
8426
  function UnaryBody(ctx, state2) {
8267
8427
  return (0, import_lib3.$EVENT_C)(ctx, state2, "UnaryBody", UnaryBody$$);
8268
8428
  }
8429
+ var MaybeNestedCoffeeDoBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$E)((0, import_lib3.$S)(Nested, CoffeeDoBody)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
8430
+ if (!$2)
8431
+ return $skip;
8432
+ return $2;
8433
+ });
8434
+ var MaybeNestedCoffeeDoBody$1 = (0, import_lib3.$S)((0, import_lib3.$E)(_), CoffeeDoBody);
8435
+ var MaybeNestedCoffeeDoBody$$ = [MaybeNestedCoffeeDoBody$0, MaybeNestedCoffeeDoBody$1];
8436
+ function MaybeNestedCoffeeDoBody(ctx, state2) {
8437
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedCoffeeDoBody", MaybeNestedCoffeeDoBody$$);
8438
+ }
8439
+ var CoffeeDoBody$0 = ArrowFunction;
8440
+ var CoffeeDoBody$1 = (0, import_lib3.$S)(LeftHandSideExpression, (0, import_lib3.$N)((0, import_lib3.$S)(__, AssignmentOpSymbol)));
8441
+ var CoffeeDoBody$2 = ExtendedExpression;
8442
+ var CoffeeDoBody$$ = [CoffeeDoBody$0, CoffeeDoBody$1, CoffeeDoBody$2];
8443
+ function CoffeeDoBody(ctx, state2) {
8444
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "CoffeeDoBody", CoffeeDoBody$$);
8445
+ }
8269
8446
  var UnaryWithoutParenthesizedAssignmentBody$0 = UpdateExpression;
8270
8447
  var UnaryWithoutParenthesizedAssignmentBody$1 = ExpressionizedStatementWithTrailingCallExpressions;
8271
8448
  var UnaryWithoutParenthesizedAssignmentBody$2 = NestedNonAssignmentExtendedExpression;
@@ -8464,7 +8641,7 @@ var ArrowFunction$0 = ThinArrowFunction;
8464
8641
  var ArrowFunction$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Async, _)), ArrowParameters, (0, import_lib3.$E)(ReturnTypeSuffix), FatArrow, FatArrowBody), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
8465
8642
  var async = $1;
8466
8643
  var parameters = $2;
8467
- var suffix = $3;
8644
+ var returnType = $3;
8468
8645
  var arrow = $4;
8469
8646
  var expOrBlock = $5;
8470
8647
  if (!async)
@@ -8475,13 +8652,13 @@ var ArrowFunction$1 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$
8475
8652
  modifier: {
8476
8653
  async: !!async.length
8477
8654
  },
8478
- returnType: suffix
8655
+ returnType
8479
8656
  },
8480
8657
  parameters,
8481
- returnType: suffix,
8658
+ returnType,
8482
8659
  async,
8483
8660
  block: expOrBlock,
8484
- children: [async, parameters, suffix, arrow, expOrBlock]
8661
+ children: [async, parameters, returnType, arrow, expOrBlock]
8485
8662
  };
8486
8663
  });
8487
8664
  var ArrowFunction$$ = [ArrowFunction$0, ArrowFunction$1];
@@ -8512,7 +8689,11 @@ var TrailingPipe$0 = (0, import_lib3.$S)((0, import_lib3.$E)(_), Pipe);
8512
8689
  function TrailingPipe(ctx, state2) {
8513
8690
  return (0, import_lib3.$EVENT)(ctx, state2, "TrailingPipe", TrailingPipe$0);
8514
8691
  }
8515
- var FatArrowBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), (0, import_lib3.$N)((0, import_lib3.$S)((0, import_lib3.$E)(_), ExpressionizedStatement)), NonPipelinePostfixedExpression, (0, import_lib3.$N)(TrailingDeclaration), (0, import_lib3.$N)(TrailingPipe), (0, import_lib3.$N)(SemicolonDelimiter)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
8692
+ var TrailingPostfix$0 = (0, import_lib3.$S)((0, import_lib3.$E)(_), PostfixStatement);
8693
+ function TrailingPostfix(ctx, state2) {
8694
+ return (0, import_lib3.$EVENT)(ctx, state2, "TrailingPostfix", TrailingPostfix$0);
8695
+ }
8696
+ var FatArrowBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), (0, import_lib3.$N)((0, import_lib3.$S)((0, import_lib3.$E)(_), ExpressionizedStatement)), NonPipelineExtendedExpression, (0, import_lib3.$N)(TrailingDeclaration), (0, import_lib3.$N)(TrailingPipe), (0, import_lib3.$N)(TrailingPostfix), (0, import_lib3.$N)(SemicolonDelimiter)), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
8516
8697
  var exp = $3;
8517
8698
  if (exp.type === "ObjectExpression") {
8518
8699
  exp = makeLeftHandSideExpression(exp);
@@ -8562,10 +8743,10 @@ var ShortCircuitExpression$0 = BinaryOpExpression;
8562
8743
  function ShortCircuitExpression(ctx, state2) {
8563
8744
  return (0, import_lib3.$EVENT)(ctx, state2, "ShortCircuitExpression", ShortCircuitExpression$0);
8564
8745
  }
8565
- var PipelineExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(_), PipelineHeadItem, (0, import_lib3.$P)((0, import_lib3.$S)(NotDedented, Pipe, __, PipelineTailItem))), function($skip, $loc, $0, $1, $2, $3) {
8566
- var ws = $1;
8567
- var head = $2;
8568
- var body = $3;
8746
+ var PipelineExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PipelineAllowed, (0, import_lib3.$E)(_), PipelineHeadItem, PipelineExpressionBody), function($skip, $loc, $0, $1, $2, $3, $4) {
8747
+ var ws = $2;
8748
+ var head = $3;
8749
+ var body = $4;
8569
8750
  if (head.type === "ArrowFunction" && head.ampersandBlock) {
8570
8751
  const expressions = [{
8571
8752
  type: "PipelineExpression",
@@ -8587,6 +8768,25 @@ var PipelineExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_l
8587
8768
  function PipelineExpression(ctx, state2) {
8588
8769
  return (0, import_lib3.$EVENT)(ctx, state2, "PipelineExpression", PipelineExpression$0);
8589
8770
  }
8771
+ var PipelineExpressionBody$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(PipelineExpressionBodySameLine, PushIndent, (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$S)(Nested, Pipe, __, PipelineTailItem), PipelineExpressionBodySameLine)), PopIndent), function($skip, $loc, $0, $1, $2, $3, $4) {
8772
+ var first = $1;
8773
+ var rest = $3;
8774
+ if (!rest.length)
8775
+ return $skip;
8776
+ return [
8777
+ ...first,
8778
+ ...rest.map(([nested, line]) => [nested, ...line]).flat()
8779
+ ];
8780
+ });
8781
+ var PipelineExpressionBody$1 = (0, import_lib3.$P)((0, import_lib3.$S)(NotDedented, Pipe, __, PipelineTailItem));
8782
+ var PipelineExpressionBody$$ = [PipelineExpressionBody$0, PipelineExpressionBody$1];
8783
+ function PipelineExpressionBody(ctx, state2) {
8784
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "PipelineExpressionBody", PipelineExpressionBody$$);
8785
+ }
8786
+ var PipelineExpressionBodySameLine$0 = (0, import_lib3.$Q)((0, import_lib3.$S)((0, import_lib3.$E)(_), Pipe, __, PipelineTailItem));
8787
+ function PipelineExpressionBodySameLine(ctx, state2) {
8788
+ return (0, import_lib3.$EVENT)(ctx, state2, "PipelineExpressionBodySameLine", PipelineExpressionBodySameLine$0);
8789
+ }
8590
8790
  var PipelineHeadItem$0 = NonPipelineExtendedExpression;
8591
8791
  var PipelineHeadItem$1 = ParenthesizedExpression;
8592
8792
  var PipelineHeadItem$$ = [PipelineHeadItem$0, PipelineHeadItem$1];
@@ -10213,7 +10413,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10213
10413
  var wid = $4;
10214
10414
  var w = $5;
10215
10415
  var parameters = $6;
10216
- var suffix = $7;
10416
+ var returnType = $7;
10217
10417
  if (!async)
10218
10418
  async = [];
10219
10419
  if (!generator)
@@ -10224,7 +10424,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10224
10424
  id,
10225
10425
  name: id?.name,
10226
10426
  parameters,
10227
- returnType: suffix,
10427
+ returnType,
10228
10428
  async,
10229
10429
  generator,
10230
10430
  modifier: {
@@ -10232,7 +10432,7 @@ var FunctionSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10232
10432
  generator: !!generator.length
10233
10433
  },
10234
10434
  block: null,
10235
- children: !parameters.implicit ? [async, func, generator, wid, w, parameters, suffix] : [async, func, generator, wid, parameters, w, suffix]
10435
+ children: !parameters.implicit ? [async, func, generator, wid, w, parameters, returnType] : [async, func, generator, wid, parameters, w, returnType]
10236
10436
  // move whitespace w to after implicit () in parameters
10237
10437
  };
10238
10438
  });
@@ -10431,7 +10631,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10431
10631
  var behavior = $7;
10432
10632
  var w2 = $8;
10433
10633
  var parameters = $9;
10434
- var suffix = $10;
10634
+ var returnType = $10;
10435
10635
  if (!async)
10436
10636
  async = [];
10437
10637
  if (!generator)
@@ -10446,7 +10646,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10446
10646
  id,
10447
10647
  name: id.name,
10448
10648
  parameters,
10449
- returnType: suffix,
10649
+ returnType,
10450
10650
  async,
10451
10651
  generator,
10452
10652
  modifier: {
@@ -10454,7 +10654,7 @@ var OperatorSignature$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10454
10654
  generator: !!generator.length
10455
10655
  },
10456
10656
  block: null,
10457
- children: [async, func, generator, w1, id, w2, parameters, suffix],
10657
+ children: [async, func, generator, w1, id, w2, parameters, returnType],
10458
10658
  behavior
10459
10659
  };
10460
10660
  });
@@ -10501,7 +10701,7 @@ function OperatorAssociativity(ctx, state2) {
10501
10701
  var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)((0, import_lib3.$S)(Async, _)), ArrowParameters, (0, import_lib3.$E)(ReturnTypeSuffix), (0, import_lib3.$E)(_), Arrow, NoCommaBracedOrEmptyBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
10502
10702
  var async = $1;
10503
10703
  var parameters = $2;
10504
- var suffix = $3;
10704
+ var returnType = $3;
10505
10705
  var arrow = $5;
10506
10706
  var block = $6;
10507
10707
  if (!async)
@@ -10511,7 +10711,7 @@ var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10511
10711
  type: "FunctionExpression",
10512
10712
  id: void 0,
10513
10713
  parameters,
10514
- returnType: suffix,
10714
+ returnType,
10515
10715
  async,
10516
10716
  generator,
10517
10717
  block,
@@ -10523,14 +10723,14 @@ var ThinArrowFunction$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_li
10523
10723
  async: !!async.length,
10524
10724
  generator: !!generator.length
10525
10725
  },
10526
- returnType: suffix
10726
+ returnType
10527
10727
  },
10528
10728
  children: [
10529
10729
  async,
10530
10730
  { $loc: arrow.$loc, token: "function" },
10531
10731
  generator,
10532
10732
  parameters,
10533
- suffix,
10733
+ returnType,
10534
10734
  block
10535
10735
  ]
10536
10736
  };
@@ -11227,6 +11427,7 @@ var ArrayElementExpression$2 = (0, import_lib3.$TS)((0, import_lib3.$S)(Extended
11227
11427
  return {
11228
11428
  type: "SpreadElement",
11229
11429
  children: [ws, dots, exp],
11430
+ expression: exp,
11230
11431
  names: exp.names
11231
11432
  };
11232
11433
  });
@@ -11238,12 +11439,14 @@ var ArrayElementExpression$3 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, impo
11238
11439
  return {
11239
11440
  type: "ArrayElement",
11240
11441
  children: [exp],
11442
+ expression: exp,
11241
11443
  names: exp.names
11242
11444
  };
11243
11445
  } else {
11244
11446
  return {
11245
11447
  type: "SpreadElement",
11246
11448
  children: [...spread, exp],
11449
+ expression: exp,
11247
11450
  names: exp.names
11248
11451
  };
11249
11452
  }
@@ -11257,10 +11460,10 @@ var ArrayElementExpression$$ = [ArrayElementExpression$0, ArrayElementExpression
11257
11460
  function ArrayElementExpression(ctx, state2) {
11258
11461
  return (0, import_lib3.$EVENT_C)(ctx, state2, "ArrayElementExpression", ArrayElementExpression$$);
11259
11462
  }
11260
- var NestedBulletedArray$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$S)(InsertSpace, InsertOpenBracket), PushIndent, (0, import_lib3.$Q)(NestedArrayBullet), InsertCloseBracket, PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
11463
+ var NestedBulletedArray$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$S)(InsertSpace, InsertOpenBracket), PushIndent, AllowPipeline, (0, import_lib3.$Q)(NestedArrayBullet), RestorePipeline, InsertCloseBracket, PopIndent), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
11261
11464
  var open = $1;
11262
- var content = $3;
11263
- var close = $4;
11465
+ var content = $4;
11466
+ var close = $6;
11264
11467
  if (!content.length)
11265
11468
  return $skip;
11266
11469
  content = content.flat();
@@ -11287,9 +11490,9 @@ var BulletedArray$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertOpenBracket
11287
11490
  // replace first space with bracket
11288
11491
  ...content[1].flat()
11289
11492
  ];
11290
- const last = content[content.length - 1];
11493
+ let last = content[content.length - 1];
11291
11494
  if (last.children?.at(-1)?.implicit) {
11292
- last.children = last.children.slice(0, -1);
11495
+ content[content.length - 1] = last = { ...last, children: last.children.slice(0, -1) };
11293
11496
  }
11294
11497
  return {
11295
11498
  type: "ArrayExpression",
@@ -11427,8 +11630,8 @@ var BracedObjectLiteralContent$$ = [BracedObjectLiteralContent$0, BracedObjectLi
11427
11630
  function BracedObjectLiteralContent(ctx, state2) {
11428
11631
  return (0, import_lib3.$EVENT_C)(ctx, state2, "BracedObjectLiteralContent", BracedObjectLiteralContent$$);
11429
11632
  }
11430
- var NestedImplicitObjectLiteral$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertOpenBrace, PushIndent, (0, import_lib3.$E)(NestedImplicitPropertyDefinitions), PopIndent, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
11431
- var properties = $3;
11633
+ var NestedImplicitObjectLiteral$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(InsertOpenBrace, PushIndent, AllowPipeline, (0, import_lib3.$E)(NestedImplicitPropertyDefinitions), RestorePipeline, PopIndent, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
11634
+ var properties = $4;
11432
11635
  if (!properties)
11433
11636
  return $skip;
11434
11637
  return {
@@ -12121,18 +12324,23 @@ function CoffeeWordAssignmentOp(ctx, state2) {
12121
12324
  return (0, import_lib3.$EVENT_C)(ctx, state2, "CoffeeWordAssignmentOp", CoffeeWordAssignmentOp$$);
12122
12325
  }
12123
12326
  var NotDedentedBinaryOp$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$E)(IndentedFurther), (0, import_lib3.$E)(_), BinaryOp), function($skip, $loc, $0, $1, $2, $3) {
12327
+ var ws1 = $1;
12328
+ var ws2 = $2;
12329
+ var op = $3;
12124
12330
  const ws = [];
12125
- if ($1)
12126
- ws.push(...$1);
12127
- if ($2)
12128
- ws.push(...$2);
12129
- return [ws, $3];
12331
+ if (ws1)
12332
+ ws.push(...ws1);
12333
+ if (ws2)
12334
+ ws.push(...ws2);
12335
+ return [ws, op];
12130
12336
  });
12131
- var NotDedentedBinaryOp$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(Nested, (0, import_lib3.$E)(_), (0, import_lib3.$N)(Identifier), (0, import_lib3.$C)((0, import_lib3.$N)((0, import_lib3.$EXPECT)($L75, 'NotDedentedBinaryOp "*"')), (0, import_lib3.$N)(ImportDeclaration)), BinaryOp), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
12132
- var op = $5;
12133
- const ws = [...$1];
12134
- if ($2)
12135
- ws.push(...$2);
12337
+ var NotDedentedBinaryOp$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(NestedBinaryOpAllowed, Nested, (0, import_lib3.$E)(_), (0, import_lib3.$N)(Identifier), (0, import_lib3.$C)((0, import_lib3.$N)((0, import_lib3.$EXPECT)($L75, 'NotDedentedBinaryOp "*"')), (0, import_lib3.$N)(ImportDeclaration)), BinaryOp), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
12338
+ var ws1 = $2;
12339
+ var ws2 = $3;
12340
+ var op = $6;
12341
+ const ws = [...ws1];
12342
+ if (ws2)
12343
+ ws.push(...ws2);
12136
12344
  return [ws, op];
12137
12345
  });
12138
12346
  var NotDedentedBinaryOp$$ = [NotDedentedBinaryOp$0, NotDedentedBinaryOp$1];
@@ -12560,16 +12768,6 @@ var PostfixedCommaExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(Postfi
12560
12768
  function PostfixedCommaExpression(ctx, state2) {
12561
12769
  return (0, import_lib3.$EVENT)(ctx, state2, "PostfixedCommaExpression", PostfixedCommaExpression$0);
12562
12770
  }
12563
- var NonPipelinePostfixedExpression$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(NonPipelineExtendedExpression, (0, import_lib3.$E)((0, import_lib3.$S)((0, import_lib3.$E)(_), PostfixStatement))), function($skip, $loc, $0, $1, $2) {
12564
- var expression = $1;
12565
- var post = $2;
12566
- if (post)
12567
- return attachPostfixStatementAsExpression(expression, post);
12568
- return expression;
12569
- });
12570
- function NonPipelinePostfixedExpression(ctx, state2) {
12571
- return (0, import_lib3.$EVENT)(ctx, state2, "NonPipelinePostfixedExpression", NonPipelinePostfixedExpression$0);
12572
- }
12573
12771
  var PostfixStatement$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$EXPECT)($R29, "PostfixStatement /(?=for|if|loop|unless|until|while)/"), _PostfixStatement), function(value) {
12574
12772
  return value[1];
12575
12773
  });
@@ -13179,14 +13377,14 @@ function ForDeclaration(ctx, state2) {
13179
13377
  }
13180
13378
  var ForBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)((0, import_lib3.$C)(BindingPattern, BindingIdentifier), (0, import_lib3.$E)(TypeSuffix)), function($skip, $loc, $0, $1, $2) {
13181
13379
  var pattern = $1;
13182
- var suffix = $2;
13183
- suffix ??= pattern.typeSuffix;
13380
+ var typeSuffix = $2;
13381
+ typeSuffix ??= pattern.typeSuffix;
13184
13382
  return {
13185
13383
  type: "Binding",
13186
- children: [pattern, suffix],
13384
+ children: [pattern, typeSuffix],
13187
13385
  names: pattern.names,
13188
13386
  pattern,
13189
- suffix,
13387
+ typeSuffix,
13190
13388
  splices: [],
13191
13389
  thisAssignments: []
13192
13390
  };
@@ -13659,6 +13857,34 @@ var TrailingMemberPropertyAllowed$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPE
13659
13857
  function TrailingMemberPropertyAllowed(ctx, state2) {
13660
13858
  return (0, import_lib3.$EVENT)(ctx, state2, "TrailingMemberPropertyAllowed", TrailingMemberPropertyAllowed$0);
13661
13859
  }
13860
+ var AllowNestedBinaryOp$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'AllowNestedBinaryOp ""'), function($skip, $loc, $0, $1) {
13861
+ state.forbidNestedBinaryOp.push(false);
13862
+ });
13863
+ function AllowNestedBinaryOp(ctx, state2) {
13864
+ return (0, import_lib3.$EVENT)(ctx, state2, "AllowNestedBinaryOp", AllowNestedBinaryOp$0);
13865
+ }
13866
+ var ForbidNestedBinaryOp$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'ForbidNestedBinaryOp ""'), function($skip, $loc, $0, $1) {
13867
+ state.forbidNestedBinaryOp.push(true);
13868
+ });
13869
+ function ForbidNestedBinaryOp(ctx, state2) {
13870
+ return (0, import_lib3.$EVENT)(ctx, state2, "ForbidNestedBinaryOp", ForbidNestedBinaryOp$0);
13871
+ }
13872
+ var RestoreNestedBinaryOp$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'RestoreNestedBinaryOp ""'), function($skip, $loc, $0, $1) {
13873
+ state.forbidNestedBinaryOp.pop();
13874
+ });
13875
+ function RestoreNestedBinaryOp(ctx, state2) {
13876
+ return (0, import_lib3.$EVENT)(ctx, state2, "RestoreNestedBinaryOp", RestoreNestedBinaryOp$0);
13877
+ }
13878
+ var NestedBinaryOpAllowed$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'NestedBinaryOpAllowed ""'), function($skip, $loc, $0, $1) {
13879
+ if (config.verbose) {
13880
+ console.log("forbidNestedBinaryOp:", state.forbidNestedBinaryOp);
13881
+ }
13882
+ if (state.nestedBinaryOpForbidden)
13883
+ return $skip;
13884
+ });
13885
+ function NestedBinaryOpAllowed(ctx, state2) {
13886
+ return (0, import_lib3.$EVENT)(ctx, state2, "NestedBinaryOpAllowed", NestedBinaryOpAllowed$0);
13887
+ }
13662
13888
  var AllowNewlineBinaryOp$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'AllowNewlineBinaryOp ""'), function($skip, $loc, $0, $1) {
13663
13889
  state.forbidNewlineBinaryOp.push(false);
13664
13890
  });
@@ -13687,11 +13913,39 @@ var NewlineBinaryOpAllowed$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0
13687
13913
  function NewlineBinaryOpAllowed(ctx, state2) {
13688
13914
  return (0, import_lib3.$EVENT)(ctx, state2, "NewlineBinaryOpAllowed", NewlineBinaryOpAllowed$0);
13689
13915
  }
13690
- var AllowAll$0 = (0, import_lib3.$S)(AllowTrailingMemberProperty, AllowBracedApplication, AllowIndentedApplication, AllowClassImplicitCall, AllowNewlineBinaryOp);
13916
+ var AllowPipeline$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'AllowPipeline ""'), function($skip, $loc, $0, $1) {
13917
+ state.forbidPipeline.push(false);
13918
+ });
13919
+ function AllowPipeline(ctx, state2) {
13920
+ return (0, import_lib3.$EVENT)(ctx, state2, "AllowPipeline", AllowPipeline$0);
13921
+ }
13922
+ var ForbidPipeline$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'ForbidPipeline ""'), function($skip, $loc, $0, $1) {
13923
+ state.forbidPipeline.push(true);
13924
+ });
13925
+ function ForbidPipeline(ctx, state2) {
13926
+ return (0, import_lib3.$EVENT)(ctx, state2, "ForbidPipeline", ForbidPipeline$0);
13927
+ }
13928
+ var RestorePipeline$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'RestorePipeline ""'), function($skip, $loc, $0, $1) {
13929
+ state.forbidPipeline.pop();
13930
+ });
13931
+ function RestorePipeline(ctx, state2) {
13932
+ return (0, import_lib3.$EVENT)(ctx, state2, "RestorePipeline", RestorePipeline$0);
13933
+ }
13934
+ var PipelineAllowed$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'PipelineAllowed ""'), function($skip, $loc, $0, $1) {
13935
+ if (config.verbose) {
13936
+ console.log("forbidPipeline:", state.forbidPipeline);
13937
+ }
13938
+ if (state.pipelineForbidden)
13939
+ return $skip;
13940
+ });
13941
+ function PipelineAllowed(ctx, state2) {
13942
+ return (0, import_lib3.$EVENT)(ctx, state2, "PipelineAllowed", PipelineAllowed$0);
13943
+ }
13944
+ var AllowAll$0 = (0, import_lib3.$S)(AllowTrailingMemberProperty, AllowBracedApplication, AllowIndentedApplication, AllowClassImplicitCall, AllowNestedBinaryOp, AllowNewlineBinaryOp, AllowPipeline);
13691
13945
  function AllowAll(ctx, state2) {
13692
13946
  return (0, import_lib3.$EVENT)(ctx, state2, "AllowAll", AllowAll$0);
13693
13947
  }
13694
- var RestoreAll$0 = (0, import_lib3.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNewlineBinaryOp);
13948
+ var RestoreAll$0 = (0, import_lib3.$S)(RestoreTrailingMemberProperty, RestoreBracedApplication, RestoreIndentedApplication, RestoreClassImplicitCall, RestoreNestedBinaryOp, RestoreNewlineBinaryOp, RestorePipeline);
13695
13949
  function RestoreAll(ctx, state2) {
13696
13950
  return (0, import_lib3.$EVENT)(ctx, state2, "RestoreAll", RestoreAll$0);
13697
13951
  }
@@ -13823,6 +14077,16 @@ var MaybeNestedExtendedExpression$$ = [MaybeNestedExtendedExpression$0, MaybeNes
13823
14077
  function MaybeNestedExtendedExpression(ctx, state2) {
13824
14078
  return (0, import_lib3.$EVENT_C)(ctx, state2, "MaybeNestedExtendedExpression", MaybeNestedExtendedExpression$$);
13825
14079
  }
14080
+ var NestedExtendedExpression$0 = NestedBulletedArray;
14081
+ var NestedExtendedExpression$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(PushIndent, (0, import_lib3.$E)((0, import_lib3.$S)(Nested, ExtendedExpression)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
14082
+ if ($3)
14083
+ return $3;
14084
+ return $skip;
14085
+ });
14086
+ var NestedExtendedExpression$$ = [NestedExtendedExpression$0, NestedExtendedExpression$1];
14087
+ function NestedExtendedExpression(ctx, state2) {
14088
+ return (0, import_lib3.$EVENT_C)(ctx, state2, "NestedExtendedExpression", NestedExtendedExpression$$);
14089
+ }
13826
14090
  var MaybeParenNestedExtendedExpression$0 = (0, import_lib3.$T)((0, import_lib3.$S)((0, import_lib3.$N)(EOS), ExtendedExpression), function(value) {
13827
14091
  return value[1];
13828
14092
  });
@@ -14317,16 +14581,16 @@ function TypeAssignment(ctx, state2) {
14317
14581
  }
14318
14582
  var LexicalBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingPattern, (0, import_lib3.$E)(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
14319
14583
  var pattern = $1;
14320
- var suffix = $2;
14584
+ var typeSuffix = $2;
14321
14585
  var initializer = $3;
14322
14586
  const [splices, thisAssignments] = gatherBindingCode(pattern);
14323
- suffix ??= pattern.typeSuffix;
14587
+ typeSuffix ??= pattern.typeSuffix;
14324
14588
  return {
14325
14589
  type: "Binding",
14326
- children: [pattern, suffix, initializer],
14590
+ children: [pattern, typeSuffix, initializer],
14327
14591
  names: pattern.names,
14328
14592
  pattern,
14329
- suffix,
14593
+ typeSuffix,
14330
14594
  initializer,
14331
14595
  splices: splices.map((s) => [",", s]),
14332
14596
  thisAssignments: thisAssignments.map((s) => ["", s, ";"])
@@ -14334,14 +14598,14 @@ var LexicalBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingPattern,
14334
14598
  });
14335
14599
  var LexicalBinding$1 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingIdentifier, (0, import_lib3.$E)(TypeSuffix), (0, import_lib3.$E)(Initializer)), function($skip, $loc, $0, $1, $2, $3) {
14336
14600
  var pattern = $1;
14337
- var suffix = $2;
14601
+ var typeSuffix = $2;
14338
14602
  var initializer = $3;
14339
14603
  return {
14340
14604
  type: "Binding",
14341
14605
  children: $0,
14342
14606
  names: pattern.names,
14343
14607
  pattern,
14344
- suffix,
14608
+ typeSuffix,
14345
14609
  initializer,
14346
14610
  splices: [],
14347
14611
  thisAssignments: []
@@ -16286,14 +16550,14 @@ function UsingDeclaration(ctx, state2) {
16286
16550
  }
16287
16551
  var UsingBinding$0 = (0, import_lib3.$TS)((0, import_lib3.$S)(BindingIdentifier, (0, import_lib3.$E)(TypeSuffix), Initializer), function($skip, $loc, $0, $1, $2, $3) {
16288
16552
  var pattern = $1;
16289
- var suffix = $2;
16553
+ var typeSuffix = $2;
16290
16554
  var initializer = $3;
16291
16555
  return {
16292
16556
  type: "Binding",
16293
16557
  children: $0,
16294
16558
  names: pattern.names,
16295
16559
  pattern,
16296
- suffix,
16560
+ typeSuffix,
16297
16561
  initializer,
16298
16562
  splices: [],
16299
16563
  thisAssignments: []
@@ -16855,7 +17119,8 @@ function TypeUnary(ctx, state2) {
16855
17119
  }
16856
17120
  var TypeUnarySuffix$0 = TypeIndexedAccess;
16857
17121
  var TypeUnarySuffix$1 = QuestionMark;
16858
- var TypeUnarySuffix$$ = [TypeUnarySuffix$0, TypeUnarySuffix$1];
17122
+ var TypeUnarySuffix$2 = NonNullAssertion;
17123
+ var TypeUnarySuffix$$ = [TypeUnarySuffix$0, TypeUnarySuffix$1, TypeUnarySuffix$2];
16859
17124
  function TypeUnarySuffix(ctx, state2) {
16860
17125
  return (0, import_lib3.$EVENT_C)(ctx, state2, "TypeUnarySuffix", TypeUnarySuffix$$);
16861
17126
  }
@@ -17850,7 +18115,9 @@ var Reset$0 = (0, import_lib3.$TV)((0, import_lib3.$EXPECT)($L0, 'Reset ""'), fu
17850
18115
  state.forbidIndentedApplication = [false];
17851
18116
  state.forbidBracedApplication = [false];
17852
18117
  state.forbidTrailingMemberProperty = [false];
18118
+ state.forbidNestedBinaryOp = [false];
17853
18119
  state.forbidNewlineBinaryOp = [false];
18120
+ state.forbidPipeline = [false];
17854
18121
  state.JSXTagStack = [void 0];
17855
18122
  state.operators = /* @__PURE__ */ new Map();
17856
18123
  state.helperRefs = {};
@@ -18121,12 +18388,24 @@ Object.defineProperties(state, {
18121
18388
  return s[s.length - 1];
18122
18389
  }
18123
18390
  },
18391
+ nestedBinaryOpForbidden: {
18392
+ get() {
18393
+ const { forbidNestedBinaryOp: s } = state;
18394
+ return s[s.length - 1];
18395
+ }
18396
+ },
18124
18397
  newlineBinaryOpForbidden: {
18125
18398
  get() {
18126
18399
  const { forbidNewlineBinaryOp: s } = state;
18127
18400
  return s[s.length - 1];
18128
18401
  }
18129
18402
  },
18403
+ pipelineForbidden: {
18404
+ get() {
18405
+ const { forbidPipeline: s } = state;
18406
+ return s[s.length - 1];
18407
+ }
18408
+ },
18130
18409
  currentJSXTag: {
18131
18410
  get() {
18132
18411
  const { JSXTagStack: s } = state;
@@ -18135,12 +18414,12 @@ Object.defineProperties(state, {
18135
18414
  }
18136
18415
  });
18137
18416
  function getStateKey() {
18138
- const stateInt = state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.newlineBinaryOpForbidden << 3 | // This is slightly different than the rest of the state,
18417
+ const stateInt = state.currentIndent.level % 256 << 8 | state.classImplicitCallForbidden << 7 | state.indentedApplicationForbidden << 6 | state.bracedApplicationForbidden << 5 | state.trailingMemberPropertyForbidden << 4 | state.nestedBinaryOpForbidden << 3 | state.newlineBinaryOpForbidden << 2 | state.pipelineForbidden << 1 | // This is slightly different than the rest of the state,
18139
18418
  // since it is affected by the directive prologue and may be hit
18140
18419
  // by the EOL rule early in the parse. Later if we wanted to
18141
18420
  // allow block scoping of the compat directives we would need to
18142
18421
  // add them all here.
18143
- config.coffeeComment << 2;
18422
+ config.coffeeComment << 0;
18144
18423
  return [stateInt, state.currentJSXTag];
18145
18424
  }
18146
18425
  function parseProgram(input, options) {
@@ -18540,21 +18819,27 @@ var uncacheable = /* @__PURE__ */ new Set([
18540
18819
  "AllowBracedApplication",
18541
18820
  "AllowIndentedApplication",
18542
18821
  "AllowMultiLineImplicitObjectLiteral",
18822
+ "AllowNestedBinaryOp",
18543
18823
  "AllowNewlineBinaryOp",
18544
18824
  "AllowTrailingMemberProperty",
18825
+ "AllowPipeline",
18545
18826
  "ForbidClassImplicitCall",
18546
18827
  "ForbidBracedApplication",
18547
18828
  "ForbidIndentedApplication",
18548
18829
  "ForbidMultiLineImplicitObjectLiteral",
18830
+ "ForbidNestedBinaryOp",
18549
18831
  "ForbidNewlineBinaryOp",
18550
18832
  "ForbidTrailingMemberProperty",
18833
+ "ForbidPipeline",
18551
18834
  "RestoreAll",
18552
18835
  "RestoreClassImplicitCall",
18553
18836
  "RestoreMultiLineImplicitObjectLiteral",
18554
18837
  "RestoreBracedApplication",
18555
18838
  "RestoreIndentedApplication",
18556
18839
  "RestoreTrailingMemberProperty",
18557
- "RestoreNewlineBinaryOp"
18840
+ "RestoreNestedBinaryOp",
18841
+ "RestoreNewlineBinaryOp",
18842
+ "RestorePipeline"
18558
18843
  ]);
18559
18844
  function compile(src, options) {
18560
18845
  if (!options) {
@@ -18699,13 +18984,16 @@ var makeCache = function({ hits, trace } = {}) {
18699
18984
  };
18700
18985
  }
18701
18986
  if (trace) {
18702
- logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + "\u2192");
18987
+ logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + "{");
18703
18988
  stack.push(ruleName);
18704
18989
  }
18705
18990
  return;
18706
18991
  },
18707
18992
  exit: function(ruleName, state2, result) {
18708
18993
  if (uncacheable.has(ruleName)) {
18994
+ if (trace) {
18995
+ logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + "\u26A0\uFE0F " + (result ? "\u2705" : "\u274C"));
18996
+ }
18709
18997
  return;
18710
18998
  }
18711
18999
  const [stateKey, tagKey] = getStateKey();
@@ -18719,7 +19007,7 @@ var makeCache = function({ hits, trace } = {}) {
18719
19007
  }
18720
19008
  if (trace) {
18721
19009
  stack.pop();
18722
- logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + " " + (result ? "\u2705" : "\u274C"));
19010
+ logs.push("".padStart(stack.length * 2, " ") + ruleName + ":" + state2.pos + "} " + (result ? "\u2705" : "\u274C"));
18723
19011
  }
18724
19012
  return;
18725
19013
  }