@danielx/civet 0.5.76 → 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/main.mjs CHANGED
@@ -847,6 +847,7 @@ ${input.slice(result.pos)}
847
847
  Import,
848
848
  In,
849
849
  LetOrConst,
850
+ Const,
850
851
  LetOrConstOrVar,
851
852
  Loop,
852
853
  New,
@@ -940,6 +941,7 @@ ${input.slice(result.pos)}
940
941
  InterfaceExtendsClause,
941
942
  InterfaceExtendsTarget,
942
943
  TypeKeyword,
944
+ Enum,
943
945
  Interface,
944
946
  Global,
945
947
  Module,
@@ -957,6 +959,11 @@ ${input.slice(result.pos)}
957
959
  NestedDeclareElements,
958
960
  NestedDeclareElement,
959
961
  DeclareElement,
962
+ EnumDeclaration,
963
+ EnumBlock,
964
+ NestedEnumProperties,
965
+ NestedEnumProperty,
966
+ EnumProperty,
960
967
  TypeIndexSignature,
961
968
  TypeIndex,
962
969
  TypeSuffix,
@@ -1215,15 +1222,16 @@ ${input.slice(result.pos)}
1215
1222
  var $L169 = $L("<!--");
1216
1223
  var $L170 = $L("-->");
1217
1224
  var $L171 = $L("type");
1218
- var $L172 = $L("interface");
1219
- var $L173 = $L("global");
1220
- var $L174 = $L("module");
1221
- var $L175 = $L("namespace");
1222
- var $L176 = $L("asserts");
1223
- var $L177 = $L("keyof");
1224
- var $L178 = $L("infer");
1225
- var $L179 = $L("[]");
1226
- var $L180 = $L("civet");
1225
+ var $L172 = $L("enum");
1226
+ var $L173 = $L("interface");
1227
+ var $L174 = $L("global");
1228
+ var $L175 = $L("module");
1229
+ var $L176 = $L("namespace");
1230
+ var $L177 = $L("asserts");
1231
+ var $L178 = $L("keyof");
1232
+ var $L179 = $L("infer");
1233
+ var $L180 = $L("[]");
1234
+ var $L181 = $L("civet");
1227
1235
  var $R0 = $R(new RegExp("(as|for|while|until|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
1228
1236
  var $R1 = $R(new RegExp("[0-9]", "suy"));
1229
1237
  var $R2 = $R(new RegExp("[)}]", "suy"));
@@ -1277,18 +1285,19 @@ ${input.slice(result.pos)}
1277
1285
  var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
1278
1286
  var $R51 = $R(new RegExp("[\\s>]", "suy"));
1279
1287
  var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
1280
- var $R53 = $R(new RegExp("[<>]", "suy"));
1281
- var $R54 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
1282
- var $R55 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
1283
- var $R56 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1284
- var $R57 = $R(new RegExp("[+-]?", "suy"));
1285
- var $R58 = $R(new RegExp("[+-]", "suy"));
1286
- var $R59 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1287
- var $R60 = $R(new RegExp("[\\t ]*", "suy"));
1288
- var $R61 = $R(new RegExp("[\\s]*", "suy"));
1289
- var $R62 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1290
- var $R63 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1291
- var $R64 = $R(new RegExp("[ \\t]*", "suy"));
1288
+ var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
1289
+ var $R54 = $R(new RegExp("[<>]", "suy"));
1290
+ var $R55 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
1291
+ var $R56 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
1292
+ var $R57 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
1293
+ var $R58 = $R(new RegExp("[+-]?", "suy"));
1294
+ var $R59 = $R(new RegExp("[+-]", "suy"));
1295
+ var $R60 = $R(new RegExp("#![^\\r\\n]*", "suy"));
1296
+ var $R61 = $R(new RegExp("[\\t ]*", "suy"));
1297
+ var $R62 = $R(new RegExp("[\\s]*", "suy"));
1298
+ var $R63 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
1299
+ var $R64 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
1300
+ var $R65 = $R(new RegExp("[ \\t]*", "suy"));
1292
1301
  var Program$0 = $TS($S(Reset, Init, __, $Q(TopLevelStatement), __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
1293
1302
  var statements = $4;
1294
1303
  module.processProgram(statements);
@@ -6282,6 +6291,7 @@ ${input.slice(result.pos)}
6282
6291
  var Literal$0 = $TS($S(LiteralContent), function($skip, $loc, $0, $1) {
6283
6292
  return {
6284
6293
  type: "Literal",
6294
+ subtype: $1.type,
6285
6295
  children: $0,
6286
6296
  raw: $1.token
6287
6297
  };
@@ -8991,12 +9001,15 @@ ${input.slice(result.pos)}
8991
9001
  return result;
8992
9002
  }
8993
9003
  }
8994
- var IterationExpression$0 = $TS($S(IterationStatement), function($skip, $loc, $0, $1) {
9004
+ var IterationExpression$0 = $TS($S($E($S(Async, __)), IterationStatement), function($skip, $loc, $0, $1, $2) {
9005
+ var async = $1;
9006
+ var statement = $2;
8995
9007
  return {
8996
9008
  type: "IterationExpression",
8997
- subtype: $1.type,
8998
- children: [$1],
8999
- block: $1.block
9009
+ subtype: statement.type,
9010
+ children: [statement],
9011
+ block: statement.block,
9012
+ async
9000
9013
  };
9001
9014
  });
9002
9015
  function IterationExpression(state) {
@@ -10681,7 +10694,8 @@ ${input.slice(result.pos)}
10681
10694
  return result;
10682
10695
  }
10683
10696
  }
10684
- var ExpressionStatement$0 = Expression;
10697
+ var ExpressionStatement$0 = IterationExpression;
10698
+ var ExpressionStatement$1 = Expression;
10685
10699
  function ExpressionStatement(state) {
10686
10700
  let eventData;
10687
10701
  if (state.events) {
@@ -10693,12 +10707,12 @@ ${input.slice(result.pos)}
10693
10707
  }
10694
10708
  }
10695
10709
  if (state.tokenize) {
10696
- const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state));
10710
+ const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state) || ExpressionStatement$1(state));
10697
10711
  if (state.events)
10698
10712
  state.events.exit?.("ExpressionStatement", state, result, eventData);
10699
10713
  return result;
10700
10714
  } else {
10701
- const result = ExpressionStatement$0(state);
10715
+ const result = ExpressionStatement$0(state) || ExpressionStatement$1(state);
10702
10716
  if (state.events)
10703
10717
  state.events.exit?.("ExpressionStatement", state, result, eventData);
10704
10718
  return result;
@@ -11559,7 +11573,8 @@ ${input.slice(result.pos)}
11559
11573
  var Declaration$1 = ClassDeclaration;
11560
11574
  var Declaration$2 = LexicalDeclaration;
11561
11575
  var Declaration$3 = TypeDeclaration;
11562
- var Declaration$4 = OperatorDeclaration;
11576
+ var Declaration$4 = EnumDeclaration;
11577
+ var Declaration$5 = OperatorDeclaration;
11563
11578
  function Declaration(state) {
11564
11579
  let eventData;
11565
11580
  if (state.events) {
@@ -11571,12 +11586,12 @@ ${input.slice(result.pos)}
11571
11586
  }
11572
11587
  }
11573
11588
  if (state.tokenize) {
11574
- const result = $TOKEN("Declaration", state, Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state));
11589
+ const result = $TOKEN("Declaration", state, Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state) || Declaration$5(state));
11575
11590
  if (state.events)
11576
11591
  state.events.exit?.("Declaration", state, result, eventData);
11577
11592
  return result;
11578
11593
  } else {
11579
- const result = Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state);
11594
+ const result = Declaration$0(state) || Declaration$1(state) || Declaration$2(state) || Declaration$3(state) || Declaration$4(state) || Declaration$5(state);
11580
11595
  if (state.events)
11581
11596
  state.events.exit?.("Declaration", state, result, eventData);
11582
11597
  return result;
@@ -14469,6 +14484,31 @@ ${input.slice(result.pos)}
14469
14484
  return result;
14470
14485
  }
14471
14486
  }
14487
+ var Const$0 = $TS($S($EXPECT($L129, fail, 'Const "const"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
14488
+ return { $loc, token: $1 };
14489
+ });
14490
+ function Const(state) {
14491
+ let eventData;
14492
+ if (state.events) {
14493
+ const result = state.events.enter?.("Const", state);
14494
+ if (result) {
14495
+ if (result.cache)
14496
+ return result.cache;
14497
+ eventData = result.data;
14498
+ }
14499
+ }
14500
+ if (state.tokenize) {
14501
+ const result = $TOKEN("Const", state, Const$0(state));
14502
+ if (state.events)
14503
+ state.events.exit?.("Const", state, result, eventData);
14504
+ return result;
14505
+ } else {
14506
+ const result = Const$0(state);
14507
+ if (state.events)
14508
+ state.events.exit?.("Const", state, result, eventData);
14509
+ return result;
14510
+ }
14511
+ }
14472
14512
  var LetOrConstOrVar$0 = LetOrConst;
14473
14513
  var LetOrConstOrVar$1 = Var;
14474
14514
  function LetOrConstOrVar(state) {
@@ -16240,11 +16280,11 @@ ${input.slice(result.pos)}
16240
16280
  var JSXAttributeValue$2 = JSXFragment;
16241
16281
  var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
16242
16282
  if ($2.children?.length === 1 && $2.children[0].type === "StringLiteral") {
16243
- return $2.children[0];
16283
+ return $skip;
16244
16284
  }
16245
16285
  return $0;
16246
16286
  });
16247
- var JSXAttributeValue$4 = StringLiteral;
16287
+ var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
16248
16288
  function JSXAttributeValue(state) {
16249
16289
  let eventData;
16250
16290
  if (state.events) {
@@ -16294,7 +16334,7 @@ ${input.slice(result.pos)}
16294
16334
  return result;
16295
16335
  }
16296
16336
  }
16297
- var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R53, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
16337
+ var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R54, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
16298
16338
  var op = $2;
16299
16339
  var rhs = $3;
16300
16340
  return [[], op, [], rhs];
@@ -16349,7 +16389,7 @@ ${input.slice(result.pos)}
16349
16389
  return result;
16350
16390
  }
16351
16391
  }
16352
- var InlineJSXUnaryOp$0 = $TR($EXPECT($R54, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16392
+ var InlineJSXUnaryOp$0 = $TR($EXPECT($R55, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16353
16393
  return { $loc, token: $0 };
16354
16394
  });
16355
16395
  function InlineJSXUnaryOp(state) {
@@ -16794,7 +16834,7 @@ ${input.slice(result.pos)}
16794
16834
  return result;
16795
16835
  }
16796
16836
  }
16797
- var JSXCommentContent$0 = $TR($EXPECT($R55, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16837
+ var JSXCommentContent$0 = $TR($EXPECT($R56, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16798
16838
  return { $loc, token: $0.replace(/\*\//g, "* /") };
16799
16839
  });
16800
16840
  function JSXCommentContent(state) {
@@ -16819,7 +16859,7 @@ ${input.slice(result.pos)}
16819
16859
  return result;
16820
16860
  }
16821
16861
  }
16822
- var JSXText$0 = $TR($EXPECT($R56, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16862
+ var JSXText$0 = $TR($EXPECT($R57, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
16823
16863
  return {
16824
16864
  type: "JSXText",
16825
16865
  token: $0,
@@ -17096,7 +17136,32 @@ ${input.slice(result.pos)}
17096
17136
  return result;
17097
17137
  }
17098
17138
  }
17099
- var Interface$0 = $TS($S($EXPECT($L172, fail, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17139
+ var Enum$0 = $TS($S($EXPECT($L172, fail, 'Enum "enum"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17140
+ return { $loc, token: $1 };
17141
+ });
17142
+ function Enum(state) {
17143
+ let eventData;
17144
+ if (state.events) {
17145
+ const result = state.events.enter?.("Enum", state);
17146
+ if (result) {
17147
+ if (result.cache)
17148
+ return result.cache;
17149
+ eventData = result.data;
17150
+ }
17151
+ }
17152
+ if (state.tokenize) {
17153
+ const result = $TOKEN("Enum", state, Enum$0(state));
17154
+ if (state.events)
17155
+ state.events.exit?.("Enum", state, result, eventData);
17156
+ return result;
17157
+ } else {
17158
+ const result = Enum$0(state);
17159
+ if (state.events)
17160
+ state.events.exit?.("Enum", state, result, eventData);
17161
+ return result;
17162
+ }
17163
+ }
17164
+ var Interface$0 = $TS($S($EXPECT($L173, fail, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17100
17165
  return { $loc, token: $1 };
17101
17166
  });
17102
17167
  function Interface(state) {
@@ -17121,7 +17186,7 @@ ${input.slice(result.pos)}
17121
17186
  return result;
17122
17187
  }
17123
17188
  }
17124
- var Global$0 = $TS($S($EXPECT($L173, fail, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17189
+ var Global$0 = $TS($S($EXPECT($L174, fail, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17125
17190
  return { $loc, token: $1 };
17126
17191
  });
17127
17192
  function Global(state) {
@@ -17146,7 +17211,7 @@ ${input.slice(result.pos)}
17146
17211
  return result;
17147
17212
  }
17148
17213
  }
17149
- var Module$0 = $TS($S($EXPECT($L174, fail, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17214
+ var Module$0 = $TS($S($EXPECT($L175, fail, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17150
17215
  return { $loc, token: $1 };
17151
17216
  });
17152
17217
  function Module(state) {
@@ -17171,7 +17236,7 @@ ${input.slice(result.pos)}
17171
17236
  return result;
17172
17237
  }
17173
17238
  }
17174
- var Namespace$0 = $TS($S($EXPECT($L175, fail, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17239
+ var Namespace$0 = $TS($S($EXPECT($L176, fail, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17175
17240
  return { $loc, token: $1 };
17176
17241
  });
17177
17242
  function Namespace(state) {
@@ -17320,7 +17385,7 @@ ${input.slice(result.pos)}
17320
17385
  return result;
17321
17386
  }
17322
17387
  }
17323
- var InterfacePropertyDelimiter$0 = $S($Q(_), $C(Semicolon, Comma));
17388
+ var InterfacePropertyDelimiter$0 = $S($E(_), $C(Semicolon, Comma));
17324
17389
  var InterfacePropertyDelimiter$1 = $Y($S(__, CloseBrace));
17325
17390
  var InterfacePropertyDelimiter$2 = $Y(EOS);
17326
17391
  function InterfacePropertyDelimiter(state) {
@@ -17524,7 +17589,221 @@ ${input.slice(result.pos)}
17524
17589
  return result;
17525
17590
  }
17526
17591
  }
17527
- 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)));
17592
+ var EnumDeclaration$0 = $TS($S($E($S(Const, _)), Enum, $Q(TrailingComment), IdentifierName, EnumBlock), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17593
+ var isConst = $1;
17594
+ var id = $4;
17595
+ var block = $5;
17596
+ const ts = {
17597
+ ts: true,
17598
+ children: $0
17599
+ };
17600
+ if (isConst)
17601
+ return ts;
17602
+ const names = new Set(block.properties.map((p) => p.name.name));
17603
+ return [
17604
+ ts,
17605
+ {
17606
+ js: true,
17607
+ children: [
17608
+ ["let ", id, " = {};\n"],
17609
+ ...block.properties.map((property, i) => {
17610
+ let init, isString;
17611
+ if (property.init) {
17612
+ init = module.replaceNodes(
17613
+ structuredClone(property.init),
17614
+ (n) => n.type === "Identifier" && names.has(n.name),
17615
+ (n) => [id, '["', n.name, '"]']
17616
+ );
17617
+ const value = init[init.length - 1];
17618
+ isString = value.type === "TemplateLiteral" || value.type === "Literal" && value.subtype === "StringLiteral";
17619
+ } else {
17620
+ init = i === 0 ? " = 0" : [" = ", id, '["', block.properties[i - 1].name, '"] + 1'];
17621
+ }
17622
+ if (isString) {
17623
+ return [
17624
+ id,
17625
+ '["',
17626
+ property.name,
17627
+ '"]',
17628
+ init,
17629
+ ";\n"
17630
+ ];
17631
+ } else {
17632
+ return [
17633
+ id,
17634
+ "[",
17635
+ id,
17636
+ '["',
17637
+ property.name,
17638
+ '"]',
17639
+ init,
17640
+ '] = "',
17641
+ property.name,
17642
+ '";\n'
17643
+ ];
17644
+ }
17645
+ })
17646
+ ]
17647
+ }
17648
+ ];
17649
+ });
17650
+ function EnumDeclaration(state) {
17651
+ let eventData;
17652
+ if (state.events) {
17653
+ const result = state.events.enter?.("EnumDeclaration", state);
17654
+ if (result) {
17655
+ if (result.cache)
17656
+ return result.cache;
17657
+ eventData = result.data;
17658
+ }
17659
+ }
17660
+ if (state.tokenize) {
17661
+ const result = $TOKEN("EnumDeclaration", state, EnumDeclaration$0(state));
17662
+ if (state.events)
17663
+ state.events.exit?.("EnumDeclaration", state, result, eventData);
17664
+ return result;
17665
+ } else {
17666
+ const result = EnumDeclaration$0(state);
17667
+ if (state.events)
17668
+ state.events.exit?.("EnumDeclaration", state, result, eventData);
17669
+ return result;
17670
+ }
17671
+ }
17672
+ var EnumBlock$0 = $TS($S(__, OpenBrace, NestedEnumProperties, __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17673
+ var props2 = $3;
17674
+ return {
17675
+ properties: props2.properties,
17676
+ children: $0
17677
+ };
17678
+ });
17679
+ var EnumBlock$1 = $TS($S(__, OpenBrace, $Q($S(__, EnumProperty)), __, CloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17680
+ var props2 = $3;
17681
+ return {
17682
+ properties: props2.map((p) => p[1]),
17683
+ children: $0
17684
+ };
17685
+ });
17686
+ var EnumBlock$2 = $TS($S(InsertOpenBrace, NestedEnumProperties, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
17687
+ var props2 = $2;
17688
+ return {
17689
+ properties: props2.properties,
17690
+ children: $0
17691
+ };
17692
+ });
17693
+ function EnumBlock(state) {
17694
+ let eventData;
17695
+ if (state.events) {
17696
+ const result = state.events.enter?.("EnumBlock", state);
17697
+ if (result) {
17698
+ if (result.cache)
17699
+ return result.cache;
17700
+ eventData = result.data;
17701
+ }
17702
+ }
17703
+ if (state.tokenize) {
17704
+ const result = $TOKEN("EnumBlock", state, EnumBlock$0(state) || EnumBlock$1(state) || EnumBlock$2(state));
17705
+ if (state.events)
17706
+ state.events.exit?.("EnumBlock", state, result, eventData);
17707
+ return result;
17708
+ } else {
17709
+ const result = EnumBlock$0(state) || EnumBlock$1(state) || EnumBlock$2(state);
17710
+ if (state.events)
17711
+ state.events.exit?.("EnumBlock", state, result, eventData);
17712
+ return result;
17713
+ }
17714
+ }
17715
+ var NestedEnumProperties$0 = $TS($S(PushIndent, $Q(NestedEnumProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
17716
+ var props2 = $2;
17717
+ if (!props2.length)
17718
+ return $skip;
17719
+ return {
17720
+ properties: props2.map((p) => p.property),
17721
+ children: $0
17722
+ };
17723
+ });
17724
+ function NestedEnumProperties(state) {
17725
+ let eventData;
17726
+ if (state.events) {
17727
+ const result = state.events.enter?.("NestedEnumProperties", state);
17728
+ if (result) {
17729
+ if (result.cache)
17730
+ return result.cache;
17731
+ eventData = result.data;
17732
+ }
17733
+ }
17734
+ if (state.tokenize) {
17735
+ const result = $TOKEN("NestedEnumProperties", state, NestedEnumProperties$0(state));
17736
+ if (state.events)
17737
+ state.events.exit?.("NestedEnumProperties", state, result, eventData);
17738
+ return result;
17739
+ } else {
17740
+ const result = NestedEnumProperties$0(state);
17741
+ if (state.events)
17742
+ state.events.exit?.("NestedEnumProperties", state, result, eventData);
17743
+ return result;
17744
+ }
17745
+ }
17746
+ var NestedEnumProperty$0 = $TS($S(Nested, EnumProperty), function($skip, $loc, $0, $1, $2) {
17747
+ return {
17748
+ property: $2,
17749
+ children: $0
17750
+ };
17751
+ });
17752
+ function NestedEnumProperty(state) {
17753
+ let eventData;
17754
+ if (state.events) {
17755
+ const result = state.events.enter?.("NestedEnumProperty", state);
17756
+ if (result) {
17757
+ if (result.cache)
17758
+ return result.cache;
17759
+ eventData = result.data;
17760
+ }
17761
+ }
17762
+ if (state.tokenize) {
17763
+ const result = $TOKEN("NestedEnumProperty", state, NestedEnumProperty$0(state));
17764
+ if (state.events)
17765
+ state.events.exit?.("NestedEnumProperty", state, result, eventData);
17766
+ return result;
17767
+ } else {
17768
+ const result = NestedEnumProperty$0(state);
17769
+ if (state.events)
17770
+ state.events.exit?.("NestedEnumProperty", state, result, eventData);
17771
+ return result;
17772
+ }
17773
+ }
17774
+ var EnumProperty$0 = $TS($S(Identifier, $E($S(__, Equals, ExtendedExpression)), ObjectPropertyDelimiter), function($skip, $loc, $0, $1, $2, $3) {
17775
+ var name = $1;
17776
+ var init = $2;
17777
+ return {
17778
+ type: "EnumProperty",
17779
+ name,
17780
+ init,
17781
+ children: $0
17782
+ };
17783
+ });
17784
+ function EnumProperty(state) {
17785
+ let eventData;
17786
+ if (state.events) {
17787
+ const result = state.events.enter?.("EnumProperty", state);
17788
+ if (result) {
17789
+ if (result.cache)
17790
+ return result.cache;
17791
+ eventData = result.data;
17792
+ }
17793
+ }
17794
+ if (state.tokenize) {
17795
+ const result = $TOKEN("EnumProperty", state, EnumProperty$0(state));
17796
+ if (state.events)
17797
+ state.events.exit?.("EnumProperty", state, result, eventData);
17798
+ return result;
17799
+ } else {
17800
+ const result = EnumProperty$0(state);
17801
+ if (state.events)
17802
+ state.events.exit?.("EnumProperty", state, result, eventData);
17803
+ return result;
17804
+ }
17805
+ }
17806
+ 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)));
17528
17807
  function TypeIndexSignature(state) {
17529
17808
  let eventData;
17530
17809
  if (state.events) {
@@ -17602,7 +17881,7 @@ ${input.slice(result.pos)}
17602
17881
  return result;
17603
17882
  }
17604
17883
  }
17605
- var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($L176, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
17884
+ var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($L177, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
17606
17885
  var asserts = $3;
17607
17886
  var t = $4;
17608
17887
  if (asserts) {
@@ -17776,9 +18055,9 @@ ${input.slice(result.pos)}
17776
18055
  return result;
17777
18056
  }
17778
18057
  }
17779
- var TypeUnaryOp$0 = $S($EXPECT($L177, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
18058
+ var TypeUnaryOp$0 = $S($EXPECT($L178, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
17780
18059
  var TypeUnaryOp$1 = $S($EXPECT($L157, fail, 'TypeUnaryOp "typeof"'), NonIdContinue);
17781
- var TypeUnaryOp$2 = $S($EXPECT($L178, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
18060
+ var TypeUnaryOp$2 = $S($EXPECT($L179, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
17782
18061
  var TypeUnaryOp$3 = $S($EXPECT($L141, fail, 'TypeUnaryOp "readonly"'), NonIdContinue);
17783
18062
  function TypeUnaryOp(state) {
17784
18063
  let eventData;
@@ -18024,7 +18303,7 @@ ${input.slice(result.pos)}
18024
18303
  var TypeLiteral$2 = $TS($S($EXPECT($L161, fail, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
18025
18304
  return { type: "VoidType", $loc, token: $1 };
18026
18305
  });
18027
- var TypeLiteral$3 = $TV($EXPECT($L179, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
18306
+ var TypeLiteral$3 = $TV($EXPECT($L180, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
18028
18307
  return { $loc, token: "[]" };
18029
18308
  });
18030
18309
  function TypeLiteral(state) {
@@ -18431,7 +18710,7 @@ ${input.slice(result.pos)}
18431
18710
  return result;
18432
18711
  }
18433
18712
  }
18434
- var Shebang$0 = $S($R$0($EXPECT($R59, fail, "Shebang /#![^\\r\\n]*/")), EOL);
18713
+ var Shebang$0 = $S($R$0($EXPECT($R60, fail, "Shebang /#![^\\r\\n]*/")), EOL);
18435
18714
  function Shebang(state) {
18436
18715
  let eventData;
18437
18716
  if (state.events) {
@@ -18454,11 +18733,11 @@ ${input.slice(result.pos)}
18454
18733
  return result;
18455
18734
  }
18456
18735
  }
18457
- var CivetPrologue$0 = $T($S($EXPECT($R60, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18736
+ var CivetPrologue$0 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18458
18737
  var content = value[2];
18459
18738
  return content;
18460
18739
  });
18461
- var CivetPrologue$1 = $T($S($EXPECT($R60, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18740
+ var CivetPrologue$1 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
18462
18741
  var content = value[2];
18463
18742
  return content;
18464
18743
  });
@@ -18484,7 +18763,7 @@ ${input.slice(result.pos)}
18484
18763
  return result;
18485
18764
  }
18486
18765
  }
18487
- 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) {
18766
+ 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) {
18488
18767
  var options = $3;
18489
18768
  return {
18490
18769
  type: "CivetPrologue",
@@ -18514,7 +18793,7 @@ ${input.slice(result.pos)}
18514
18793
  return result;
18515
18794
  }
18516
18795
  }
18517
- 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) {
18796
+ 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) {
18518
18797
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
18519
18798
  if (l)
18520
18799
  return l.toUpperCase();
@@ -18550,7 +18829,7 @@ ${input.slice(result.pos)}
18550
18829
  return result;
18551
18830
  }
18552
18831
  }
18553
- var UnknownPrologue$0 = $S($R$0($EXPECT($R60, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
18832
+ var UnknownPrologue$0 = $S($R$0($EXPECT($R61, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
18554
18833
  function UnknownPrologue(state) {
18555
18834
  let eventData;
18556
18835
  if (state.events) {
@@ -18620,7 +18899,7 @@ ${input.slice(result.pos)}
18620
18899
  return result;
18621
18900
  }
18622
18901
  }
18623
- 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) {
18902
+ 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) {
18624
18903
  return { $loc, token: $0 };
18625
18904
  });
18626
18905
  function EOL(state) {
@@ -19774,6 +20053,9 @@ ${input.slice(result.pos)}
19774
20053
  module.modifyString = function(str) {
19775
20054
  return str.replace(/(^.?|[^\\]{2})(\\\\)*\n/g, "$1$2\\n");
19776
20055
  };
20056
+ module.unmodifyString = function(str) {
20057
+ return str.replace(/\\n/g, "\n");
20058
+ };
19777
20059
  module.quoteString = function(str) {
19778
20060
  str = str.replace(/\\/g, "\\\\");
19779
20061
  if (str.includes('"') && !str.includes("'")) {
@@ -19925,6 +20207,20 @@ ${input.slice(result.pos)}
19925
20207
  return { children };
19926
20208
  }
19927
20209
  };
20210
+ module.needsRef = function(expression, base = "ref") {
20211
+ switch (expression.type) {
20212
+ case "Ref":
20213
+ case "Identifier":
20214
+ case "Literal":
20215
+ return;
20216
+ default:
20217
+ return {
20218
+ type: "Ref",
20219
+ base,
20220
+ id: base
20221
+ };
20222
+ }
20223
+ };
19928
20224
  module.literalValue = function(literal) {
19929
20225
  let { raw } = literal;
19930
20226
  switch (raw) {
@@ -20004,7 +20300,7 @@ ${input.slice(result.pos)}
20004
20300
  const i = exp.children.indexOf(exp.block);
20005
20301
  if (exp.subtype === "DoStatement") {
20006
20302
  insertReturn(exp.block);
20007
- exp.children.splice(i, 1, ...module.wrapIIFE(exp.children));
20303
+ exp.children.splice(i, 1, ...module.wrapIIFE(exp.children, exp.async));
20008
20304
  return;
20009
20305
  }
20010
20306
  const resultsRef = {
@@ -20013,16 +20309,28 @@ ${input.slice(result.pos)}
20013
20309
  id: "results"
20014
20310
  };
20015
20311
  insertPush(exp.block, resultsRef);
20016
- exp.children.splice(i, 1, module.wrapIIFE(
20017
- ["const ", resultsRef, "=[];", ...exp.children, "; return ", resultsRef]
20018
- ));
20312
+ exp.children.splice(
20313
+ i,
20314
+ 1,
20315
+ module.wrapIIFE([
20316
+ "const ",
20317
+ resultsRef,
20318
+ "=[];",
20319
+ ...exp.children,
20320
+ "; return ",
20321
+ resultsRef
20322
+ ], exp.async)
20323
+ );
20019
20324
  }
20020
20325
  module.hasAwait = (exp) => {
20021
20326
  return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
20022
20327
  };
20023
- module.wrapIIFE = (exp) => {
20328
+ module.wrapIIFE = (exp, async) => {
20024
20329
  let prefix, suffix;
20025
- if (module.hasAwait(exp)) {
20330
+ if (async) {
20331
+ prefix = "(async ()=>{";
20332
+ suffix = "})()";
20333
+ } else if (module.hasAwait(exp)) {
20026
20334
  prefix = "(await (async ()=>{";
20027
20335
  suffix = "})())";
20028
20336
  } else {
@@ -20230,6 +20538,7 @@ ${input.slice(result.pos)}
20230
20538
  }
20231
20539
  module.makeLeftHandSideExpression = function(expression) {
20232
20540
  switch (expression.type) {
20541
+ case "Ref":
20233
20542
  case "Identifier":
20234
20543
  case "Literal":
20235
20544
  case "CallExpression":
@@ -20614,14 +20923,14 @@ ${input.slice(result.pos)}
20614
20923
  if (node == null)
20615
20924
  return [];
20616
20925
  if (Array.isArray(node)) {
20617
- return node.flatMap((n) => gatherRecursive(n, predicate));
20926
+ return node.flatMap((n) => gatherRecursive(n, predicate, skipPredicate));
20618
20927
  }
20619
20928
  if (skipPredicate?.(node))
20620
20929
  return [];
20621
20930
  if (predicate(node)) {
20622
20931
  return [node];
20623
20932
  }
20624
- return gatherRecursive(node.children, predicate);
20933
+ return gatherRecursive(node.children, predicate, skipPredicate);
20625
20934
  }
20626
20935
  function gatherRecursiveAll(node, predicate) {
20627
20936
  if (node == null)
@@ -20635,8 +20944,9 @@ ${input.slice(result.pos)}
20635
20944
  }
20636
20945
  return nodes;
20637
20946
  }
20638
- function isFunction({ type }) {
20639
- return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition";
20947
+ function isFunction(node) {
20948
+ const { type } = node;
20949
+ return type === "FunctionExpression" || type === "ArrowFunction" || type === "MethodDefinition" || node.async;
20640
20950
  }
20641
20951
  function gatherRecursiveWithinFunction(node, predicate) {
20642
20952
  return gatherRecursive(node, predicate, isFunction);
@@ -20659,6 +20969,28 @@ ${input.slice(result.pos)}
20659
20969
  }
20660
20970
  }
20661
20971
  }
20972
+ function removeParentPointers(node) {
20973
+ if (node == null)
20974
+ return;
20975
+ if (typeof node !== "object")
20976
+ return;
20977
+ if (Array.isArray(node)) {
20978
+ for (const child of node) {
20979
+ removeParentPointers(child);
20980
+ }
20981
+ return;
20982
+ }
20983
+ node.parent = null;
20984
+ if (node.children) {
20985
+ for (const child of node.children) {
20986
+ removeParentPointers(child);
20987
+ }
20988
+ }
20989
+ }
20990
+ function clone(node) {
20991
+ removeParentPointers(node);
20992
+ return structuredClone(node);
20993
+ }
20662
20994
  function findAncestor(node, predicate, stopPredicate) {
20663
20995
  node = node.parent;
20664
20996
  while (node && !stopPredicate?.(node)) {
@@ -20667,6 +20999,23 @@ ${input.slice(result.pos)}
20667
20999
  node = node.parent;
20668
21000
  }
20669
21001
  }
21002
+ module.replaceNodes = (root, predicate, replacer) => {
21003
+ if (root == null)
21004
+ return root;
21005
+ const array = Array.isArray(root) ? root : root.children;
21006
+ if (!array)
21007
+ return root;
21008
+ array.forEach((node, i) => {
21009
+ if (node == null)
21010
+ return;
21011
+ if (predicate(node)) {
21012
+ array[i] = replacer(node, root);
21013
+ } else {
21014
+ module.replaceNodes(node, predicate, replacer);
21015
+ }
21016
+ });
21017
+ return root;
21018
+ };
20670
21019
  function processParams(f) {
20671
21020
  const { type, parameters, block } = f;
20672
21021
  if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
@@ -21159,6 +21508,22 @@ ${input.slice(result.pos)}
21159
21508
  }
21160
21509
  }
21161
21510
  propsGroupedByName.forEach((shared, key) => {
21511
+ if (!key)
21512
+ return;
21513
+ if (ReservedWord({
21514
+ pos: 0,
21515
+ input: key
21516
+ })) {
21517
+ shared.forEach((p) => {
21518
+ const ref = {
21519
+ type: "Ref",
21520
+ base: `_${key}`,
21521
+ id: key
21522
+ };
21523
+ p.children.push(": ", ref);
21524
+ });
21525
+ return;
21526
+ }
21162
21527
  if (shared.length === 1)
21163
21528
  return;
21164
21529
  const refs = shared.map((p) => {
@@ -21200,19 +21565,7 @@ ${input.slice(result.pos)}
21200
21565
  if (expression.type === "ParenthesizedExpression") {
21201
21566
  expression = expression.expression;
21202
21567
  }
21203
- let ref;
21204
- switch (expression.type) {
21205
- case "Identifier":
21206
- case "Literal":
21207
- ref = expression;
21208
- break;
21209
- default:
21210
- ref = {
21211
- type: "Ref",
21212
- base: "m",
21213
- id: "m"
21214
- };
21215
- }
21568
+ let ref = module.needsRef(expression, "m") || expression;
21216
21569
  let prev = [], root = prev;
21217
21570
  const l = clauses.length;
21218
21571
  clauses.forEach((c, i) => {
@@ -21283,29 +21636,96 @@ ${input.slice(result.pos)}
21283
21636
  const [ws, , body] = s.children;
21284
21637
  let [, arg] = s.children;
21285
21638
  let i = 0, l = body.length;
21286
- const children = [ws];
21639
+ const refDec = [];
21640
+ const children = [ws, refDec];
21641
+ let usingRef = null;
21287
21642
  for (i = 0; i < l; i++) {
21288
21643
  const step = body[i];
21289
21644
  const [leadingComment, pipe, trailingComment, expr] = step;
21290
21645
  const returns = pipe.token === "||>";
21646
+ let ref, result, returning = returns ? arg : null;
21291
21647
  if (pipe.token === "|>=") {
21648
+ let initRef;
21292
21649
  if (i === 0) {
21293
- children.push(arg, " = ");
21650
+ outer:
21651
+ switch (arg.type) {
21652
+ case "MemberExpression":
21653
+ if (arg.children.length <= 2)
21654
+ break;
21655
+ case "CallExpression":
21656
+ const access = arg.children.pop();
21657
+ switch (access.type) {
21658
+ case "PropertyAccess":
21659
+ case "SliceExpression":
21660
+ break;
21661
+ default:
21662
+ children.unshift({
21663
+ type: "Error",
21664
+ $loc: pipe.token.$loc,
21665
+ message: `Can't assign to ${access.type}`
21666
+ });
21667
+ arg.children.push(access);
21668
+ break outer;
21669
+ }
21670
+ usingRef = module.needsRef({});
21671
+ initRef = {
21672
+ type: "AssignmentExpression",
21673
+ children: [usingRef, " = ", arg, ","]
21674
+ };
21675
+ arg = {
21676
+ type: "MemberExpression",
21677
+ children: [usingRef, access]
21678
+ };
21679
+ break;
21680
+ }
21681
+ children.pop();
21682
+ const lhs = [[
21683
+ [refDec, initRef],
21684
+ arg,
21685
+ [],
21686
+ { token: "=", children: [" = "] }
21687
+ ]];
21688
+ Object.assign(s, {
21689
+ type: "AssignmentExpression",
21690
+ children: [lhs, children],
21691
+ names: null,
21692
+ lhs,
21693
+ assigned: arg,
21694
+ exp: children
21695
+ });
21696
+ arg = clone(arg);
21697
+ if (arg.children[0].type === "Ref") {
21698
+ arg.children[0] = usingRef;
21699
+ }
21294
21700
  } else {
21295
- children.push({
21701
+ children.unshift({
21296
21702
  type: "Error",
21703
+ $loc: pipe.token.$loc,
21297
21704
  message: "Can't use |>= in the middle of a pipeline"
21298
21705
  });
21299
21706
  }
21707
+ } else {
21708
+ s.children = children;
21300
21709
  }
21301
- const [result, returning] = module.constructPipeStep(
21710
+ if (returns && (ref = module.needsRef(arg))) {
21711
+ usingRef = usingRef || ref;
21712
+ arg = {
21713
+ type: "ParenthesizedExpression",
21714
+ children: ["(", {
21715
+ type: "AssignmentExpression",
21716
+ children: [usingRef, " = ", arg]
21717
+ }, ")"]
21718
+ };
21719
+ returning = usingRef;
21720
+ }
21721
+ [result, returning] = module.constructPipeStep(
21302
21722
  {
21303
21723
  leadingComment: module.skipIfOnlyWS(leadingComment),
21304
21724
  trailingComment: module.skipIfOnlyWS(trailingComment),
21305
21725
  expr
21306
21726
  },
21307
21727
  arg,
21308
- returns ? arg : null
21728
+ returning
21309
21729
  );
21310
21730
  if (result.type === "ReturnStatement") {
21311
21731
  if (i < l - 1) {
@@ -21328,8 +21748,10 @@ ${input.slice(result.pos)}
21328
21748
  arg = result;
21329
21749
  }
21330
21750
  }
21751
+ if (usingRef) {
21752
+ refDec.unshift("let ", usingRef, ";");
21753
+ }
21331
21754
  children.push(arg);
21332
- s.children = children;
21333
21755
  addParentPointers(s, s.parent);
21334
21756
  });
21335
21757
  }
@@ -21618,7 +22040,7 @@ ${input.slice(result.pos)}
21618
22040
  return result;
21619
22041
  }
21620
22042
  }
21621
- var Indent$0 = $TR($EXPECT($R64, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
22043
+ var Indent$0 = $TR($EXPECT($R65, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
21622
22044
  let level;
21623
22045
  if (module.config.tab) {
21624
22046
  const tabs = $0.match(/\t/g);