@danielx/civet 0.5.75 → 0.5.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -850,6 +850,7 @@ ${input.slice(result.pos)}
850
850
  Import,
851
851
  In,
852
852
  LetOrConst,
853
+ Const,
853
854
  LetOrConstOrVar,
854
855
  Loop,
855
856
  New,
@@ -943,6 +944,7 @@ ${input.slice(result.pos)}
943
944
  InterfaceExtendsClause,
944
945
  InterfaceExtendsTarget,
945
946
  TypeKeyword,
947
+ Enum,
946
948
  Interface,
947
949
  Global,
948
950
  Module,
@@ -960,6 +962,11 @@ ${input.slice(result.pos)}
960
962
  NestedDeclareElements,
961
963
  NestedDeclareElement,
962
964
  DeclareElement,
965
+ EnumDeclaration,
966
+ EnumBlock,
967
+ NestedEnumProperties,
968
+ NestedEnumProperty,
969
+ EnumProperty,
963
970
  TypeIndexSignature,
964
971
  TypeIndex,
965
972
  TypeSuffix,
@@ -1218,15 +1225,16 @@ ${input.slice(result.pos)}
1218
1225
  var $L169 = $L("<!--");
1219
1226
  var $L170 = $L("-->");
1220
1227
  var $L171 = $L("type");
1221
- var $L172 = $L("interface");
1222
- var $L173 = $L("global");
1223
- var $L174 = $L("module");
1224
- var $L175 = $L("namespace");
1225
- var $L176 = $L("asserts");
1226
- var $L177 = $L("keyof");
1227
- var $L178 = $L("infer");
1228
- var $L179 = $L("[]");
1229
- var $L180 = $L("civet");
1228
+ var $L172 = $L("enum");
1229
+ var $L173 = $L("interface");
1230
+ var $L174 = $L("global");
1231
+ var $L175 = $L("module");
1232
+ var $L176 = $L("namespace");
1233
+ var $L177 = $L("asserts");
1234
+ var $L178 = $L("keyof");
1235
+ var $L179 = $L("infer");
1236
+ var $L180 = $L("[]");
1237
+ var $L181 = $L("civet");
1230
1238
  var $R0 = $R(new RegExp("(as|for|while|until|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
1231
1239
  var $R1 = $R(new RegExp("[0-9]", "suy"));
1232
1240
  var $R2 = $R(new RegExp("[)}]", "suy"));
@@ -1280,18 +1288,19 @@ ${input.slice(result.pos)}
1280
1288
  var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
1281
1289
  var $R51 = $R(new RegExp("[\\s>]", "suy"));
1282
1290
  var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
1283
- var $R53 = $R(new RegExp("[<>]", "suy"));
1284
- var $R54 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
1285
- var $R55 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
1286
- var $R56 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1287
- var $R57 = $R(new RegExp("[+-]?", "suy"));
1288
- var $R58 = $R(new RegExp("[+-]", "suy"));
1289
- var $R59 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1290
- var $R60 = $R(new RegExp("[\\t ]*", "suy"));
1291
- var $R61 = $R(new RegExp("[\\s]*", "suy"));
1292
- var $R62 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1293
- var $R63 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1294
- var $R64 = $R(new RegExp("[ \\t]*", "suy"));
1291
+ var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
1292
+ var $R54 = $R(new RegExp("[<>]", "suy"));
1293
+ var $R55 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
1294
+ var $R56 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
1295
+ var $R57 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1296
+ var $R58 = $R(new RegExp("[+-]?", "suy"));
1297
+ var $R59 = $R(new RegExp("[+-]", "suy"));
1298
+ var $R60 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1299
+ var $R61 = $R(new RegExp("[\\t ]*", "suy"));
1300
+ var $R62 = $R(new RegExp("[\\s]*", "suy"));
1301
+ var $R63 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1302
+ var $R64 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1303
+ var $R65 = $R(new RegExp("[ \\t]*", "suy"));
1295
1304
  var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
1296
1305
  var statements = $4;
1297
1306
  module.processProgram(statements);
@@ -5472,26 +5481,27 @@ ${input.slice(result.pos)}
5472
5481
  var rhs = $3;
5473
5482
  if (!prefix && !rhs)
5474
5483
  return $skip;
5484
+ let body, ref;
5475
5485
  if (!rhs) {
5476
- const ref2 = {
5486
+ ref = {
5477
5487
  type: "Ref",
5478
5488
  base: "$",
5479
5489
  id: "$"
5480
5490
  };
5481
- return {
5482
- type: "ArrowFunction",
5483
- children: [ref2, " => ", prefix, ref2],
5484
- ampersandBlock: true
5485
- };
5491
+ body = [prefix, ref];
5492
+ } else {
5493
+ ({ ref } = rhs);
5494
+ body = [prefix, rhs];
5486
5495
  }
5487
- const { ref } = rhs;
5488
- const children = [ref, " => ", prefix, rhs];
5489
- if (module.hasAwait(rhs)) {
5496
+ const children = [ref, " => ", ...body];
5497
+ if (module.hasAwait(body)) {
5490
5498
  children.unshift("async ");
5491
5499
  }
5492
5500
  return {
5493
5501
  type: "ArrowFunction",
5494
5502
  children,
5503
+ ref,
5504
+ body,
5495
5505
  ampersandBlock: true
5496
5506
  };
5497
5507
  });
@@ -6284,6 +6294,7 @@ ${input.slice(result.pos)}
6284
6294
  var Literal$0 = $TS($S(LiteralContent), function($skip, $loc, $0, $1) {
6285
6295
  return {
6286
6296
  type: "Literal",
6297
+ subtype: $1.type,
6287
6298
  children: $0,
6288
6299
  raw: $1.token
6289
6300
  };
@@ -8993,12 +9004,15 @@ ${input.slice(result.pos)}
8993
9004
  return result;
8994
9005
  }
8995
9006
  }
8996
- var IterationExpression$0 = $TS($S(IterationStatement), function($skip, $loc, $0, $1) {
9007
+ var IterationExpression$0 = $TS($S($E($S(Async, __)), IterationStatement), function($skip, $loc, $0, $1, $2) {
9008
+ var async = $1;
9009
+ var statement = $2;
8997
9010
  return {
8998
9011
  type: "IterationExpression",
8999
- subtype: $1.type,
9000
- children: [$1],
9001
- block: $1.block
9012
+ subtype: statement.type,
9013
+ children: [statement],
9014
+ block: statement.block,
9015
+ async
9002
9016
  };
9003
9017
  });
9004
9018
  function IterationExpression(state) {
@@ -10683,7 +10697,8 @@ ${input.slice(result.pos)}
10683
10697
  return result;
10684
10698
  }
10685
10699
  }
10686
- var ExpressionStatement$0 = Expression;
10700
+ var ExpressionStatement$0 = IterationExpression;
10701
+ var ExpressionStatement$1 = Expression;
10687
10702
  function ExpressionStatement(state) {
10688
10703
  let eventData;
10689
10704
  if (state.events) {
@@ -10695,12 +10710,12 @@ ${input.slice(result.pos)}
10695
10710
  }
10696
10711
  }
10697
10712
  if (state.tokenize) {
10698
- const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state));
10713
+ const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state) || ExpressionStatement$1(state));
10699
10714
  if (state.events)
10700
10715
  state.events.exit?.("ExpressionStatement", state, result, eventData);
10701
10716
  return result;
10702
10717
  } else {
10703
- const result = ExpressionStatement$0(state);
10718
+ const result = ExpressionStatement$0(state) || ExpressionStatement$1(state);
10704
10719
  if (state.events)
10705
10720
  state.events.exit?.("ExpressionStatement", state, result, eventData);
10706
10721
  return result;
@@ -11561,7 +11576,8 @@ ${input.slice(result.pos)}
11561
11576
  var Declaration$1 = ClassDeclaration;
11562
11577
  var Declaration$2 = LexicalDeclaration;
11563
11578
  var Declaration$3 = TypeDeclaration;
11564
- var Declaration$4 = OperatorDeclaration;
11579
+ var Declaration$4 = EnumDeclaration;
11580
+ var Declaration$5 = OperatorDeclaration;
11565
11581
  function Declaration(state) {
11566
11582
  let eventData;
11567
11583
  if (state.events) {
@@ -11573,12 +11589,12 @@ ${input.slice(result.pos)}
11573
11589
  }
11574
11590
  }
11575
11591
  if (state.tokenize) {
11576
- const result = $TOKEN("Declaration", state, Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state));
11592
+ const result = $TOKEN("Declaration", state, Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state) || Declaration$5(state));
11577
11593
  if (state.events)
11578
11594
  state.events.exit?.("Declaration", state, result, eventData);
11579
11595
  return result;
11580
11596
  } else {
11581
- const result = Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state);
11597
+ const result = Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state) || Declaration$5(state);
11582
11598
  if (state.events)
11583
11599
  state.events.exit?.("Declaration", state, result, eventData);
11584
11600
  return result;
@@ -14471,6 +14487,31 @@ ${input.slice(result.pos)}
14471
14487
  return result;
14472
14488
  }
14473
14489
  }
14490
+ var Const$0 = $TS($S($EXPECT($L129, fail, 'Const "const"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
14491
+ return { $loc, token: $1 };
14492
+ });
14493
+ function Const(state) {
14494
+ let eventData;
14495
+ if (state.events) {
14496
+ const result = state.events.enter?.("Const", state);
14497
+ if (result) {
14498
+ if (result.cache)
14499
+ return result.cache;
14500
+ eventData = result.data;
14501
+ }
14502
+ }
14503
+ if (state.tokenize) {
14504
+ const result = $TOKEN("Const", state, Const$0(state));
14505
+ if (state.events)
14506
+ state.events.exit?.("Const", state, result, eventData);
14507
+ return result;
14508
+ } else {
14509
+ const result = Const$0(state);
14510
+ if (state.events)
14511
+ state.events.exit?.("Const", state, result, eventData);
14512
+ return result;
14513
+ }
14514
+ }
14474
14515
  var LetOrConstOrVar$0 = LetOrConst;
14475
14516
  var LetOrConstOrVar$1 = Var;
14476
14517
  function LetOrConstOrVar(state) {
@@ -16242,11 +16283,11 @@ ${input.slice(result.pos)}
16242
16283
  var JSXAttributeValue$2 = JSXFragment;
16243
16284
  var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
16244
16285
  if ($2.children?.length === 1 && $2.children[0].type === "StringLiteral") {
16245
- return $2.children[0];
16286
+ return $skip;
16246
16287
  }
16247
16288
  return $0;
16248
16289
  });
16249
- var JSXAttributeValue$4 = StringLiteral;
16290
+ var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
16250
16291
  function JSXAttributeValue(state) {
16251
16292
  let eventData;
16252
16293
  if (state.events) {
@@ -16296,7 +16337,7 @@ ${input.slice(result.pos)}
16296
16337
  return result;
16297
16338
  }
16298
16339
  }
16299
- var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R53, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
16340
+ var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R54, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
16300
16341
  var op = $2;
16301
16342
  var rhs = $3;
16302
16343
  return [[], op, [], rhs];
@@ -16351,7 +16392,7 @@ ${input.slice(result.pos)}
16351
16392
  return result;
16352
16393
  }
16353
16394
  }
16354
- var InlineJSXUnaryOp$0 = $TR($EXPECT($R54, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16395
+ var InlineJSXUnaryOp$0 = $TR($EXPECT($R55, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16355
16396
  return { $loc, token: $0 };
16356
16397
  });
16357
16398
  function InlineJSXUnaryOp(state) {
@@ -16796,7 +16837,7 @@ ${input.slice(result.pos)}
16796
16837
  return result;
16797
16838
  }
16798
16839
  }
16799
- var JSXCommentContent$0 = $TR($EXPECT($R55, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16840
+ var JSXCommentContent$0 = $TR($EXPECT($R56, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16800
16841
  return { $loc, token: $0.replace(/\*\//g, "* /") };
16801
16842
  });
16802
16843
  function JSXCommentContent(state) {
@@ -16821,7 +16862,7 @@ ${input.slice(result.pos)}
16821
16862
  return result;
16822
16863
  }
16823
16864
  }
16824
- var JSXText$0 = $TR($EXPECT($R56, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16865
+ var JSXText$0 = $TR($EXPECT($R57, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16825
16866
  return {
16826
16867
  type: "JSXText",
16827
16868
  token: $0,
@@ -17098,7 +17139,32 @@ ${input.slice(result.pos)}
17098
17139
  return result;
17099
17140
  }
17100
17141
  }
17101
- var Interface$0 = $TS($S($EXPECT($L172, fail, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17142
+ var Enum$0 = $TS($S($EXPECT($L172, fail, 'Enum "enum"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17143
+ return { $loc, token: $1 };
17144
+ });
17145
+ function Enum(state) {
17146
+ let eventData;
17147
+ if (state.events) {
17148
+ const result = state.events.enter?.("Enum", state);
17149
+ if (result) {
17150
+ if (result.cache)
17151
+ return result.cache;
17152
+ eventData = result.data;
17153
+ }
17154
+ }
17155
+ if (state.tokenize) {
17156
+ const result = $TOKEN("Enum", state, Enum$0(state));
17157
+ if (state.events)
17158
+ state.events.exit?.("Enum", state, result, eventData);
17159
+ return result;
17160
+ } else {
17161
+ const result = Enum$0(state);
17162
+ if (state.events)
17163
+ state.events.exit?.("Enum", state, result, eventData);
17164
+ return result;
17165
+ }
17166
+ }
17167
+ var Interface$0 = $TS($S($EXPECT($L173, fail, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17102
17168
  return { $loc, token: $1 };
17103
17169
  });
17104
17170
  function Interface(state) {
@@ -17123,7 +17189,7 @@ ${input.slice(result.pos)}
17123
17189
  return result;
17124
17190
  }
17125
17191
  }
17126
- var Global$0 = $TS($S($EXPECT($L173, fail, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17192
+ var Global$0 = $TS($S($EXPECT($L174, fail, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17127
17193
  return { $loc, token: $1 };
17128
17194
  });
17129
17195
  function Global(state) {
@@ -17148,7 +17214,7 @@ ${input.slice(result.pos)}
17148
17214
  return result;
17149
17215
  }
17150
17216
  }
17151
- var Module$0 = $TS($S($EXPECT($L174, fail, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17217
+ var Module$0 = $TS($S($EXPECT($L175, fail, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17152
17218
  return { $loc, token: $1 };
17153
17219
  });
17154
17220
  function Module(state) {
@@ -17173,7 +17239,7 @@ ${input.slice(result.pos)}
17173
17239
  return result;
17174
17240
  }
17175
17241
  }
17176
- var Namespace$0 = $TS($S($EXPECT($L175, fail, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17242
+ var Namespace$0 = $TS($S($EXPECT($L176, fail, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17177
17243
  return { $loc, token: $1 };
17178
17244
  });
17179
17245
  function Namespace(state) {
@@ -17322,7 +17388,7 @@ ${input.slice(result.pos)}
17322
17388
  return result;
17323
17389
  }
17324
17390
  }
17325
- var InterfacePropertyDelimiter$0 = $S($Q(_), $C(Semicolon, Comma));
17391
+ var InterfacePropertyDelimiter$0 = $S($E(_), $C(Semicolon, Comma));
17326
17392
  var InterfacePropertyDelimiter$1 = $Y($S(__, CloseBrace));
17327
17393
  var InterfacePropertyDelimiter$2 = $Y(EOS);
17328
17394
  function InterfacePropertyDelimiter(state) {
@@ -17526,7 +17592,221 @@ ${input.slice(result.pos)}
17526
17592
  return result;
17527
17593
  }
17528
17594
  }
17529
- var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R57, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L141, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R58, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
17595
+ var EnumDeclaration$0 = $TS($S($E($S(Const, _)), Enum, $Q(TrailingComment), IdentifierName, EnumBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17596
+ var isConst = $1;
17597
+ var id = $4;
17598
+ var block = $5;
17599
+ const ts = {
17600
+ ts: true,
17601
+ children: $0
17602
+ };
17603
+ if (isConst)
17604
+ return ts;
17605
+ const names = new Set(block.properties.map((p) => p.name.name));
17606
+ return [
17607
+ ts,
17608
+ {
17609
+ js: true,
17610
+ children: [
17611
+ ["let ", id, " = {};\n"],
17612
+ ...block.properties.map((property, i) => {
17613
+ let init, isString;
17614
+ if (property.init) {
17615
+ init = module.replaceNodes(
17616
+ structuredClone(property.init),
17617
+ (n) => n.type === "Identifier" && names.has(n.name),
17618
+ (n) => [id, '["', n.name, '"]']
17619
+ );
17620
+ const value = init[init.length - 1];
17621
+ isString = value.type === "TemplateLiteral" || value.type === "Literal" && value.subtype === "StringLiteral";
17622
+ } else {
17623
+ init = i === 0 ? " = 0" : [" = ", id, '["', block.properties[i - 1].name, '"] + 1'];
17624
+ }
17625
+ if (isString) {
17626
+ return [
17627
+ id,
17628
+ '["',
17629
+ property.name,
17630
+ '"]',
17631
+ init,
17632
+ ";\n"
17633
+ ];
17634
+ } else {
17635
+ return [
17636
+ id,
17637
+ "[",
17638
+ id,
17639
+ '["',
17640
+ property.name,
17641
+ '"]',
17642
+ init,
17643
+ '] = "',
17644
+ property.name,
17645
+ '";\n'
17646
+ ];
17647
+ }
17648
+ })
17649
+ ]
17650
+ }
17651
+ ];
17652
+ });
17653
+ function EnumDeclaration(state) {
17654
+ let eventData;
17655
+ if (state.events) {
17656
+ const result = state.events.enter?.("EnumDeclaration", state);
17657
+ if (result) {
17658
+ if (result.cache)
17659
+ return result.cache;
17660
+ eventData = result.data;
17661
+ }
17662
+ }
17663
+ if (state.tokenize) {
17664
+ const result = $TOKEN("EnumDeclaration", state, EnumDeclaration$0(state));
17665
+ if (state.events)
17666
+ state.events.exit?.("EnumDeclaration", state, result, eventData);
17667
+ return result;
17668
+ } else {
17669
+ const result = EnumDeclaration$0(state);
17670
+ if (state.events)
17671
+ state.events.exit?.("EnumDeclaration", state, result, eventData);
17672
+ return result;
17673
+ }
17674
+ }
17675
+ var EnumBlock$0 = $TS($S(__, OpenBrace, NestedEnumProperties, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17676
+ var props2 = $3;
17677
+ return {
17678
+ properties: props2.properties,
17679
+ children: $0
17680
+ };
17681
+ });
17682
+ var EnumBlock$1 = $TS($S(__, OpenBrace, $Q($S(__, EnumProperty)), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17683
+ var props2 = $3;
17684
+ return {
17685
+ properties: props2.map((p) => p[1]),
17686
+ children: $0
17687
+ };
17688
+ });
17689
+ var EnumBlock$2 = $TS($S(InsertOpenBrace, NestedEnumProperties, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17690
+ var props2 = $2;
17691
+ return {
17692
+ properties: props2.properties,
17693
+ children: $0
17694
+ };
17695
+ });
17696
+ function EnumBlock(state) {
17697
+ let eventData;
17698
+ if (state.events) {
17699
+ const result = state.events.enter?.("EnumBlock", state);
17700
+ if (result) {
17701
+ if (result.cache)
17702
+ return result.cache;
17703
+ eventData = result.data;
17704
+ }
17705
+ }
17706
+ if (state.tokenize) {
17707
+ const result = $TOKEN("EnumBlock", state, EnumBlock$0(state) || EnumBlock$1(state) || EnumBlock$2(state));
17708
+ if (state.events)
17709
+ state.events.exit?.("EnumBlock", state, result, eventData);
17710
+ return result;
17711
+ } else {
17712
+ const result = EnumBlock$0(state) || EnumBlock$1(state) || EnumBlock$2(state);
17713
+ if (state.events)
17714
+ state.events.exit?.("EnumBlock", state, result, eventData);
17715
+ return result;
17716
+ }
17717
+ }
17718
+ var NestedEnumProperties$0 = $TS($S(PushIndent, $Q(NestedEnumProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
17719
+ var props2 = $2;
17720
+ if (!props2.length)
17721
+ return $skip;
17722
+ return {
17723
+ properties: props2.map((p) => p.property),
17724
+ children: $0
17725
+ };
17726
+ });
17727
+ function NestedEnumProperties(state) {
17728
+ let eventData;
17729
+ if (state.events) {
17730
+ const result = state.events.enter?.("NestedEnumProperties", state);
17731
+ if (result) {
17732
+ if (result.cache)
17733
+ return result.cache;
17734
+ eventData = result.data;
17735
+ }
17736
+ }
17737
+ if (state.tokenize) {
17738
+ const result = $TOKEN("NestedEnumProperties", state, NestedEnumProperties$0(state));
17739
+ if (state.events)
17740
+ state.events.exit?.("NestedEnumProperties", state, result, eventData);
17741
+ return result;
17742
+ } else {
17743
+ const result = NestedEnumProperties$0(state);
17744
+ if (state.events)
17745
+ state.events.exit?.("NestedEnumProperties", state, result, eventData);
17746
+ return result;
17747
+ }
17748
+ }
17749
+ var NestedEnumProperty$0 = $TS($S(Nested, EnumProperty), function($skip, $loc, $0, $1, $2) {
17750
+ return {
17751
+ property: $2,
17752
+ children: $0
17753
+ };
17754
+ });
17755
+ function NestedEnumProperty(state) {
17756
+ let eventData;
17757
+ if (state.events) {
17758
+ const result = state.events.enter?.("NestedEnumProperty", state);
17759
+ if (result) {
17760
+ if (result.cache)
17761
+ return result.cache;
17762
+ eventData = result.data;
17763
+ }
17764
+ }
17765
+ if (state.tokenize) {
17766
+ const result = $TOKEN("NestedEnumProperty", state, NestedEnumProperty$0(state));
17767
+ if (state.events)
17768
+ state.events.exit?.("NestedEnumProperty", state, result, eventData);
17769
+ return result;
17770
+ } else {
17771
+ const result = NestedEnumProperty$0(state);
17772
+ if (state.events)
17773
+ state.events.exit?.("NestedEnumProperty", state, result, eventData);
17774
+ return result;
17775
+ }
17776
+ }
17777
+ var EnumProperty$0 = $TS($S(Identifier, $E($S(__, Equals, ExtendedExpression)), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3) {
17778
+ var name = $1;
17779
+ var init = $2;
17780
+ return {
17781
+ type: "EnumProperty",
17782
+ name,
17783
+ init,
17784
+ children: $0
17785
+ };
17786
+ });
17787
+ function EnumProperty(state) {
17788
+ let eventData;
17789
+ if (state.events) {
17790
+ const result = state.events.enter?.("EnumProperty", state);
17791
+ if (result) {
17792
+ if (result.cache)
17793
+ return result.cache;
17794
+ eventData = result.data;
17795
+ }
17796
+ }
17797
+ if (state.tokenize) {
17798
+ const result = $TOKEN("EnumProperty", state, EnumProperty$0(state));
17799
+ if (state.events)
17800
+ state.events.exit?.("EnumProperty", state, result, eventData);
17801
+ return result;
17802
+ } else {
17803
+ const result = EnumProperty$0(state);
17804
+ if (state.events)
17805
+ state.events.exit?.("EnumProperty", state, result, eventData);
17806
+ return result;
17807
+ }
17808
+ }
17809
+ var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R58, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L141, fail, 'TypeIndexSignature "readonly"'), __)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R59, fail, "TypeIndexSignature /[+-]/")), QuestionMark)));
17530
17810
  function TypeIndexSignature(state) {
17531
17811
  let eventData;
17532
17812
  if (state.events) {
@@ -17604,7 +17884,7 @@ ${input.slice(result.pos)}
17604
17884
  return result;
17605
17885
  }
17606
17886
  }
17607
- var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($L176, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
17887
+ var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($L177, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
17608
17888
  var asserts = $3;
17609
17889
  var t = $4;
17610
17890
  if (asserts) {
@@ -17778,9 +18058,9 @@ ${input.slice(result.pos)}
17778
18058
  return result;
17779
18059
  }
17780
18060
  }
17781
- var TypeUnaryOp$0 = $S($EXPECT($L177, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
18061
+ var TypeUnaryOp$0 = $S($EXPECT($L178, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
17782
18062
  var TypeUnaryOp$1 = $S($EXPECT($L157, fail, 'TypeUnaryOp "typeof"'), NonIdContinue);
17783
- var TypeUnaryOp$2 = $S($EXPECT($L178, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
18063
+ var TypeUnaryOp$2 = $S($EXPECT($L179, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
17784
18064
  var TypeUnaryOp$3 = $S($EXPECT($L141, fail, 'TypeUnaryOp "readonly"'), NonIdContinue);
17785
18065
  function TypeUnaryOp(state) {
17786
18066
  let eventData;
@@ -18026,7 +18306,7 @@ ${input.slice(result.pos)}
18026
18306
  var TypeLiteral$2 = $TS($S($EXPECT($L161, fail, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
18027
18307
  return { type: "VoidType", $loc, token: $1 };
18028
18308
  });
18029
- var TypeLiteral$3 = $TV($EXPECT($L179, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
18309
+ var TypeLiteral$3 = $TV($EXPECT($L180, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
18030
18310
  return { $loc, token: "[]" };
18031
18311
  });
18032
18312
  function TypeLiteral(state) {
@@ -18433,7 +18713,7 @@ ${input.slice(result.pos)}
18433
18713
  return result;
18434
18714
  }
18435
18715
  }
18436
- var Shebang$0 = $S($R$0($EXPECT($R59, fail, "Shebang /#![^\\r\\n]*/")), EOL);
18716
+ var Shebang$0 = $S($R$0($EXPECT($R60, fail, "Shebang /#![^\\r\\n]*/")), EOL);
18437
18717
  function Shebang(state) {
18438
18718
  let eventData;
18439
18719
  if (state.events) {
@@ -18456,11 +18736,11 @@ ${input.slice(result.pos)}
18456
18736
  return result;
18457
18737
  }
18458
18738
  }
18459
- var CivetPrologue$0 = $T($S($EXPECT($R60, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18739
+ var CivetPrologue$0 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18460
18740
  var content = value[2];
18461
18741
  return content;
18462
18742
  });
18463
- var CivetPrologue$1 = $T($S($EXPECT($R60, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18743
+ var CivetPrologue$1 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18464
18744
  var content = value[2];
18465
18745
  return content;
18466
18746
  });
@@ -18486,7 +18766,7 @@ ${input.slice(result.pos)}
18486
18766
  return result;
18487
18767
  }
18488
18768
  }
18489
- var CivetPrologueContent$0 = $TS($S($EXPECT($L180, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R61, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
18769
+ var CivetPrologueContent$0 = $TS($S($EXPECT($L181, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R62, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
18490
18770
  var options = $3;
18491
18771
  return {
18492
18772
  type: "CivetPrologue",
@@ -18516,7 +18796,7 @@ ${input.slice(result.pos)}
18516
18796
  return result;
18517
18797
  }
18518
18798
  }
18519
- var CivetOption$0 = $TR($EXPECT($R62, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
18799
+ var CivetOption$0 = $TR($EXPECT($R63, fail, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
18520
18800
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
18521
18801
  if (l)
18522
18802
  return l.toUpperCase();
@@ -18552,7 +18832,7 @@ ${input.slice(result.pos)}
18552
18832
  return result;
18553
18833
  }
18554
18834
  }
18555
- var UnknownPrologue$0 = $S($R$0($EXPECT($R60, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
18835
+ var UnknownPrologue$0 = $S($R$0($EXPECT($R61, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
18556
18836
  function UnknownPrologue(state) {
18557
18837
  let eventData;
18558
18838
  if (state.events) {
@@ -18622,7 +18902,7 @@ ${input.slice(result.pos)}
18622
18902
  return result;
18623
18903
  }
18624
18904
  }
18625
- var EOL$0 = $TR($EXPECT($R63, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
18905
+ var EOL$0 = $TR($EXPECT($R64, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
18626
18906
  return { $loc, token: $0 };
18627
18907
  });
18628
18908
  function EOL(state) {
@@ -19776,6 +20056,9 @@ ${input.slice(result.pos)}
19776
20056
  module.modifyString = function(str) {
19777
20057
  return str.replace(/(^.?|[^\\]{2})(\\\\)*\n/g, "$1$2\\n");
19778
20058
  };
20059
+ module.unmodifyString = function(str) {
20060
+ return str.replace(/\\n/g, "\n");
20061
+ };
19779
20062
  module.quoteString = function(str) {
19780
20063
  str = str.replace(/\\/g, "\\\\");
19781
20064
  if (str.includes('"') && !str.includes("'")) {
@@ -19927,6 +20210,20 @@ ${input.slice(result.pos)}
19927
20210
  return { children };
19928
20211
  }
19929
20212
  };
20213
+ module.needsRef = function(expression, base = "ref") {
20214
+ switch (expression.type) {
20215
+ case "Ref":
20216
+ case "Identifier":
20217
+ case "Literal":
20218
+ return;
20219
+ default:
20220
+ return {
20221
+ type: "Ref",
20222
+ base,
20223
+ id: base
20224
+ };
20225
+ }
20226
+ };
19930
20227
  module.literalValue = function(literal) {
19931
20228
  let { raw } = literal;
19932
20229
  switch (raw) {
@@ -20006,7 +20303,7 @@ ${input.slice(result.pos)}
20006
20303
  const i = exp.children.indexOf(exp.block);
20007
20304
  if (exp.subtype === "DoStatement") {
20008
20305
  insertReturn(exp.block);
20009
- exp.children.splice(i, 1, ...module.wrapIIFE(exp.children));
20306
+ exp.children.splice(i, 1, ...module.wrapIIFE(exp.children, exp.async));
20010
20307
  return;
20011
20308
  }
20012
20309
  const resultsRef = {
@@ -20015,16 +20312,28 @@ ${input.slice(result.pos)}
20015
20312
  id: "results"
20016
20313
  };
20017
20314
  insertPush(exp.block, resultsRef);
20018
- exp.children.splice(i, 1, module.wrapIIFE(
20019
- ["const ", resultsRef, "=[];", ...exp.children, "; return ", resultsRef]
20020
- ));
20315
+ exp.children.splice(
20316
+ i,
20317
+ 1,
20318
+ module.wrapIIFE([
20319
+ "const ",
20320
+ resultsRef,
20321
+ "=[];",
20322
+ ...exp.children,
20323
+ "; return ",
20324
+ resultsRef
20325
+ ], exp.async)
20326
+ );
20021
20327
  }
20022
20328
  module.hasAwait = (exp) => {
20023
20329
  return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
20024
20330
  };
20025
- module.wrapIIFE = (exp) => {
20331
+ module.wrapIIFE = (exp, async) => {
20026
20332
  let prefix, suffix;
20027
- if (module.hasAwait(exp)) {
20333
+ if (async) {
20334
+ prefix = "(async ()=>{";
20335
+ suffix = "})()";
20336
+ } else if (module.hasAwait(exp)) {
20028
20337
  prefix = "(await (async ()=>{";
20029
20338
  suffix = "})())";
20030
20339
  } else {
@@ -20232,6 +20541,7 @@ ${input.slice(result.pos)}
20232
20541
  }
20233
20542
  module.makeLeftHandSideExpression = function(expression) {
20234
20543
  switch (expression.type) {
20544
+ case "Ref":
20235
20545
  case "Identifier":
20236
20546
  case "Literal":
20237
20547
  case "CallExpression":
@@ -20616,14 +20926,14 @@ ${input.slice(result.pos)}
20616
20926
  if (node == null)
20617
20927
  return [];
20618
20928
  if (Array.isArray(node)) {
20619
- return node.flatMap((n) => gatherRecursive(n, predicate));
20929
+ return node.flatMap((n) => gatherRecursive(n, predicate, skipPredicate));
20620
20930
  }
20621
20931
  if (skipPredicate?.(node))
20622
20932
  return [];
20623
20933
  if (predicate(node)) {
20624
20934
  return [node];
20625
20935
  }
20626
- return gatherRecursive(node.children, predicate);
20936
+ return gatherRecursive(node.children, predicate, skipPredicate);
20627
20937
  }
20628
20938
  function gatherRecursiveAll(node, predicate) {
20629
20939
  if (node == null)
@@ -20637,8 +20947,9 @@ ${input.slice(result.pos)}
20637
20947
  }
20638
20948
  return nodes;
20639
20949
  }
20640
- function isFunction({ type }) {
20641
- return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition";
20950
+ function isFunction(node) {
20951
+ const { type } = node;
20952
+ return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
20642
20953
  }
20643
20954
  function gatherRecursiveWithinFunction(node, predicate) {
20644
20955
  return gatherRecursive(node, predicate, isFunction);
@@ -20661,6 +20972,28 @@ ${input.slice(result.pos)}
20661
20972
  }
20662
20973
  }
20663
20974
  }
20975
+ function removeParentPointers(node) {
20976
+ if (node == null)
20977
+ return;
20978
+ if (typeof node !== "object")
20979
+ return;
20980
+ if (Array.isArray(node)) {
20981
+ for (const child of node) {
20982
+ removeParentPointers(child);
20983
+ }
20984
+ return;
20985
+ }
20986
+ node.parent = null;
20987
+ if (node.children) {
20988
+ for (const child of node.children) {
20989
+ removeParentPointers(child);
20990
+ }
20991
+ }
20992
+ }
20993
+ function clone(node) {
20994
+ removeParentPointers(node);
20995
+ return structuredClone(node);
20996
+ }
20664
20997
  function findAncestor(node, predicate, stopPredicate) {
20665
20998
  node = node.parent;
20666
20999
  while (node && !stopPredicate?.(node)) {
@@ -20669,6 +21002,23 @@ ${input.slice(result.pos)}
20669
21002
  node = node.parent;
20670
21003
  }
20671
21004
  }
21005
+ module.replaceNodes = (root, predicate, replacer) => {
21006
+ if (root == null)
21007
+ return root;
21008
+ const array = Array.isArray(root) ? root : root.children;
21009
+ if (!array)
21010
+ return root;
21011
+ array.forEach((node, i) => {
21012
+ if (node == null)
21013
+ return;
21014
+ if (predicate(node)) {
21015
+ array[i] = replacer(node, root);
21016
+ } else {
21017
+ module.replaceNodes(node, predicate, replacer);
21018
+ }
21019
+ });
21020
+ return root;
21021
+ };
20672
21022
  function processParams(f) {
20673
21023
  const { type, parameters, block } = f;
20674
21024
  if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
@@ -21161,6 +21511,22 @@ ${input.slice(result.pos)}
21161
21511
  }
21162
21512
  }
21163
21513
  propsGroupedByName.forEach((shared, key) => {
21514
+ if (!key)
21515
+ return;
21516
+ if (ReservedWord({
21517
+ pos: 0,
21518
+ input: key
21519
+ })) {
21520
+ shared.forEach((p) => {
21521
+ const ref = {
21522
+ type: "Ref",
21523
+ base: `_${key}`,
21524
+ id: key
21525
+ };
21526
+ p.children.push(": ", ref);
21527
+ });
21528
+ return;
21529
+ }
21164
21530
  if (shared.length === 1)
21165
21531
  return;
21166
21532
  const refs = shared.map((p) => {
@@ -21202,19 +21568,7 @@ ${input.slice(result.pos)}
21202
21568
  if (expression.type === "ParenthesizedExpression") {
21203
21569
  expression = expression.expression;
21204
21570
  }
21205
- let ref;
21206
- switch (expression.type) {
21207
- case "Identifier":
21208
- case "Literal":
21209
- ref = expression;
21210
- break;
21211
- default:
21212
- ref = {
21213
- type: "Ref",
21214
- base: "m",
21215
- id: "m"
21216
- };
21217
- }
21571
+ let ref = module.needsRef(expression, "m") || expression;
21218
21572
  let prev = [], root = prev;
21219
21573
  const l = clauses.length;
21220
21574
  clauses.forEach((c, i) => {
@@ -21285,29 +21639,96 @@ ${input.slice(result.pos)}
21285
21639
  const [ws, , body] = s.children;
21286
21640
  let [, arg] = s.children;
21287
21641
  let i = 0, l = body.length;
21288
- const children = [ws];
21642
+ const refDec = [];
21643
+ const children = [ws, refDec];
21644
+ let usingRef = null;
21289
21645
  for (i = 0; i < l; i++) {
21290
21646
  const step = body[i];
21291
21647
  const [leadingComment, pipe, trailingComment, expr] = step;
21292
21648
  const returns = pipe.token === "||>";
21649
+ let ref, result, returning = returns ? arg : null;
21293
21650
  if (pipe.token === "|>=") {
21651
+ let initRef;
21294
21652
  if (i === 0) {
21295
- children.push(arg, " = ");
21653
+ outer:
21654
+ switch (arg.type) {
21655
+ case "MemberExpression":
21656
+ if (arg.children.length <= 2)
21657
+ break;
21658
+ case "CallExpression":
21659
+ const access = arg.children.pop();
21660
+ switch (access.type) {
21661
+ case "PropertyAccess":
21662
+ case "SliceExpression":
21663
+ break;
21664
+ default:
21665
+ children.unshift({
21666
+ type: "Error",
21667
+ $loc: pipe.token.$loc,
21668
+ message: `Can't assign to ${access.type}`
21669
+ });
21670
+ arg.children.push(access);
21671
+ break outer;
21672
+ }
21673
+ usingRef = module.needsRef({});
21674
+ initRef = {
21675
+ type: "AssignmentExpression",
21676
+ children: [usingRef, " = ", arg, ","]
21677
+ };
21678
+ arg = {
21679
+ type: "MemberExpression",
21680
+ children: [usingRef, access]
21681
+ };
21682
+ break;
21683
+ }
21684
+ children.pop();
21685
+ const lhs = [[
21686
+ [refDec, initRef],
21687
+ arg,
21688
+ [],
21689
+ { token: "=", children: [" = "] }
21690
+ ]];
21691
+ Object.assign(s, {
21692
+ type: "AssignmentExpression",
21693
+ children: [lhs, children],
21694
+ names: null,
21695
+ lhs,
21696
+ assigned: arg,
21697
+ exp: children
21698
+ });
21699
+ arg = clone(arg);
21700
+ if (arg.children[0].type === "Ref") {
21701
+ arg.children[0] = usingRef;
21702
+ }
21296
21703
  } else {
21297
- children.push({
21704
+ children.unshift({
21298
21705
  type: "Error",
21706
+ $loc: pipe.token.$loc,
21299
21707
  message: "Can't use |>= in the middle of a pipeline"
21300
21708
  });
21301
21709
  }
21710
+ } else {
21711
+ s.children = children;
21302
21712
  }
21303
- const [result, returning] = module.constructPipeStep(
21713
+ if (returns && (ref = module.needsRef(arg))) {
21714
+ usingRef = usingRef || ref;
21715
+ arg = {
21716
+ type: "ParenthesizedExpression",
21717
+ children: ["(", {
21718
+ type: "AssignmentExpression",
21719
+ children: [usingRef, " = ", arg]
21720
+ }, ")"]
21721
+ };
21722
+ returning = usingRef;
21723
+ }
21724
+ [result, returning] = module.constructPipeStep(
21304
21725
  {
21305
21726
  leadingComment: module.skipIfOnlyWS(leadingComment),
21306
21727
  trailingComment: module.skipIfOnlyWS(trailingComment),
21307
21728
  expr
21308
21729
  },
21309
21730
  arg,
21310
- returns ? arg : null
21731
+ returning
21311
21732
  );
21312
21733
  if (result.type === "ReturnStatement") {
21313
21734
  if (i < l - 1) {
@@ -21330,8 +21751,10 @@ ${input.slice(result.pos)}
21330
21751
  arg = result;
21331
21752
  }
21332
21753
  }
21754
+ if (usingRef) {
21755
+ refDec.unshift("let ", usingRef, ";");
21756
+ }
21333
21757
  children.push(arg);
21334
- s.children = children;
21335
21758
  addParentPointers(s, s.parent);
21336
21759
  });
21337
21760
  }
@@ -21542,12 +21965,12 @@ ${input.slice(result.pos)}
21542
21965
  module.constructInvocation = function(fn, arg) {
21543
21966
  const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
21544
21967
  if (fn.expr.ampersandBlock) {
21545
- const [ref, , prefix, rhs] = fn.expr.children;
21968
+ const { ref, body } = fn.expr;
21546
21969
  ref.type = "PipedExpression";
21547
21970
  ref.children = [module.makeLeftHandSideExpression(arg)];
21548
21971
  return {
21549
21972
  type: "UnwrappedExpression",
21550
- children: [module.skipIfOnlyWS(fn.leadingComment), prefix, rhs, module.skipIfOnlyWS(fn.trailingComment)]
21973
+ children: [module.skipIfOnlyWS(fn.leadingComment), ...body, module.skipIfOnlyWS(fn.trailingComment)]
21551
21974
  };
21552
21975
  }
21553
21976
  const lhs = module.makeLeftHandSideExpression(fn.expr);
@@ -21620,7 +22043,7 @@ ${input.slice(result.pos)}
21620
22043
  return result;
21621
22044
  }
21622
22045
  }
21623
- var Indent$0 = $TR($EXPECT($R64, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
22046
+ var Indent$0 = $TR($EXPECT($R65, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
21624
22047
  let level;
21625
22048
  if (module.config.tab) {
21626
22049
  const tabs = $0.match(/\t/g);