@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/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);
@@ -6285,6 +6294,7 @@ ${input.slice(result.pos)}
6285
6294
  var Literal$0 = $TS($S(LiteralContent), function($skip, $loc, $0, $1) {
6286
6295
  return {
6287
6296
  type: "Literal",
6297
+ subtype: $1.type,
6288
6298
  children: $0,
6289
6299
  raw: $1.token
6290
6300
  };
@@ -8994,12 +9004,15 @@ ${input.slice(result.pos)}
8994
9004
  return result;
8995
9005
  }
8996
9006
  }
8997
- 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;
8998
9010
  return {
8999
9011
  type: "IterationExpression",
9000
- subtype: $1.type,
9001
- children: [$1],
9002
- block: $1.block
9012
+ subtype: statement.type,
9013
+ children: [statement],
9014
+ block: statement.block,
9015
+ async
9003
9016
  };
9004
9017
  });
9005
9018
  function IterationExpression(state) {
@@ -10684,7 +10697,8 @@ ${input.slice(result.pos)}
10684
10697
  return result;
10685
10698
  }
10686
10699
  }
10687
- var ExpressionStatement$0 = Expression;
10700
+ var ExpressionStatement$0 = IterationExpression;
10701
+ var ExpressionStatement$1 = Expression;
10688
10702
  function ExpressionStatement(state) {
10689
10703
  let eventData;
10690
10704
  if (state.events) {
@@ -10696,12 +10710,12 @@ ${input.slice(result.pos)}
10696
10710
  }
10697
10711
  }
10698
10712
  if (state.tokenize) {
10699
- const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state));
10713
+ const result = $TOKEN("ExpressionStatement", state, ExpressionStatement$0(state) || ExpressionStatement$1(state));
10700
10714
  if (state.events)
10701
10715
  state.events.exit?.("ExpressionStatement", state, result, eventData);
10702
10716
  return result;
10703
10717
  } else {
10704
- const result = ExpressionStatement$0(state);
10718
+ const result = ExpressionStatement$0(state) || ExpressionStatement$1(state);
10705
10719
  if (state.events)
10706
10720
  state.events.exit?.("ExpressionStatement", state, result, eventData);
10707
10721
  return result;
@@ -11562,7 +11576,8 @@ ${input.slice(result.pos)}
11562
11576
  var Declaration$1 = ClassDeclaration;
11563
11577
  var Declaration$2 = LexicalDeclaration;
11564
11578
  var Declaration$3 = TypeDeclaration;
11565
- var Declaration$4 = OperatorDeclaration;
11579
+ var Declaration$4 = EnumDeclaration;
11580
+ var Declaration$5 = OperatorDeclaration;
11566
11581
  function Declaration(state) {
11567
11582
  let eventData;
11568
11583
  if (state.events) {
@@ -11574,12 +11589,12 @@ ${input.slice(result.pos)}
11574
11589
  }
11575
11590
  }
11576
11591
  if (state.tokenize) {
11577
- 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));
11578
11593
  if (state.events)
11579
11594
  state.events.exit?.("Declaration", state, result, eventData);
11580
11595
  return result;
11581
11596
  } else {
11582
- 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);
11583
11598
  if (state.events)
11584
11599
  state.events.exit?.("Declaration", state, result, eventData);
11585
11600
  return result;
@@ -14472,6 +14487,31 @@ ${input.slice(result.pos)}
14472
14487
  return result;
14473
14488
  }
14474
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
+ }
14475
14515
  var LetOrConstOrVar$0 = LetOrConst;
14476
14516
  var LetOrConstOrVar$1 = Var;
14477
14517
  function LetOrConstOrVar(state) {
@@ -16243,11 +16283,11 @@ ${input.slice(result.pos)}
16243
16283
  var JSXAttributeValue$2 = JSXFragment;
16244
16284
  var JSXAttributeValue$3 = $TS($S(InsertInlineOpenBrace, InlineJSXAttributeValue, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3) {
16245
16285
  if ($2.children?.length === 1 && $2.children[0].type === "StringLiteral") {
16246
- return $2.children[0];
16286
+ return $skip;
16247
16287
  }
16248
16288
  return $0;
16249
16289
  });
16250
- var JSXAttributeValue$4 = StringLiteral;
16290
+ var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
16251
16291
  function JSXAttributeValue(state) {
16252
16292
  let eventData;
16253
16293
  if (state.events) {
@@ -16297,7 +16337,7 @@ ${input.slice(result.pos)}
16297
16337
  return result;
16298
16338
  }
16299
16339
  }
16300
- 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) {
16301
16341
  var op = $2;
16302
16342
  var rhs = $3;
16303
16343
  return [[], op, [], rhs];
@@ -16352,7 +16392,7 @@ ${input.slice(result.pos)}
16352
16392
  return result;
16353
16393
  }
16354
16394
  }
16355
- 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) {
16356
16396
  return { $loc, token: $0 };
16357
16397
  });
16358
16398
  function InlineJSXUnaryOp(state) {
@@ -16797,7 +16837,7 @@ ${input.slice(result.pos)}
16797
16837
  return result;
16798
16838
  }
16799
16839
  }
16800
- 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) {
16801
16841
  return { $loc, token: $0.replace(/\*\//g, "* /") };
16802
16842
  });
16803
16843
  function JSXCommentContent(state) {
@@ -16822,7 +16862,7 @@ ${input.slice(result.pos)}
16822
16862
  return result;
16823
16863
  }
16824
16864
  }
16825
- 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) {
16826
16866
  return {
16827
16867
  type: "JSXText",
16828
16868
  token: $0,
@@ -17099,7 +17139,32 @@ ${input.slice(result.pos)}
17099
17139
  return result;
17100
17140
  }
17101
17141
  }
17102
- 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) {
17103
17168
  return { $loc, token: $1 };
17104
17169
  });
17105
17170
  function Interface(state) {
@@ -17124,7 +17189,7 @@ ${input.slice(result.pos)}
17124
17189
  return result;
17125
17190
  }
17126
17191
  }
17127
- 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) {
17128
17193
  return { $loc, token: $1 };
17129
17194
  });
17130
17195
  function Global(state) {
@@ -17149,7 +17214,7 @@ ${input.slice(result.pos)}
17149
17214
  return result;
17150
17215
  }
17151
17216
  }
17152
- 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) {
17153
17218
  return { $loc, token: $1 };
17154
17219
  });
17155
17220
  function Module(state) {
@@ -17174,7 +17239,7 @@ ${input.slice(result.pos)}
17174
17239
  return result;
17175
17240
  }
17176
17241
  }
17177
- 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) {
17178
17243
  return { $loc, token: $1 };
17179
17244
  });
17180
17245
  function Namespace(state) {
@@ -17323,7 +17388,7 @@ ${input.slice(result.pos)}
17323
17388
  return result;
17324
17389
  }
17325
17390
  }
17326
- var InterfacePropertyDelimiter$0 = $S($Q(_), $C(Semicolon, Comma));
17391
+ var InterfacePropertyDelimiter$0 = $S($E(_), $C(Semicolon, Comma));
17327
17392
  var InterfacePropertyDelimiter$1 = $Y($S(__, CloseBrace));
17328
17393
  var InterfacePropertyDelimiter$2 = $Y(EOS);
17329
17394
  function InterfacePropertyDelimiter(state) {
@@ -17527,7 +17592,221 @@ ${input.slice(result.pos)}
17527
17592
  return result;
17528
17593
  }
17529
17594
  }
17530
- 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)));
17531
17810
  function TypeIndexSignature(state) {
17532
17811
  let eventData;
17533
17812
  if (state.events) {
@@ -17605,7 +17884,7 @@ ${input.slice(result.pos)}
17605
17884
  return result;
17606
17885
  }
17607
17886
  }
17608
- 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) {
17609
17888
  var asserts = $3;
17610
17889
  var t = $4;
17611
17890
  if (asserts) {
@@ -17779,9 +18058,9 @@ ${input.slice(result.pos)}
17779
18058
  return result;
17780
18059
  }
17781
18060
  }
17782
- var TypeUnaryOp$0 = $S($EXPECT($L177, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
18061
+ var TypeUnaryOp$0 = $S($EXPECT($L178, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
17783
18062
  var TypeUnaryOp$1 = $S($EXPECT($L157, fail, 'TypeUnaryOp "typeof"'), NonIdContinue);
17784
- var TypeUnaryOp$2 = $S($EXPECT($L178, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
18063
+ var TypeUnaryOp$2 = $S($EXPECT($L179, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
17785
18064
  var TypeUnaryOp$3 = $S($EXPECT($L141, fail, 'TypeUnaryOp "readonly"'), NonIdContinue);
17786
18065
  function TypeUnaryOp(state) {
17787
18066
  let eventData;
@@ -18027,7 +18306,7 @@ ${input.slice(result.pos)}
18027
18306
  var TypeLiteral$2 = $TS($S($EXPECT($L161, fail, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
18028
18307
  return { type: "VoidType", $loc, token: $1 };
18029
18308
  });
18030
- 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) {
18031
18310
  return { $loc, token: "[]" };
18032
18311
  });
18033
18312
  function TypeLiteral(state) {
@@ -18434,7 +18713,7 @@ ${input.slice(result.pos)}
18434
18713
  return result;
18435
18714
  }
18436
18715
  }
18437
- 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);
18438
18717
  function Shebang(state) {
18439
18718
  let eventData;
18440
18719
  if (state.events) {
@@ -18457,11 +18736,11 @@ ${input.slice(result.pos)}
18457
18736
  return result;
18458
18737
  }
18459
18738
  }
18460
- 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) {
18461
18740
  var content = value[2];
18462
18741
  return content;
18463
18742
  });
18464
- 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) {
18465
18744
  var content = value[2];
18466
18745
  return content;
18467
18746
  });
@@ -18487,7 +18766,7 @@ ${input.slice(result.pos)}
18487
18766
  return result;
18488
18767
  }
18489
18768
  }
18490
- 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) {
18491
18770
  var options = $3;
18492
18771
  return {
18493
18772
  type: "CivetPrologue",
@@ -18517,7 +18796,7 @@ ${input.slice(result.pos)}
18517
18796
  return result;
18518
18797
  }
18519
18798
  }
18520
- 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) {
18521
18800
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
18522
18801
  if (l)
18523
18802
  return l.toUpperCase();
@@ -18553,7 +18832,7 @@ ${input.slice(result.pos)}
18553
18832
  return result;
18554
18833
  }
18555
18834
  }
18556
- 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);
18557
18836
  function UnknownPrologue(state) {
18558
18837
  let eventData;
18559
18838
  if (state.events) {
@@ -18623,7 +18902,7 @@ ${input.slice(result.pos)}
18623
18902
  return result;
18624
18903
  }
18625
18904
  }
18626
- 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) {
18627
18906
  return { $loc, token: $0 };
18628
18907
  });
18629
18908
  function EOL(state) {
@@ -19777,6 +20056,9 @@ ${input.slice(result.pos)}
19777
20056
  module.modifyString = function(str) {
19778
20057
  return str.replace(/(^.?|[^\\]{2})(\\\\)*\n/g, "$1$2\\n");
19779
20058
  };
20059
+ module.unmodifyString = function(str) {
20060
+ return str.replace(/\\n/g, "\n");
20061
+ };
19780
20062
  module.quoteString = function(str) {
19781
20063
  str = str.replace(/\\/g, "\\\\");
19782
20064
  if (str.includes('"') && !str.includes("'")) {
@@ -19928,6 +20210,20 @@ ${input.slice(result.pos)}
19928
20210
  return { children };
19929
20211
  }
19930
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
+ };
19931
20227
  module.literalValue = function(literal) {
19932
20228
  let { raw } = literal;
19933
20229
  switch (raw) {
@@ -20007,7 +20303,7 @@ ${input.slice(result.pos)}
20007
20303
  const i = exp.children.indexOf(exp.block);
20008
20304
  if (exp.subtype === "DoStatement") {
20009
20305
  insertReturn(exp.block);
20010
- exp.children.splice(i, 1, ...module.wrapIIFE(exp.children));
20306
+ exp.children.splice(i, 1, ...module.wrapIIFE(exp.children, exp.async));
20011
20307
  return;
20012
20308
  }
20013
20309
  const resultsRef = {
@@ -20016,16 +20312,28 @@ ${input.slice(result.pos)}
20016
20312
  id: "results"
20017
20313
  };
20018
20314
  insertPush(exp.block, resultsRef);
20019
- exp.children.splice(i, 1, module.wrapIIFE(
20020
- ["const ", resultsRef, "=[];", ...exp.children, "; return ", resultsRef]
20021
- ));
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
+ );
20022
20327
  }
20023
20328
  module.hasAwait = (exp) => {
20024
20329
  return gatherRecursiveWithinFunction(exp, ({ type }) => type === "Await").length > 0;
20025
20330
  };
20026
- module.wrapIIFE = (exp) => {
20331
+ module.wrapIIFE = (exp, async) => {
20027
20332
  let prefix, suffix;
20028
- if (module.hasAwait(exp)) {
20333
+ if (async) {
20334
+ prefix = "(async ()=>{";
20335
+ suffix = "})()";
20336
+ } else if (module.hasAwait(exp)) {
20029
20337
  prefix = "(await (async ()=>{";
20030
20338
  suffix = "})())";
20031
20339
  } else {
@@ -20233,6 +20541,7 @@ ${input.slice(result.pos)}
20233
20541
  }
20234
20542
  module.makeLeftHandSideExpression = function(expression) {
20235
20543
  switch (expression.type) {
20544
+ case "Ref":
20236
20545
  case "Identifier":
20237
20546
  case "Literal":
20238
20547
  case "CallExpression":
@@ -20617,14 +20926,14 @@ ${input.slice(result.pos)}
20617
20926
  if (node == null)
20618
20927
  return [];
20619
20928
  if (Array.isArray(node)) {
20620
- return node.flatMap((n) => gatherRecursive(n, predicate));
20929
+ return node.flatMap((n) => gatherRecursive(n, predicate, skipPredicate));
20621
20930
  }
20622
20931
  if (skipPredicate?.(node))
20623
20932
  return [];
20624
20933
  if (predicate(node)) {
20625
20934
  return [node];
20626
20935
  }
20627
- return gatherRecursive(node.children, predicate);
20936
+ return gatherRecursive(node.children, predicate, skipPredicate);
20628
20937
  }
20629
20938
  function gatherRecursiveAll(node, predicate) {
20630
20939
  if (node == null)
@@ -20638,8 +20947,9 @@ ${input.slice(result.pos)}
20638
20947
  }
20639
20948
  return nodes;
20640
20949
  }
20641
- function isFunction({ type }) {
20642
- 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;
20643
20953
  }
20644
20954
  function gatherRecursiveWithinFunction(node, predicate) {
20645
20955
  return gatherRecursive(node, predicate, isFunction);
@@ -20662,6 +20972,28 @@ ${input.slice(result.pos)}
20662
20972
  }
20663
20973
  }
20664
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
+ }
20665
20997
  function findAncestor(node, predicate, stopPredicate) {
20666
20998
  node = node.parent;
20667
20999
  while (node && !stopPredicate?.(node)) {
@@ -20670,6 +21002,23 @@ ${input.slice(result.pos)}
20670
21002
  node = node.parent;
20671
21003
  }
20672
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
+ };
20673
21022
  function processParams(f) {
20674
21023
  const { type, parameters, block } = f;
20675
21024
  if (type === "ArrowFunction" && parameters && parameters.tp && parameters.tp.parameters.length === 1) {
@@ -21162,6 +21511,22 @@ ${input.slice(result.pos)}
21162
21511
  }
21163
21512
  }
21164
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
+ }
21165
21530
  if (shared.length === 1)
21166
21531
  return;
21167
21532
  const refs = shared.map((p) => {
@@ -21203,19 +21568,7 @@ ${input.slice(result.pos)}
21203
21568
  if (expression.type === "ParenthesizedExpression") {
21204
21569
  expression = expression.expression;
21205
21570
  }
21206
- let ref;
21207
- switch (expression.type) {
21208
- case "Identifier":
21209
- case "Literal":
21210
- ref = expression;
21211
- break;
21212
- default:
21213
- ref = {
21214
- type: "Ref",
21215
- base: "m",
21216
- id: "m"
21217
- };
21218
- }
21571
+ let ref = module.needsRef(expression, "m") || expression;
21219
21572
  let prev = [], root = prev;
21220
21573
  const l = clauses.length;
21221
21574
  clauses.forEach((c, i) => {
@@ -21286,29 +21639,96 @@ ${input.slice(result.pos)}
21286
21639
  const [ws, , body] = s.children;
21287
21640
  let [, arg] = s.children;
21288
21641
  let i = 0, l = body.length;
21289
- const children = [ws];
21642
+ const refDec = [];
21643
+ const children = [ws, refDec];
21644
+ let usingRef = null;
21290
21645
  for (i = 0; i < l; i++) {
21291
21646
  const step = body[i];
21292
21647
  const [leadingComment, pipe, trailingComment, expr] = step;
21293
21648
  const returns = pipe.token === "||>";
21649
+ let ref, result, returning = returns ? arg : null;
21294
21650
  if (pipe.token === "|>=") {
21651
+ let initRef;
21295
21652
  if (i === 0) {
21296
- 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
+ }
21297
21703
  } else {
21298
- children.push({
21704
+ children.unshift({
21299
21705
  type: "Error",
21706
+ $loc: pipe.token.$loc,
21300
21707
  message: "Can't use |>= in the middle of a pipeline"
21301
21708
  });
21302
21709
  }
21710
+ } else {
21711
+ s.children = children;
21303
21712
  }
21304
- 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(
21305
21725
  {
21306
21726
  leadingComment: module.skipIfOnlyWS(leadingComment),
21307
21727
  trailingComment: module.skipIfOnlyWS(trailingComment),
21308
21728
  expr
21309
21729
  },
21310
21730
  arg,
21311
- returns ? arg : null
21731
+ returning
21312
21732
  );
21313
21733
  if (result.type === "ReturnStatement") {
21314
21734
  if (i < l - 1) {
@@ -21331,8 +21751,10 @@ ${input.slice(result.pos)}
21331
21751
  arg = result;
21332
21752
  }
21333
21753
  }
21754
+ if (usingRef) {
21755
+ refDec.unshift("let ", usingRef, ";");
21756
+ }
21334
21757
  children.push(arg);
21335
- s.children = children;
21336
21758
  addParentPointers(s, s.parent);
21337
21759
  });
21338
21760
  }
@@ -21621,7 +22043,7 @@ ${input.slice(result.pos)}
21621
22043
  return result;
21622
22044
  }
21623
22045
  }
21624
- 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) {
21625
22047
  let level;
21626
22048
  if (module.config.tab) {
21627
22049
  const tabs = $0.match(/\t/g);