@danielx/civet 0.6.16 → 0.6.18

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
@@ -946,6 +946,9 @@ var Civet = (() => {
946
946
  function isVoidType(t) {
947
947
  return t?.type === "LiteralType" && t.t.type === "VoidType";
948
948
  }
949
+ function isPromiseVoidType(t) {
950
+ return t?.type === "IdentifierType" && t.raw === "Promise" && t.args?.types?.length === 1 && isVoidType(t.args.types[0]);
951
+ }
949
952
  function isWhitespaceOrEmpty(node) {
950
953
  if (!node)
951
954
  return true;
@@ -1391,8 +1394,8 @@ var Civet = (() => {
1391
1394
  implicitFunctionBlock(f);
1392
1395
  processParams(f);
1393
1396
  if (!processReturnValue(f) && config.implicitReturns) {
1394
- const { block, returnType } = f;
1395
- const isVoid = isVoidType(returnType?.t);
1397
+ const { async, block, returnType } = f;
1398
+ const isVoid = isVoidType(returnType?.t) || async && isPromiseVoidType(returnType?.t);
1396
1399
  const isBlock = block?.type === "BlockStatement";
1397
1400
  if (!isVoid && isBlock) {
1398
1401
  insertReturn(block);
@@ -2114,7 +2117,7 @@ var Civet = (() => {
2114
2117
  if (!hasDec(x))
2115
2118
  return a.indexOf(x) === i;
2116
2119
  }).forEach(pushVar);
2117
- const fnNodes = gatherNodes(statements, (s) => s.type === "FunctionExpression");
2120
+ const fnNodes = gatherNodes(statements, isFunction);
2118
2121
  const forNodes = gatherNodes(statements, (s) => s.type === "ForStatement");
2119
2122
  const blockNodes = new Set(gatherNodes(statements, (s) => s.type === "BlockStatement"));
2120
2123
  fnNodes.forEach(({ block }) => blockNodes.delete(block));
@@ -2166,7 +2169,7 @@ var Civet = (() => {
2166
2169
  }
2167
2170
  let currentScope = /* @__PURE__ */ new Set();
2168
2171
  scopes.push(currentScope);
2169
- const fnNodes = gatherNodes(statements, (s) => s.type === "FunctionExpression");
2172
+ const fnNodes = gatherNodes(statements, isFunction);
2170
2173
  const forNodes = gatherNodes(statements, (s) => s.type === "ForStatement");
2171
2174
  let targetStatements = [];
2172
2175
  for (const statement of statements) {
@@ -2999,6 +3002,7 @@ ${input.slice(result.pos)}
2999
3002
  NonPipelineArgumentPart,
3000
3003
  BinaryOpExpression,
3001
3004
  BinaryOpRHS,
3005
+ WRHS,
3002
3006
  SingleLineBinaryOpRHS,
3003
3007
  RHS,
3004
3008
  ParenthesizedAssignment,
@@ -3108,6 +3112,8 @@ ${input.slice(result.pos)}
3108
3112
  ExplicitBlock,
3109
3113
  ImplicitNestedBlock,
3110
3114
  Block,
3115
+ BareNestedBlock,
3116
+ BareBlock,
3111
3117
  ThenClause,
3112
3118
  BracedOrEmptyBlock,
3113
3119
  NoPostfixBracedOrEmptyBlock,
@@ -3232,7 +3238,9 @@ ${input.slice(result.pos)}
3232
3238
  PatternExpressionList,
3233
3239
  ConditionFragment,
3234
3240
  CaseExpressionList,
3241
+ CaseExpression,
3235
3242
  ImpliedColon,
3243
+ IgnoreColon,
3236
3244
  TryStatement,
3237
3245
  TryExpression,
3238
3246
  CatchClause,
@@ -3575,6 +3583,7 @@ ${input.slice(result.pos)}
3575
3583
  EOS,
3576
3584
  EOL,
3577
3585
  DebugHere,
3586
+ InsertColon,
3578
3587
  InsertSemicolon,
3579
3588
  InsertOpenParen,
3580
3589
  InsertCloseParen,
@@ -3875,23 +3884,24 @@ ${input.slice(result.pos)}
3875
3884
  var $R46 = $R(new RegExp("[^\\r\\n]", "suy"));
3876
3885
  var $R47 = $R(new RegExp("[ \\t]+", "suy"));
3877
3886
  var $R48 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
3878
- var $R49 = $R(new RegExp("\\s", "suy"));
3879
- var $R50 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
3880
- var $R51 = $R(new RegExp("[\\s>]|\\/>", "suy"));
3881
- var $R52 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
3882
- var $R53 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
3883
- var $R54 = $R(new RegExp("[<>]", "suy"));
3884
- var $R55 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
3885
- var $R56 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
3886
- var $R57 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
3887
- var $R58 = $R(new RegExp("[+-]?", "suy"));
3888
- var $R59 = $R(new RegExp("[+-]", "suy"));
3889
- var $R60 = $R(new RegExp("#![^\\r\\n]*", "suy"));
3890
- var $R61 = $R(new RegExp("[\\t ]*", "suy"));
3891
- var $R62 = $R(new RegExp("[\\s]*", "suy"));
3892
- var $R63 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
3893
- var $R64 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
3894
- var $R65 = $R(new RegExp("[ \\t]*", "suy"));
3887
+ var $R49 = $R(new RegExp("['\u2019]s", "suy"));
3888
+ var $R50 = $R(new RegExp("\\s", "suy"));
3889
+ var $R51 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
3890
+ var $R52 = $R(new RegExp("[\\s>]|\\/>", "suy"));
3891
+ var $R53 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
3892
+ var $R54 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
3893
+ var $R55 = $R(new RegExp("[<>]", "suy"));
3894
+ var $R56 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
3895
+ var $R57 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
3896
+ var $R58 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
3897
+ var $R59 = $R(new RegExp("[+-]?", "suy"));
3898
+ var $R60 = $R(new RegExp("[+-]", "suy"));
3899
+ var $R61 = $R(new RegExp("#![^\\r\\n]*", "suy"));
3900
+ var $R62 = $R(new RegExp("[\\t ]*", "suy"));
3901
+ var $R63 = $R(new RegExp("[\\s]*", "suy"));
3902
+ var $R64 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
3903
+ var $R65 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
3904
+ var $R66 = $R(new RegExp("[ \\t]*", "suy"));
3895
3905
  var Program$0 = $TS($S(Reset, Init, $E(EOS), TopLevelStatements, __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
3896
3906
  var statements = $4;
3897
3907
  processProgram({
@@ -4806,9 +4816,10 @@ ${input.slice(result.pos)}
4806
4816
  var rhs = $2;
4807
4817
  return [[], op, [], rhs];
4808
4818
  });
4809
- var BinaryOpRHS$1 = $TS($S(NewlineBinaryOpAllowed, $S(NotDedentedBinaryOp, $C(_, $S(EOS, __)), RHS)), function($skip, $loc, $0, $1, $2) {
4810
- var rhs = $2;
4811
- return [...rhs[0], ...rhs.slice(1)];
4819
+ var BinaryOpRHS$1 = $TS($S(NewlineBinaryOpAllowed, NotDedentedBinaryOp, WRHS), function($skip, $loc, $0, $1, $2, $3) {
4820
+ var op = $2;
4821
+ var rhs = $3;
4822
+ return [...op, ...rhs];
4812
4823
  });
4813
4824
  var BinaryOpRHS$2 = $T($S($N(NewlineBinaryOpAllowed), SingleLineBinaryOpRHS), function(value) {
4814
4825
  return value[1];
@@ -4835,6 +4846,35 @@ ${input.slice(result.pos)}
4835
4846
  return result;
4836
4847
  }
4837
4848
  }
4849
+ var WRHS$0 = $TS($S(PushIndent, $E($S(Nested, RHS)), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
4850
+ var wrhs = $2;
4851
+ if (!wrhs)
4852
+ return $skip;
4853
+ return wrhs;
4854
+ });
4855
+ var WRHS$1 = $S($C(_, $S(EOS, __)), RHS);
4856
+ function WRHS(state) {
4857
+ let eventData;
4858
+ if (state.events) {
4859
+ const result = state.events.enter?.("WRHS", state);
4860
+ if (result) {
4861
+ if (result.cache)
4862
+ return result.cache;
4863
+ eventData = result.data;
4864
+ }
4865
+ }
4866
+ if (state.tokenize) {
4867
+ const result = $TOKEN("WRHS", state, WRHS$0(state) || WRHS$1(state));
4868
+ if (state.events)
4869
+ state.events.exit?.("WRHS", state, result, eventData);
4870
+ return result;
4871
+ } else {
4872
+ const result = WRHS$0(state) || WRHS$1(state);
4873
+ if (state.events)
4874
+ state.events.exit?.("WRHS", state, result, eventData);
4875
+ return result;
4876
+ }
4877
+ }
4838
4878
  var SingleLineBinaryOpRHS$0 = $TS($S($E(_), BinaryOp, $C(_, $S(EOS, __)), RHS), function($skip, $loc, $0, $1, $2, $3, $4) {
4839
4879
  var ws1 = $1;
4840
4880
  var op = $2;
@@ -5541,8 +5581,8 @@ ${input.slice(result.pos)}
5541
5581
  var PrimaryExpression$2 = TemplateLiteral;
5542
5582
  var PrimaryExpression$3 = Literal;
5543
5583
  var PrimaryExpression$4 = ArrayLiteral;
5544
- var PrimaryExpression$5 = IdentifierReference;
5545
- var PrimaryExpression$6 = FunctionExpression;
5584
+ var PrimaryExpression$5 = FunctionExpression;
5585
+ var PrimaryExpression$6 = IdentifierReference;
5546
5586
  var PrimaryExpression$7 = ClassExpression;
5547
5587
  var PrimaryExpression$8 = RegularExpressionLiteral;
5548
5588
  var PrimaryExpression$9 = ParenthesizedExpression;
@@ -6609,6 +6649,8 @@ ${input.slice(result.pos)}
6609
6649
  var MemberBracketContent$1 = $TS($S(Dot, $C(TemplateLiteral, StringLiteral)), function($skip, $loc, $0, $1, $2) {
6610
6650
  var dot = $1;
6611
6651
  var str = $2;
6652
+ if (Array.isArray(dot))
6653
+ dot = dot[0];
6612
6654
  return {
6613
6655
  type: "Index",
6614
6656
  children: [
@@ -6621,6 +6663,8 @@ ${input.slice(result.pos)}
6621
6663
  var MemberBracketContent$2 = $TS($S(Dot, IntegerLiteral), function($skip, $loc, $0, $1, $2) {
6622
6664
  var dot = $1;
6623
6665
  var num = $2;
6666
+ if (Array.isArray(dot))
6667
+ dot = dot[0];
6624
6668
  return {
6625
6669
  type: "Index",
6626
6670
  children: [
@@ -8468,6 +8512,70 @@ ${input.slice(result.pos)}
8468
8512
  return result;
8469
8513
  }
8470
8514
  }
8515
+ var BareNestedBlock$0 = $TS($S($Y(EOS), AllowAll, $E(NestedBlockStatements), RestoreAll), function($skip, $loc, $0, $1, $2, $3, $4) {
8516
+ if (!$3)
8517
+ return $skip;
8518
+ return $3;
8519
+ });
8520
+ function BareNestedBlock(state) {
8521
+ let eventData;
8522
+ if (state.events) {
8523
+ const result = state.events.enter?.("BareNestedBlock", state);
8524
+ if (result) {
8525
+ if (result.cache)
8526
+ return result.cache;
8527
+ eventData = result.data;
8528
+ }
8529
+ }
8530
+ if (state.tokenize) {
8531
+ const result = $TOKEN("BareNestedBlock", state, BareNestedBlock$0(state));
8532
+ if (state.events)
8533
+ state.events.exit?.("BareNestedBlock", state, result, eventData);
8534
+ return result;
8535
+ } else {
8536
+ const result = BareNestedBlock$0(state);
8537
+ if (state.events)
8538
+ state.events.exit?.("BareNestedBlock", state, result, eventData);
8539
+ return result;
8540
+ }
8541
+ }
8542
+ var BareBlock$0 = BareNestedBlock;
8543
+ var BareBlock$1 = ExplicitBlock;
8544
+ var BareBlock$2 = ThenClause;
8545
+ var BareBlock$3 = $TS($S($E(_), $N(EOS), Statement), function($skip, $loc, $0, $1, $2, $3) {
8546
+ var ws = $1;
8547
+ var s = $3;
8548
+ const expressions = [[ws, s]];
8549
+ return {
8550
+ type: "BlockStatement",
8551
+ expressions,
8552
+ children: [expressions],
8553
+ bare: true
8554
+ };
8555
+ });
8556
+ var BareBlock$4 = EmptyBareBlock;
8557
+ function BareBlock(state) {
8558
+ let eventData;
8559
+ if (state.events) {
8560
+ const result = state.events.enter?.("BareBlock", state);
8561
+ if (result) {
8562
+ if (result.cache)
8563
+ return result.cache;
8564
+ eventData = result.data;
8565
+ }
8566
+ }
8567
+ if (state.tokenize) {
8568
+ const result = $TOKEN("BareBlock", state, BareBlock$0(state) || BareBlock$1(state) || BareBlock$2(state) || BareBlock$3(state) || BareBlock$4(state));
8569
+ if (state.events)
8570
+ state.events.exit?.("BareBlock", state, result, eventData);
8571
+ return result;
8572
+ } else {
8573
+ const result = BareBlock$0(state) || BareBlock$1(state) || BareBlock$2(state) || BareBlock$3(state) || BareBlock$4(state);
8574
+ if (state.events)
8575
+ state.events.exit?.("BareBlock", state, result, eventData);
8576
+ return result;
8577
+ }
8578
+ }
8471
8579
  var ThenClause$0 = $T($S(Then, SingleLineStatements), function(value) {
8472
8580
  return value[1];
8473
8581
  });
@@ -9802,10 +9910,24 @@ ${input.slice(result.pos)}
9802
9910
  var NestedPropertyDefinition$0 = $TS($S(Nested, $P($S(PropertyDefinition, ObjectPropertyDelimiter))), function($skip, $loc, $0, $1, $2) {
9803
9911
  var ws = $1;
9804
9912
  var inlineProps = $2;
9805
- return inlineProps.map(([prop, delimiter], i) => ({
9806
- ...prop,
9807
- children: [...i === 0 ? ws : [], ...prop.children, delimiter]
9808
- }));
9913
+ return inlineProps.flatMap(([prop, delim], i) => {
9914
+ if (!Array.isArray(prop))
9915
+ prop = [prop];
9916
+ if (i === 0) {
9917
+ const [first, ...rest] = prop;
9918
+ prop = [{ ...first, children: [...ws, ...first.children] }, ...rest];
9919
+ }
9920
+ const last = prop[prop.length - 1];
9921
+ prop = [
9922
+ ...prop.slice(0, prop.length - 1),
9923
+ {
9924
+ ...last,
9925
+ delim,
9926
+ children: [...last.children, delim]
9927
+ }
9928
+ ];
9929
+ return prop;
9930
+ });
9809
9931
  });
9810
9932
  function NestedPropertyDefinition(state) {
9811
9933
  let eventData;
@@ -9916,12 +10038,15 @@ ${input.slice(result.pos)}
9916
10038
  }
9917
10039
  }
9918
10040
  var PropertyDefinitionList$0 = $TV($P($S(PropertyDefinition, ObjectPropertyDelimiter)), function($skip, $loc, $0, $1) {
9919
- return $0.map(([prop, delim]) => {
9920
- return {
9921
- ...prop,
10041
+ return $0.flatMap(([prop, delim]) => {
10042
+ prop = Array.isArray(prop) ? prop : [prop];
10043
+ let last = prop[prop.length - 1];
10044
+ last = {
10045
+ ...last,
9922
10046
  delim,
9923
- children: [...prop.children, delim]
10047
+ children: [...last.children, delim]
9924
10048
  };
10049
+ return [...prop.slice(0, prop.length - 1), last];
9925
10050
  });
9926
10051
  });
9927
10052
  function PropertyDefinitionList(state) {
@@ -10005,8 +10130,19 @@ ${input.slice(result.pos)}
10005
10130
  var PropertyDefinition$5 = $TS($S(__, CallExpression), function($skip, $loc, $0, $1, $2) {
10006
10131
  var ws = $1;
10007
10132
  var value = $2;
10008
- if (value.type === "Identifier") {
10009
- return { ...value, children: [ws, ...value.children] };
10133
+ switch (value.type) {
10134
+ case "Identifier":
10135
+ return { ...value, children: [ws, ...value.children] };
10136
+ case "ObjectExpression":
10137
+ let first = value.properties[0];
10138
+ if (first) {
10139
+ first = {
10140
+ ...first,
10141
+ children: [ws, ...first.children],
10142
+ hoistDec: value.hoistDec
10143
+ };
10144
+ }
10145
+ return [first, ...value.properties.slice(1)];
10010
10146
  }
10011
10147
  const last = lastAccessInCallExpression(value);
10012
10148
  if (!last)
@@ -10218,13 +10354,17 @@ ${input.slice(result.pos)}
10218
10354
  return {
10219
10355
  type: "ComputedPropertyName",
10220
10356
  children: $0,
10221
- expression
10357
+ expression,
10358
+ implicit: true
10222
10359
  };
10223
10360
  });
10224
10361
  var ComputedPropertyName$2 = $TS($S(InsertOpenBracket, $EXPECT($L20, fail, 'ComputedPropertyName "-"'), NumericLiteral, InsertCloseBracket), function($skip, $loc, $0, $1, $2, $3, $4) {
10362
+ const expression = [$2, $3];
10225
10363
  return {
10226
10364
  type: "ComputedPropertyName",
10227
- children: $0
10365
+ expression,
10366
+ children: [$1, expression, $4],
10367
+ implicit: true
10228
10368
  };
10229
10369
  });
10230
10370
  function ComputedPropertyName(state) {
@@ -12852,7 +12992,7 @@ ${input.slice(result.pos)}
12852
12992
  return result;
12853
12993
  }
12854
12994
  }
12855
- var CaseClause$0 = $TS($S(PatternExpressionList, $C(ThenClause, NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2) {
12995
+ var CaseClause$0 = $TS($S(PatternExpressionList, $C(ThenClause, BareBlock)), function($skip, $loc, $0, $1, $2) {
12856
12996
  var patterns = $1;
12857
12997
  var block = $2;
12858
12998
  return {
@@ -12862,13 +13002,13 @@ ${input.slice(result.pos)}
12862
13002
  patterns
12863
13003
  };
12864
13004
  });
12865
- var CaseClause$1 = $T($S(Case, CaseExpressionList, $C(NestedBlockStatements, EmptyBareBlock)), function(value) {
13005
+ var CaseClause$1 = $T($S(Case, CaseExpressionList, IgnoreColon, $C(ThenClause, BareBlock)), function(value) {
12866
13006
  return { "type": "CaseClause", "children": value };
12867
13007
  });
12868
- var CaseClause$2 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements, EmptyBareBlock), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
13008
+ var CaseClause$2 = $TS($S(When, CaseExpressionList, IgnoreColon, InsertOpenBrace, $C(ThenClause, BareBlock), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
12869
13009
  var cases = $2;
12870
- var block = $4;
12871
- var b = $5;
13010
+ var block = $5;
13011
+ var b = $6;
12872
13012
  return {
12873
13013
  type: "WhenClause",
12874
13014
  cases,
@@ -12877,7 +13017,7 @@ ${input.slice(result.pos)}
12877
13017
  children: $0
12878
13018
  };
12879
13019
  });
12880
- var CaseClause$3 = $TS($S(Default, ImpliedColon, $C(NestedBlockStatements, EmptyBareBlock)), function($skip, $loc, $0, $1, $2, $3) {
13020
+ var CaseClause$3 = $TS($S(Default, ImpliedColon, $C(ThenClause, BareBlock)), function($skip, $loc, $0, $1, $2, $3) {
12881
13021
  var block = $3;
12882
13022
  return {
12883
13023
  type: "DefaultClause",
@@ -12973,7 +13113,7 @@ ${input.slice(result.pos)}
12973
13113
  return result;
12974
13114
  }
12975
13115
  }
12976
- var CaseExpressionList$0 = $TS($S(ForbidMultiLineImplicitObjectLiteral, $E($S($Q(_), ExpressionWithObjectApplicationForbidden, ImpliedColon)), $Q($S(__, Comma, ExpressionWithObjectApplicationForbidden, ImpliedColon)), RestoreMultiLineImplicitObjectLiteral), function($skip, $loc, $0, $1, $2, $3, $4) {
13116
+ var CaseExpressionList$0 = $TS($S(ForbidMultiLineImplicitObjectLiteral, $E($S($E(_), CaseExpression, InsertColon)), $Q($S(__, Comma, CaseExpression, InsertColon)), RestoreMultiLineImplicitObjectLiteral), function($skip, $loc, $0, $1, $2, $3, $4) {
12977
13117
  var first = $2;
12978
13118
  var rest = $3;
12979
13119
  if (!first)
@@ -13009,10 +13149,40 @@ ${input.slice(result.pos)}
13009
13149
  return result;
13010
13150
  }
13011
13151
  }
13012
- var ImpliedColon$0 = $S($E(_), Colon);
13013
- var ImpliedColon$1 = $TV($EXPECT($L0, fail, 'ImpliedColon ""'), function($skip, $loc, $0, $1) {
13014
- return { $loc, token: ":" };
13152
+ var CaseExpression$0 = $TS($S(PropertyName, $Y($S($E(_), Colon))), function($skip, $loc, $0, $1, $2) {
13153
+ var value = $1;
13154
+ if (value.type === "ComputedPropertyName") {
13155
+ if (value.implicit)
13156
+ return value.expression;
13157
+ return { ...value, type: "ArrayExpression" };
13158
+ }
13159
+ return value;
13015
13160
  });
13161
+ var CaseExpression$1 = ExpressionWithObjectApplicationForbidden;
13162
+ function CaseExpression(state) {
13163
+ let eventData;
13164
+ if (state.events) {
13165
+ const result = state.events.enter?.("CaseExpression", state);
13166
+ if (result) {
13167
+ if (result.cache)
13168
+ return result.cache;
13169
+ eventData = result.data;
13170
+ }
13171
+ }
13172
+ if (state.tokenize) {
13173
+ const result = $TOKEN("CaseExpression", state, CaseExpression$0(state) || CaseExpression$1(state));
13174
+ if (state.events)
13175
+ state.events.exit?.("CaseExpression", state, result, eventData);
13176
+ return result;
13177
+ } else {
13178
+ const result = CaseExpression$0(state) || CaseExpression$1(state);
13179
+ if (state.events)
13180
+ state.events.exit?.("CaseExpression", state, result, eventData);
13181
+ return result;
13182
+ }
13183
+ }
13184
+ var ImpliedColon$0 = $S($E(_), Colon);
13185
+ var ImpliedColon$1 = InsertColon;
13016
13186
  function ImpliedColon(state) {
13017
13187
  let eventData;
13018
13188
  if (state.events) {
@@ -13035,6 +13205,32 @@ ${input.slice(result.pos)}
13035
13205
  return result;
13036
13206
  }
13037
13207
  }
13208
+ var IgnoreColon$0 = $TV($E($S($E(_), Colon)), function($skip, $loc, $0, $1) {
13209
+ if ($1)
13210
+ return $1[0];
13211
+ });
13212
+ function IgnoreColon(state) {
13213
+ let eventData;
13214
+ if (state.events) {
13215
+ const result = state.events.enter?.("IgnoreColon", state);
13216
+ if (result) {
13217
+ if (result.cache)
13218
+ return result.cache;
13219
+ eventData = result.data;
13220
+ }
13221
+ }
13222
+ if (state.tokenize) {
13223
+ const result = $TOKEN("IgnoreColon", state, IgnoreColon$0(state));
13224
+ if (state.events)
13225
+ state.events.exit?.("IgnoreColon", state, result, eventData);
13226
+ return result;
13227
+ } else {
13228
+ const result = IgnoreColon$0(state);
13229
+ if (state.events)
13230
+ state.events.exit?.("IgnoreColon", state, result, eventData);
13231
+ return result;
13232
+ }
13233
+ }
13038
13234
  var TryStatement$0 = $TS($S(Try, $N($EXPECT($L12, fail, 'TryStatement ":"')), NoPostfixBracedOrEmptyBlock, $E(CatchClause), $E(FinallyClause)), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
13039
13235
  var t = $1;
13040
13236
  var b = $3;
@@ -17366,6 +17562,13 @@ ${input.slice(result.pos)}
17366
17562
  var Dot$0 = $TV($EXPECT($L6, fail, 'Dot "."'), function($skip, $loc, $0, $1) {
17367
17563
  return { $loc, token: $1 };
17368
17564
  });
17565
+ var Dot$1 = $TS($S($EXPECT($R49, fail, "Dot /['\u2019]s/"), _), function($skip, $loc, $0, $1, $2) {
17566
+ var ws = $2;
17567
+ return [
17568
+ { $loc, token: "." },
17569
+ insertTrimmingSpace(ws, "")
17570
+ ];
17571
+ });
17369
17572
  function Dot(state) {
17370
17573
  let eventData;
17371
17574
  if (state.events) {
@@ -17377,12 +17580,12 @@ ${input.slice(result.pos)}
17377
17580
  }
17378
17581
  }
17379
17582
  if (state.tokenize) {
17380
- const result = $TOKEN("Dot", state, Dot$0(state));
17583
+ const result = $TOKEN("Dot", state, Dot$0(state) || Dot$1(state));
17381
17584
  if (state.events)
17382
17585
  state.events.exit?.("Dot", state, result, eventData);
17383
17586
  return result;
17384
17587
  } else {
17385
- const result = Dot$0(state);
17588
+ const result = Dot$0(state) || Dot$1(state);
17386
17589
  if (state.events)
17387
17590
  state.events.exit?.("Dot", state, result, eventData);
17388
17591
  return result;
@@ -17744,7 +17947,7 @@ ${input.slice(result.pos)}
17744
17947
  return result;
17745
17948
  }
17746
17949
  }
17747
- var Import$0 = $TS($S($EXPECT($L17, fail, 'Import "import"'), $Y($EXPECT($R49, fail, "Import /\\s/"))), function($skip, $loc, $0, $1, $2) {
17950
+ var Import$0 = $TS($S($EXPECT($L17, fail, 'Import "import"'), $Y($EXPECT($R50, fail, "Import /\\s/"))), function($skip, $loc, $0, $1, $2) {
17748
17951
  return { $loc, token: $1 };
17749
17952
  });
17750
17953
  function Import(state) {
@@ -19322,7 +19525,7 @@ ${input.slice(result.pos)}
19322
19525
  return result;
19323
19526
  }
19324
19527
  }
19325
- var JSXIdentifierName$0 = $R$0($EXPECT($R50, fail, "JSXIdentifierName /(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*/"));
19528
+ var JSXIdentifierName$0 = $R$0($EXPECT($R51, fail, "JSXIdentifierName /(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*/"));
19326
19529
  function JSXIdentifierName(state) {
19327
19530
  let eventData;
19328
19531
  if (state.events) {
@@ -19560,7 +19763,7 @@ ${input.slice(result.pos)}
19560
19763
  return result;
19561
19764
  }
19562
19765
  }
19563
- var JSXAttributeSpace$0 = $R$0($EXPECT($R51, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
19766
+ var JSXAttributeSpace$0 = $R$0($EXPECT($R52, fail, "JSXAttributeSpace /[\\s>]|\\/>/"));
19564
19767
  function JSXAttributeSpace(state) {
19565
19768
  let eventData;
19566
19769
  if (state.events) {
@@ -19583,7 +19786,7 @@ ${input.slice(result.pos)}
19583
19786
  return result;
19584
19787
  }
19585
19788
  }
19586
- var JSXShorthandString$0 = $TR($EXPECT($R52, fail, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19789
+ var JSXShorthandString$0 = $TR($EXPECT($R53, fail, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19587
19790
  return quoteString($0);
19588
19791
  });
19589
19792
  var JSXShorthandString$1 = $TS($S(TemplateLiteral), function($skip, $loc, $0, $1) {
@@ -19672,7 +19875,7 @@ ${input.slice(result.pos)}
19672
19875
  }
19673
19876
  return [open, value, close];
19674
19877
  });
19675
- var JSXAttributeValue$4 = $R$0($EXPECT($R53, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
19878
+ var JSXAttributeValue$4 = $R$0($EXPECT($R54, fail, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
19676
19879
  function JSXAttributeValue(state) {
19677
19880
  let eventData;
19678
19881
  if (state.events) {
@@ -19722,7 +19925,7 @@ ${input.slice(result.pos)}
19722
19925
  return result;
19723
19926
  }
19724
19927
  }
19725
- var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R54, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
19928
+ var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R55, fail, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
19726
19929
  var op = $2;
19727
19930
  var rhs = $3;
19728
19931
  return [[], op, [], rhs];
@@ -19777,7 +19980,7 @@ ${input.slice(result.pos)}
19777
19980
  return result;
19778
19981
  }
19779
19982
  }
19780
- var InlineJSXUnaryOp$0 = $TR($EXPECT($R55, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19983
+ var InlineJSXUnaryOp$0 = $TR($EXPECT($R56, fail, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
19781
19984
  return { $loc, token: $0 };
19782
19985
  });
19783
19986
  function InlineJSXUnaryOp(state) {
@@ -20267,7 +20470,7 @@ ${input.slice(result.pos)}
20267
20470
  return result;
20268
20471
  }
20269
20472
  }
20270
- var JSXCommentContent$0 = $TR($EXPECT($R56, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20473
+ var JSXCommentContent$0 = $TR($EXPECT($R57, fail, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20271
20474
  return { $loc, token: $0.replace(/\*\//g, "* /") };
20272
20475
  });
20273
20476
  function JSXCommentContent(state) {
@@ -20292,7 +20495,7 @@ ${input.slice(result.pos)}
20292
20495
  return result;
20293
20496
  }
20294
20497
  }
20295
- var JSXText$0 = $TR($EXPECT($R57, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20498
+ var JSXText$0 = $TR($EXPECT($R58, fail, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
20296
20499
  return {
20297
20500
  type: "JSXText",
20298
20501
  token: $0,
@@ -21260,7 +21463,7 @@ ${input.slice(result.pos)}
21260
21463
  return result;
21261
21464
  }
21262
21465
  }
21263
- var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R58, fail, "TypeIndexSignature /[+-]?/")), Readonly, NotDedented)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R59, fail, "TypeIndexSignature /[+-]/")), $Y($S($E(_), QuestionMark)))));
21466
+ var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R59, fail, "TypeIndexSignature /[+-]?/")), Readonly, NotDedented)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R60, fail, "TypeIndexSignature /[+-]/")), $Y($S($E(_), QuestionMark)))));
21264
21467
  function TypeIndexSignature(state) {
21265
21468
  let eventData;
21266
21469
  if (state.events) {
@@ -21711,17 +21914,25 @@ ${input.slice(result.pos)}
21711
21914
  return result;
21712
21915
  }
21713
21916
  }
21714
- var TypeElement$0 = $S($S(__, DotDotDot, __), Type);
21715
- var TypeElement$1 = $TS($S(Type, $E($S($E(_), DotDotDot))), function($skip, $loc, $0, $1, $2) {
21917
+ var TypeElement$0 = $TS($S(__, IdentifierName, $E(_), DotDotDot, $S(__, $E($S(QuestionMark, $E(_))), Colon, __), Type), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
21918
+ var ws = $1;
21919
+ var name = $2;
21920
+ var space = $3;
21921
+ var dots = $4;
21922
+ var colon = $5;
21923
+ var type = $6;
21924
+ return [ws, dots, space, name, colon, type];
21925
+ });
21926
+ var TypeElement$1 = $TS($S(Type, $E(_), DotDotDot), function($skip, $loc, $0, $1, $2, $3) {
21716
21927
  var type = $1;
21717
- var dots = $2;
21718
- if (!dots)
21719
- return type;
21928
+ var space = $2;
21929
+ var dots = $3;
21720
21930
  const ws = getTrimmingSpace(type);
21721
21931
  if (!ws)
21722
- return [dots[1], dots[0], type];
21723
- return [ws, dots[1], dots[0], insertTrimmingSpace(type, "")];
21932
+ return [dots, space, type];
21933
+ return [ws, dots, space, insertTrimmingSpace(type, "")];
21724
21934
  });
21935
+ var TypeElement$2 = $S($E($S(__, DotDotDot)), $E($S(__, IdentifierName, __, $E($S(QuestionMark, $E(_))), Colon, __)), Type);
21725
21936
  function TypeElement(state) {
21726
21937
  let eventData;
21727
21938
  if (state.events) {
@@ -21733,12 +21944,12 @@ ${input.slice(result.pos)}
21733
21944
  }
21734
21945
  }
21735
21946
  if (state.tokenize) {
21736
- const result = $TOKEN("TypeElement", state, TypeElement$0(state) || TypeElement$1(state));
21947
+ const result = $TOKEN("TypeElement", state, TypeElement$0(state) || TypeElement$1(state) || TypeElement$2(state));
21737
21948
  if (state.events)
21738
21949
  state.events.exit?.("TypeElement", state, result, eventData);
21739
21950
  return result;
21740
21951
  } else {
21741
- const result = TypeElement$0(state) || TypeElement$1(state);
21952
+ const result = TypeElement$0(state) || TypeElement$1(state) || TypeElement$2(state);
21742
21953
  if (state.events)
21743
21954
  state.events.exit?.("TypeElement", state, result, eventData);
21744
21955
  return result;
@@ -21772,7 +21983,7 @@ ${input.slice(result.pos)}
21772
21983
  return result;
21773
21984
  }
21774
21985
  }
21775
- var NestedType$0 = $S(Nested, Type, ArrayElementDelimiter);
21986
+ var NestedType$0 = $S(Nested, TypeElement, ArrayElementDelimiter);
21776
21987
  function NestedType(state) {
21777
21988
  let eventData;
21778
21989
  if (state.events) {
@@ -22112,7 +22323,8 @@ ${input.slice(result.pos)}
22112
22323
  }
22113
22324
  }
22114
22325
  var TypeArguments$0 = $TS($S($EXPECT($L155, fail, 'TypeArguments "<"'), $P(TypeArgument), __, $EXPECT($L34, fail, 'TypeArguments ">"')), function($skip, $loc, $0, $1, $2, $3, $4) {
22115
- return { ts: true, children: $0 };
22326
+ var args = $2;
22327
+ return { ts: true, types: args.map(([, t]) => t), children: $0 };
22116
22328
  });
22117
22329
  function TypeArguments(state) {
22118
22330
  let eventData;
@@ -22334,7 +22546,7 @@ ${input.slice(result.pos)}
22334
22546
  return result;
22335
22547
  }
22336
22548
  }
22337
- var Shebang$0 = $S($R$0($EXPECT($R60, fail, "Shebang /#![^\\r\\n]*/")), EOL);
22549
+ var Shebang$0 = $S($R$0($EXPECT($R61, fail, "Shebang /#![^\\r\\n]*/")), EOL);
22338
22550
  function Shebang(state) {
22339
22551
  let eventData;
22340
22552
  if (state.events) {
@@ -22357,11 +22569,11 @@ ${input.slice(result.pos)}
22357
22569
  return result;
22358
22570
  }
22359
22571
  }
22360
- var CivetPrologue$0 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22572
+ var CivetPrologue$0 = $T($S($EXPECT($R62, fail, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22361
22573
  var content = value[2];
22362
22574
  return content;
22363
22575
  });
22364
- var CivetPrologue$1 = $T($S($EXPECT($R61, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22576
+ var CivetPrologue$1 = $T($S($EXPECT($R62, fail, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, $TEXT(SimpleStatementDelimiter), $E(EOS)), function(value) {
22365
22577
  var content = value[2];
22366
22578
  return content;
22367
22579
  });
@@ -22387,7 +22599,7 @@ ${input.slice(result.pos)}
22387
22599
  return result;
22388
22600
  }
22389
22601
  }
22390
- var CivetPrologueContent$0 = $TS($S($EXPECT($L206, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R62, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
22602
+ var CivetPrologueContent$0 = $TS($S($EXPECT($L206, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R63, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
22391
22603
  var options = $3;
22392
22604
  return {
22393
22605
  type: "CivetPrologue",
@@ -22417,7 +22629,7 @@ ${input.slice(result.pos)}
22417
22629
  return result;
22418
22630
  }
22419
22631
  }
22420
- 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) {
22632
+ var CivetOption$0 = $TR($EXPECT($R64, 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) {
22421
22633
  const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
22422
22634
  if (l)
22423
22635
  return l.toUpperCase();
@@ -22453,7 +22665,7 @@ ${input.slice(result.pos)}
22453
22665
  return result;
22454
22666
  }
22455
22667
  }
22456
- var UnknownPrologue$0 = $S($R$0($EXPECT($R61, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
22668
+ var UnknownPrologue$0 = $S($R$0($EXPECT($R62, fail, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
22457
22669
  function UnknownPrologue(state) {
22458
22670
  let eventData;
22459
22671
  if (state.events) {
@@ -22523,7 +22735,7 @@ ${input.slice(result.pos)}
22523
22735
  return result;
22524
22736
  }
22525
22737
  }
22526
- 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) {
22738
+ var EOL$0 = $TR($EXPECT($R65, fail, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
22527
22739
  return { $loc, token: $0 };
22528
22740
  });
22529
22741
  function EOL(state) {
@@ -22573,6 +22785,31 @@ ${input.slice(result.pos)}
22573
22785
  return result;
22574
22786
  }
22575
22787
  }
22788
+ var InsertColon$0 = $TV($EXPECT($L0, fail, 'InsertColon ""'), function($skip, $loc, $0, $1) {
22789
+ return { $loc, token: ":" };
22790
+ });
22791
+ function InsertColon(state) {
22792
+ let eventData;
22793
+ if (state.events) {
22794
+ const result = state.events.enter?.("InsertColon", state);
22795
+ if (result) {
22796
+ if (result.cache)
22797
+ return result.cache;
22798
+ eventData = result.data;
22799
+ }
22800
+ }
22801
+ if (state.tokenize) {
22802
+ const result = $TOKEN("InsertColon", state, InsertColon$0(state));
22803
+ if (state.events)
22804
+ state.events.exit?.("InsertColon", state, result, eventData);
22805
+ return result;
22806
+ } else {
22807
+ const result = InsertColon$0(state);
22808
+ if (state.events)
22809
+ state.events.exit?.("InsertColon", state, result, eventData);
22810
+ return result;
22811
+ }
22812
+ }
22576
22813
  var InsertSemicolon$0 = $TV($EXPECT($L0, fail, 'InsertSemicolon ""'), function($skip, $loc, $0, $1) {
22577
22814
  return { $loc, token: ";" };
22578
22815
  });
@@ -23684,7 +23921,7 @@ ${input.slice(result.pos)}
23684
23921
  return result;
23685
23922
  }
23686
23923
  }
23687
- var Indent$0 = $TR($EXPECT($R65, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
23924
+ var Indent$0 = $TR($EXPECT($R66, fail, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
23688
23925
  let level;
23689
23926
  if (module.config.tab) {
23690
23927
  const tabs = $0.match(/\t/g);