@danielx/civet 0.5.71 → 0.5.73

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
@@ -494,6 +494,11 @@ ${input.slice(result.pos)}
494
494
  NestedClassElement,
495
495
  ClassElement,
496
496
  ClassElementDefinition,
497
+ ClassSignature,
498
+ ClassSignatureBody,
499
+ NestedClassSignatureElements,
500
+ NestedClassSignatureElement,
501
+ ClassSignatureElement,
497
502
  AccessModifier,
498
503
  FieldDefinition,
499
504
  ThisLiteral,
@@ -842,6 +847,7 @@ ${input.slice(result.pos)}
842
847
  Import,
843
848
  In,
844
849
  LetOrConst,
850
+ LetOrConstOrVar,
845
851
  Loop,
846
852
  New,
847
853
  Not,
@@ -935,6 +941,8 @@ ${input.slice(result.pos)}
935
941
  InterfaceExtendsTarget,
936
942
  TypeKeyword,
937
943
  Interface,
944
+ Global,
945
+ Module,
938
946
  Namespace,
939
947
  InterfaceBlock,
940
948
  NestedInterfaceProperties,
@@ -942,9 +950,13 @@ ${input.slice(result.pos)}
942
950
  InterfaceProperty,
943
951
  BasicInterfaceProperty,
944
952
  InterfacePropertyDelimiter,
945
- NamespaceBlock,
946
- NestedTypeDeclarations,
947
- NestedTypeDeclaration,
953
+ ModuleBlock,
954
+ NestedModuleItems,
955
+ NestedModuleItem,
956
+ DeclareBlock,
957
+ NestedDeclareElements,
958
+ NestedDeclareElement,
959
+ DeclareElement,
948
960
  TypeIndexSignature,
949
961
  TypeIndex,
950
962
  TypeSuffix,
@@ -1203,12 +1215,14 @@ ${input.slice(result.pos)}
1203
1215
  var $L170 = $L("-->");
1204
1216
  var $L171 = $L("type");
1205
1217
  var $L172 = $L("interface");
1206
- var $L173 = $L("namespace");
1207
- var $L174 = $L("asserts");
1208
- var $L175 = $L("keyof");
1209
- var $L176 = $L("infer");
1210
- var $L177 = $L("[]");
1211
- var $L178 = $L("civet");
1218
+ var $L173 = $L("global");
1219
+ var $L174 = $L("module");
1220
+ var $L175 = $L("namespace");
1221
+ var $L176 = $L("asserts");
1222
+ var $L177 = $L("keyof");
1223
+ var $L178 = $L("infer");
1224
+ var $L179 = $L("[]");
1225
+ var $L180 = $L("civet");
1212
1226
  var $R0 = $R(new RegExp("(as|for|while|until|of|satisfies|then|when|implements|xor|xnor)(?!\\p{ID_Continue}|[\\u200C\\u200D$])", "suy"));
1213
1227
  var $R1 = $R(new RegExp("[0-9]", "suy"));
1214
1228
  var $R2 = $R(new RegExp("[)}]", "suy"));
@@ -2738,9 +2752,7 @@ ${input.slice(result.pos)}
2738
2752
  return result;
2739
2753
  }
2740
2754
  }
2741
- var ClassExpression$0 = $TS($S($E(Decorators), $E($S(Abstract, __)), Class, $E(ClassBinding), $E(ClassHeritage), ClassBody), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6) {
2742
- return $0;
2743
- });
2755
+ var ClassExpression$0 = $S($E(Decorators), $E($S(Abstract, __)), Class, $E(ClassBinding), $E(ClassHeritage), ClassBody);
2744
2756
  function ClassExpression(state) {
2745
2757
  let eventData;
2746
2758
  if (state.events) {
@@ -3136,6 +3148,128 @@ ${input.slice(result.pos)}
3136
3148
  return result;
3137
3149
  }
3138
3150
  }
3151
+ var ClassSignature$0 = $S($E(Decorators), $E($S(Abstract, __)), Class, $E(ClassBinding), $E(ClassHeritage), ClassSignatureBody);
3152
+ function ClassSignature(state) {
3153
+ let eventData;
3154
+ if (state.events) {
3155
+ const result = state.events.enter?.("ClassSignature", state);
3156
+ if (result) {
3157
+ if (result.cache)
3158
+ return result.cache;
3159
+ eventData = result.data;
3160
+ }
3161
+ }
3162
+ if (state.tokenize) {
3163
+ const result = $TOKEN("ClassSignature", state, ClassSignature$0(state));
3164
+ if (state.events)
3165
+ state.events.exit?.("ClassSignature", state, result, eventData);
3166
+ return result;
3167
+ } else {
3168
+ const result = ClassSignature$0(state);
3169
+ if (state.events)
3170
+ state.events.exit?.("ClassSignature", state, result, eventData);
3171
+ return result;
3172
+ }
3173
+ }
3174
+ var ClassSignatureBody$0 = $S(__, OpenBrace, $E(NestedClassSignatureElements), __, CloseBrace);
3175
+ var ClassSignatureBody$1 = $S(InsertOpenBrace, $E(NestedClassSignatureElements), InsertNewline, InsertIndent, InsertCloseBrace);
3176
+ function ClassSignatureBody(state) {
3177
+ let eventData;
3178
+ if (state.events) {
3179
+ const result = state.events.enter?.("ClassSignatureBody", state);
3180
+ if (result) {
3181
+ if (result.cache)
3182
+ return result.cache;
3183
+ eventData = result.data;
3184
+ }
3185
+ }
3186
+ if (state.tokenize) {
3187
+ const result = $TOKEN("ClassSignatureBody", state, ClassSignatureBody$0(state) || ClassSignatureBody$1(state));
3188
+ if (state.events)
3189
+ state.events.exit?.("ClassSignatureBody", state, result, eventData);
3190
+ return result;
3191
+ } else {
3192
+ const result = ClassSignatureBody$0(state) || ClassSignatureBody$1(state);
3193
+ if (state.events)
3194
+ state.events.exit?.("ClassSignatureBody", state, result, eventData);
3195
+ return result;
3196
+ }
3197
+ }
3198
+ var NestedClassSignatureElements$0 = $TS($S(PushIndent, $Q(NestedClassSignatureElement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
3199
+ var elements = $2;
3200
+ if (!elements.length)
3201
+ return $skip;
3202
+ return elements;
3203
+ });
3204
+ function NestedClassSignatureElements(state) {
3205
+ let eventData;
3206
+ if (state.events) {
3207
+ const result = state.events.enter?.("NestedClassSignatureElements", state);
3208
+ if (result) {
3209
+ if (result.cache)
3210
+ return result.cache;
3211
+ eventData = result.data;
3212
+ }
3213
+ }
3214
+ if (state.tokenize) {
3215
+ const result = $TOKEN("NestedClassSignatureElements", state, NestedClassSignatureElements$0(state));
3216
+ if (state.events)
3217
+ state.events.exit?.("NestedClassSignatureElements", state, result, eventData);
3218
+ return result;
3219
+ } else {
3220
+ const result = NestedClassSignatureElements$0(state);
3221
+ if (state.events)
3222
+ state.events.exit?.("NestedClassSignatureElements", state, result, eventData);
3223
+ return result;
3224
+ }
3225
+ }
3226
+ var NestedClassSignatureElement$0 = $S(Nested, ClassSignatureElement, StatementDelimiter);
3227
+ function NestedClassSignatureElement(state) {
3228
+ let eventData;
3229
+ if (state.events) {
3230
+ const result = state.events.enter?.("NestedClassSignatureElement", state);
3231
+ if (result) {
3232
+ if (result.cache)
3233
+ return result.cache;
3234
+ eventData = result.data;
3235
+ }
3236
+ }
3237
+ if (state.tokenize) {
3238
+ const result = $TOKEN("NestedClassSignatureElement", state, NestedClassSignatureElement$0(state));
3239
+ if (state.events)
3240
+ state.events.exit?.("NestedClassSignatureElement", state, result, eventData);
3241
+ return result;
3242
+ } else {
3243
+ const result = NestedClassSignatureElement$0(state);
3244
+ if (state.events)
3245
+ state.events.exit?.("NestedClassSignatureElement", state, result, eventData);
3246
+ return result;
3247
+ }
3248
+ }
3249
+ var ClassSignatureElement$0 = $S($E(Decorators), $E(AccessModifier), $E($S(Static, $Q(TrailingComment))), $C(MethodSignature, FieldDefinition));
3250
+ var ClassSignatureElement$1 = $S(Static, ClassSignatureBody);
3251
+ function ClassSignatureElement(state) {
3252
+ let eventData;
3253
+ if (state.events) {
3254
+ const result = state.events.enter?.("ClassSignatureElement", state);
3255
+ if (result) {
3256
+ if (result.cache)
3257
+ return result.cache;
3258
+ eventData = result.data;
3259
+ }
3260
+ }
3261
+ if (state.tokenize) {
3262
+ const result = $TOKEN("ClassSignatureElement", state, ClassSignatureElement$0(state) || ClassSignatureElement$1(state));
3263
+ if (state.events)
3264
+ state.events.exit?.("ClassSignatureElement", state, result, eventData);
3265
+ return result;
3266
+ } else {
3267
+ const result = ClassSignatureElement$0(state) || ClassSignatureElement$1(state);
3268
+ if (state.events)
3269
+ state.events.exit?.("ClassSignatureElement", state, result, eventData);
3270
+ return result;
3271
+ }
3272
+ }
3139
3273
  var AccessModifier$0 = $TS($S($E($S($C(Public, Private, Protected), __)), $E($S(Readonly, __))), function($skip, $loc, $0, $1, $2) {
3140
3274
  if (!($1 || $2))
3141
3275
  return $skip;
@@ -3700,6 +3834,20 @@ ${input.slice(result.pos)}
3700
3834
  children: [start, [...ws, { ...sep, token: ", " }], [end, ...inc]]
3701
3835
  };
3702
3836
  });
3837
+ var SliceParameters$2 = $TS($S(Loc, __, $C(DotDot, DotDotDot), $Y($S(__, CloseBracket))), function($skip, $loc, $0, $1, $2, $3, $4) {
3838
+ var l = $1;
3839
+ var ws = $2;
3840
+ const start = {
3841
+ $loc: l.$loc,
3842
+ token: "0"
3843
+ };
3844
+ return {
3845
+ type: "SliceParameters",
3846
+ start,
3847
+ end: void 0,
3848
+ children: [start, ws]
3849
+ };
3850
+ });
3703
3851
  function SliceParameters(state) {
3704
3852
  let eventData;
3705
3853
  if (state.events) {
@@ -3711,12 +3859,12 @@ ${input.slice(result.pos)}
3711
3859
  }
3712
3860
  }
3713
3861
  if (state.tokenize) {
3714
- const result = $TOKEN("SliceParameters", state, SliceParameters$0(state) || SliceParameters$1(state));
3862
+ const result = $TOKEN("SliceParameters", state, SliceParameters$0(state) || SliceParameters$1(state) || SliceParameters$2(state));
3715
3863
  if (state.events)
3716
3864
  state.events.exit?.("SliceParameters", state, result, eventData);
3717
3865
  return result;
3718
3866
  } else {
3719
- const result = SliceParameters$0(state) || SliceParameters$1(state);
3867
+ const result = SliceParameters$0(state) || SliceParameters$1(state) || SliceParameters$2(state);
3720
3868
  if (state.events)
3721
3869
  state.events.exit?.("SliceParameters", state, result, eventData);
3722
3870
  return result;
@@ -5327,19 +5475,15 @@ ${input.slice(result.pos)}
5327
5475
  };
5328
5476
  return {
5329
5477
  type: "ArrowFunction",
5330
- children: [ref2, " => ", prefix, ref2]
5478
+ children: [ref2, " => ", prefix, ref2],
5479
+ ampersandBlock: true
5331
5480
  };
5332
5481
  }
5333
5482
  const { ref } = rhs;
5334
- if (!prefix) {
5335
- return {
5336
- type: "ArrowFunction",
5337
- children: [ref, " => ", rhs]
5338
- };
5339
- }
5340
5483
  return {
5341
5484
  type: "ArrowFunction",
5342
- children: [ref, " => ", prefix, rhs]
5485
+ children: [ref, " => ", prefix, rhs],
5486
+ ampersandBlock: true
5343
5487
  };
5344
5488
  });
5345
5489
  function FunctionExpression(state) {
@@ -9579,7 +9723,8 @@ ${input.slice(result.pos)}
9579
9723
  return {
9580
9724
  type: "SwitchExpression",
9581
9725
  children: ["(()=>{", e.children, "})()"],
9582
- caseBlock: e.children[2]
9726
+ expression: e.expression,
9727
+ caseBlock: e.caseBlock
9583
9728
  };
9584
9729
  });
9585
9730
  function SwitchExpression(state) {
@@ -11103,7 +11248,7 @@ ${input.slice(result.pos)}
11103
11248
  return $0;
11104
11249
  return { ts: true, children: $0 };
11105
11250
  });
11106
- var ExportDeclaration$2 = $TS($S(Export, __, $C(Declaration, TypeAndNamedExports, VariableStatement, ExportVarDec)), function($skip, $loc, $0, $1, $2, $3) {
11251
+ var ExportDeclaration$2 = $TS($S(Export, __, $C(Declaration, VariableStatement, TypeAndNamedExports, ExportVarDec)), function($skip, $loc, $0, $1, $2, $3) {
11107
11252
  if (!$3.ts)
11108
11253
  return $0;
11109
11254
  return { ts: true, children: $0 };
@@ -13776,7 +13921,7 @@ ${input.slice(result.pos)}
13776
13921
  return result;
13777
13922
  }
13778
13923
  }
13779
- var DotDot$0 = $TV($EXPECT($L114, fail, 'DotDot ".."'), function($skip, $loc, $0, $1) {
13924
+ var DotDot$0 = $TS($S($EXPECT($L114, fail, 'DotDot ".."'), $N($EXPECT($L4, fail, 'DotDot "."'))), function($skip, $loc, $0, $1, $2) {
13780
13925
  return { $loc, token: $1 };
13781
13926
  });
13782
13927
  function DotDot(state) {
@@ -14201,6 +14346,30 @@ ${input.slice(result.pos)}
14201
14346
  return result;
14202
14347
  }
14203
14348
  }
14349
+ var LetOrConstOrVar$0 = LetOrConst;
14350
+ var LetOrConstOrVar$1 = Var;
14351
+ function LetOrConstOrVar(state) {
14352
+ let eventData;
14353
+ if (state.events) {
14354
+ const result = state.events.enter?.("LetOrConstOrVar", state);
14355
+ if (result) {
14356
+ if (result.cache)
14357
+ return result.cache;
14358
+ eventData = result.data;
14359
+ }
14360
+ }
14361
+ if (state.tokenize) {
14362
+ const result = $TOKEN("LetOrConstOrVar", state, LetOrConstOrVar$0(state) || LetOrConstOrVar$1(state));
14363
+ if (state.events)
14364
+ state.events.exit?.("LetOrConstOrVar", state, result, eventData);
14365
+ return result;
14366
+ } else {
14367
+ const result = LetOrConstOrVar$0(state) || LetOrConstOrVar$1(state);
14368
+ if (state.events)
14369
+ state.events.exit?.("LetOrConstOrVar", state, result, eventData);
14370
+ return result;
14371
+ }
14372
+ }
14204
14373
  var Loop$0 = $TS($S($EXPECT($L130, fail, 'Loop "loop"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
14205
14374
  return { $loc, token: "while(true)" };
14206
14375
  });
@@ -16659,7 +16828,7 @@ ${input.slice(result.pos)}
16659
16828
  }
16660
16829
  var TypeDeclarationRest$0 = $S(TypeKeyword, $Q(TrailingComment), IdentifierName, $E(TypeParameters), __, Equals, $C($S($E(_), Type), $S(__, Type)));
16661
16830
  var TypeDeclarationRest$1 = $S(Interface, $Q(TrailingComment), IdentifierName, $E(TypeParameters), $E(InterfaceExtendsClause), InterfaceBlock);
16662
- var TypeDeclarationRest$2 = $S(Namespace, $Q(TrailingComment), IdentifierName, NamespaceBlock);
16831
+ var TypeDeclarationRest$2 = $S(Namespace, $Q(TrailingComment), IdentifierName, ModuleBlock);
16663
16832
  var TypeDeclarationRest$3 = FunctionSignature;
16664
16833
  function TypeDeclarationRest(state) {
16665
16834
  let eventData;
@@ -16683,7 +16852,11 @@ ${input.slice(result.pos)}
16683
16852
  return result;
16684
16853
  }
16685
16854
  }
16686
- var TypeLexicalDeclaration$0 = $S(__, $N(Namespace), LetOrConst, TypeDeclarationBinding, $Q($S(CommaDelimiter, __, TypeDeclarationBinding)));
16855
+ var TypeLexicalDeclaration$0 = $S(__, LetOrConstOrVar, TypeDeclarationBinding, $Q($S(CommaDelimiter, __, TypeDeclarationBinding)));
16856
+ var TypeLexicalDeclaration$1 = ClassSignature;
16857
+ var TypeLexicalDeclaration$2 = $S(Namespace, $Q(TrailingComment), IdentifierName, DeclareBlock);
16858
+ var TypeLexicalDeclaration$3 = $S(Module, _, StringLiteral, $E(DeclareBlock));
16859
+ var TypeLexicalDeclaration$4 = $S(Global, $E(DeclareBlock));
16687
16860
  function TypeLexicalDeclaration(state) {
16688
16861
  let eventData;
16689
16862
  if (state.events) {
@@ -16695,12 +16868,12 @@ ${input.slice(result.pos)}
16695
16868
  }
16696
16869
  }
16697
16870
  if (state.tokenize) {
16698
- const result = $TOKEN("TypeLexicalDeclaration", state, TypeLexicalDeclaration$0(state));
16871
+ const result = $TOKEN("TypeLexicalDeclaration", state, TypeLexicalDeclaration$0(state) || TypeLexicalDeclaration$1(state) || TypeLexicalDeclaration$2(state) || TypeLexicalDeclaration$3(state) || TypeLexicalDeclaration$4(state));
16699
16872
  if (state.events)
16700
16873
  state.events.exit?.("TypeLexicalDeclaration", state, result, eventData);
16701
16874
  return result;
16702
16875
  } else {
16703
- const result = TypeLexicalDeclaration$0(state);
16876
+ const result = TypeLexicalDeclaration$0(state) || TypeLexicalDeclaration$1(state) || TypeLexicalDeclaration$2(state) || TypeLexicalDeclaration$3(state) || TypeLexicalDeclaration$4(state);
16704
16877
  if (state.events)
16705
16878
  state.events.exit?.("TypeLexicalDeclaration", state, result, eventData);
16706
16879
  return result;
@@ -16775,7 +16948,9 @@ ${input.slice(result.pos)}
16775
16948
  return result;
16776
16949
  }
16777
16950
  }
16778
- var TypeKeyword$0 = $S($EXPECT($L171, fail, 'TypeKeyword "type"'), NonIdContinue);
16951
+ var TypeKeyword$0 = $TS($S($EXPECT($L171, fail, 'TypeKeyword "type"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
16952
+ return { $loc, token: $1 };
16953
+ });
16779
16954
  function TypeKeyword(state) {
16780
16955
  let eventData;
16781
16956
  if (state.events) {
@@ -16798,7 +16973,9 @@ ${input.slice(result.pos)}
16798
16973
  return result;
16799
16974
  }
16800
16975
  }
16801
- var Interface$0 = $S($EXPECT($L172, fail, 'Interface "interface"'), NonIdContinue);
16976
+ var Interface$0 = $TS($S($EXPECT($L172, fail, 'Interface "interface"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
16977
+ return { $loc, token: $1 };
16978
+ });
16802
16979
  function Interface(state) {
16803
16980
  let eventData;
16804
16981
  if (state.events) {
@@ -16821,7 +16998,59 @@ ${input.slice(result.pos)}
16821
16998
  return result;
16822
16999
  }
16823
17000
  }
16824
- var Namespace$0 = $S($EXPECT($L173, fail, 'Namespace "namespace"'), NonIdContinue);
17001
+ var Global$0 = $TS($S($EXPECT($L173, fail, 'Global "global"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17002
+ return { $loc, token: $1 };
17003
+ });
17004
+ function Global(state) {
17005
+ let eventData;
17006
+ if (state.events) {
17007
+ const result = state.events.enter?.("Global", state);
17008
+ if (result) {
17009
+ if (result.cache)
17010
+ return result.cache;
17011
+ eventData = result.data;
17012
+ }
17013
+ }
17014
+ if (state.tokenize) {
17015
+ const result = $TOKEN("Global", state, Global$0(state));
17016
+ if (state.events)
17017
+ state.events.exit?.("Global", state, result, eventData);
17018
+ return result;
17019
+ } else {
17020
+ const result = Global$0(state);
17021
+ if (state.events)
17022
+ state.events.exit?.("Global", state, result, eventData);
17023
+ return result;
17024
+ }
17025
+ }
17026
+ var Module$0 = $TS($S($EXPECT($L174, fail, 'Module "module"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17027
+ return { $loc, token: $1 };
17028
+ });
17029
+ function Module(state) {
17030
+ let eventData;
17031
+ if (state.events) {
17032
+ const result = state.events.enter?.("Module", state);
17033
+ if (result) {
17034
+ if (result.cache)
17035
+ return result.cache;
17036
+ eventData = result.data;
17037
+ }
17038
+ }
17039
+ if (state.tokenize) {
17040
+ const result = $TOKEN("Module", state, Module$0(state));
17041
+ if (state.events)
17042
+ state.events.exit?.("Module", state, result, eventData);
17043
+ return result;
17044
+ } else {
17045
+ const result = Module$0(state);
17046
+ if (state.events)
17047
+ state.events.exit?.("Module", state, result, eventData);
17048
+ return result;
17049
+ }
17050
+ }
17051
+ var Namespace$0 = $TS($S($EXPECT($L175, fail, 'Namespace "namespace"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17052
+ return { $loc, token: $1 };
17053
+ });
16825
17054
  function Namespace(state) {
16826
17055
  let eventData;
16827
17056
  if (state.events) {
@@ -16993,13 +17222,63 @@ ${input.slice(result.pos)}
16993
17222
  return result;
16994
17223
  }
16995
17224
  }
16996
- var NamespaceBlock$0 = $S(__, OpenBrace, NestedTypeDeclarations, __, CloseBrace);
16997
- var NamespaceBlock$1 = $S(__, OpenBrace, $Q($S(__, TypeDeclaration, InterfacePropertyDelimiter)), __, CloseBrace);
16998
- var NamespaceBlock$2 = $S(InsertOpenBrace, NestedTypeDeclarations, InsertNewline, InsertIndent, InsertCloseBrace);
16999
- function NamespaceBlock(state) {
17225
+ var ModuleBlock$0 = $S(__, OpenBrace, NestedModuleItems, __, CloseBrace);
17226
+ var ModuleBlock$1 = $S(InsertOpenBrace, NestedModuleItems, InsertNewline, InsertIndent, InsertCloseBrace);
17227
+ function ModuleBlock(state) {
17228
+ let eventData;
17229
+ if (state.events) {
17230
+ const result = state.events.enter?.("ModuleBlock", state);
17231
+ if (result) {
17232
+ if (result.cache)
17233
+ return result.cache;
17234
+ eventData = result.data;
17235
+ }
17236
+ }
17237
+ if (state.tokenize) {
17238
+ const result = $TOKEN("ModuleBlock", state, ModuleBlock$0(state) || ModuleBlock$1(state));
17239
+ if (state.events)
17240
+ state.events.exit?.("ModuleBlock", state, result, eventData);
17241
+ return result;
17242
+ } else {
17243
+ const result = ModuleBlock$0(state) || ModuleBlock$1(state);
17244
+ if (state.events)
17245
+ state.events.exit?.("ModuleBlock", state, result, eventData);
17246
+ return result;
17247
+ }
17248
+ }
17249
+ var NestedModuleItems$0 = $TS($S(PushIndent, $Q(NestedModuleItem), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
17250
+ var items = $2;
17251
+ if (items.length)
17252
+ return items;
17253
+ return $skip;
17254
+ });
17255
+ function NestedModuleItems(state) {
17256
+ let eventData;
17257
+ if (state.events) {
17258
+ const result = state.events.enter?.("NestedModuleItems", state);
17259
+ if (result) {
17260
+ if (result.cache)
17261
+ return result.cache;
17262
+ eventData = result.data;
17263
+ }
17264
+ }
17265
+ if (state.tokenize) {
17266
+ const result = $TOKEN("NestedModuleItems", state, NestedModuleItems$0(state));
17267
+ if (state.events)
17268
+ state.events.exit?.("NestedModuleItems", state, result, eventData);
17269
+ return result;
17270
+ } else {
17271
+ const result = NestedModuleItems$0(state);
17272
+ if (state.events)
17273
+ state.events.exit?.("NestedModuleItems", state, result, eventData);
17274
+ return result;
17275
+ }
17276
+ }
17277
+ var NestedModuleItem$0 = $S(Nested, ModuleItem, StatementDelimiter);
17278
+ function NestedModuleItem(state) {
17000
17279
  let eventData;
17001
17280
  if (state.events) {
17002
- const result = state.events.enter?.("NamespaceBlock", state);
17281
+ const result = state.events.enter?.("NestedModuleItem", state);
17003
17282
  if (result) {
17004
17283
  if (result.cache)
17005
17284
  return result.cache;
@@ -17007,27 +17286,52 @@ ${input.slice(result.pos)}
17007
17286
  }
17008
17287
  }
17009
17288
  if (state.tokenize) {
17010
- const result = $TOKEN("NamespaceBlock", state, NamespaceBlock$0(state) || NamespaceBlock$1(state) || NamespaceBlock$2(state));
17289
+ const result = $TOKEN("NestedModuleItem", state, NestedModuleItem$0(state));
17011
17290
  if (state.events)
17012
- state.events.exit?.("NamespaceBlock", state, result, eventData);
17291
+ state.events.exit?.("NestedModuleItem", state, result, eventData);
17013
17292
  return result;
17014
17293
  } else {
17015
- const result = NamespaceBlock$0(state) || NamespaceBlock$1(state) || NamespaceBlock$2(state);
17294
+ const result = NestedModuleItem$0(state);
17016
17295
  if (state.events)
17017
- state.events.exit?.("NamespaceBlock", state, result, eventData);
17296
+ state.events.exit?.("NestedModuleItem", state, result, eventData);
17018
17297
  return result;
17019
17298
  }
17020
17299
  }
17021
- var NestedTypeDeclarations$0 = $TS($S(PushIndent, $Q(NestedTypeDeclaration), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
17300
+ var DeclareBlock$0 = $S(__, OpenBrace, NestedDeclareElements, __, CloseBrace);
17301
+ var DeclareBlock$1 = $S(__, OpenBrace, $Q($S(__, DeclareElement, InterfacePropertyDelimiter)), __, CloseBrace);
17302
+ var DeclareBlock$2 = $S(InsertOpenBrace, NestedDeclareElements, InsertNewline, InsertIndent, InsertCloseBrace);
17303
+ function DeclareBlock(state) {
17304
+ let eventData;
17305
+ if (state.events) {
17306
+ const result = state.events.enter?.("DeclareBlock", state);
17307
+ if (result) {
17308
+ if (result.cache)
17309
+ return result.cache;
17310
+ eventData = result.data;
17311
+ }
17312
+ }
17313
+ if (state.tokenize) {
17314
+ const result = $TOKEN("DeclareBlock", state, DeclareBlock$0(state) || DeclareBlock$1(state) || DeclareBlock$2(state));
17315
+ if (state.events)
17316
+ state.events.exit?.("DeclareBlock", state, result, eventData);
17317
+ return result;
17318
+ } else {
17319
+ const result = DeclareBlock$0(state) || DeclareBlock$1(state) || DeclareBlock$2(state);
17320
+ if (state.events)
17321
+ state.events.exit?.("DeclareBlock", state, result, eventData);
17322
+ return result;
17323
+ }
17324
+ }
17325
+ var NestedDeclareElements$0 = $TS($S(PushIndent, $Q(NestedDeclareElement), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
17022
17326
  var decs = $2;
17023
17327
  if (decs.length)
17024
17328
  return decs;
17025
17329
  return $skip;
17026
17330
  });
17027
- function NestedTypeDeclarations(state) {
17331
+ function NestedDeclareElements(state) {
17028
17332
  let eventData;
17029
17333
  if (state.events) {
17030
- const result = state.events.enter?.("NestedTypeDeclarations", state);
17334
+ const result = state.events.enter?.("NestedDeclareElements", state);
17031
17335
  if (result) {
17032
17336
  if (result.cache)
17033
17337
  return result.cache;
@@ -17035,22 +17339,22 @@ ${input.slice(result.pos)}
17035
17339
  }
17036
17340
  }
17037
17341
  if (state.tokenize) {
17038
- const result = $TOKEN("NestedTypeDeclarations", state, NestedTypeDeclarations$0(state));
17342
+ const result = $TOKEN("NestedDeclareElements", state, NestedDeclareElements$0(state));
17039
17343
  if (state.events)
17040
- state.events.exit?.("NestedTypeDeclarations", state, result, eventData);
17344
+ state.events.exit?.("NestedDeclareElements", state, result, eventData);
17041
17345
  return result;
17042
17346
  } else {
17043
- const result = NestedTypeDeclarations$0(state);
17347
+ const result = NestedDeclareElements$0(state);
17044
17348
  if (state.events)
17045
- state.events.exit?.("NestedTypeDeclarations", state, result, eventData);
17349
+ state.events.exit?.("NestedDeclareElements", state, result, eventData);
17046
17350
  return result;
17047
17351
  }
17048
17352
  }
17049
- var NestedTypeDeclaration$0 = $S(Nested, TypeDeclaration, InterfacePropertyDelimiter);
17050
- function NestedTypeDeclaration(state) {
17353
+ var NestedDeclareElement$0 = $S(Nested, DeclareElement, InterfacePropertyDelimiter);
17354
+ function NestedDeclareElement(state) {
17051
17355
  let eventData;
17052
17356
  if (state.events) {
17053
- const result = state.events.enter?.("NestedTypeDeclaration", state);
17357
+ const result = state.events.enter?.("NestedDeclareElement", state);
17054
17358
  if (result) {
17055
17359
  if (result.cache)
17056
17360
  return result.cache;
@@ -17058,14 +17362,42 @@ ${input.slice(result.pos)}
17058
17362
  }
17059
17363
  }
17060
17364
  if (state.tokenize) {
17061
- const result = $TOKEN("NestedTypeDeclaration", state, NestedTypeDeclaration$0(state));
17365
+ const result = $TOKEN("NestedDeclareElement", state, NestedDeclareElement$0(state));
17062
17366
  if (state.events)
17063
- state.events.exit?.("NestedTypeDeclaration", state, result, eventData);
17367
+ state.events.exit?.("NestedDeclareElement", state, result, eventData);
17064
17368
  return result;
17065
17369
  } else {
17066
- const result = NestedTypeDeclaration$0(state);
17370
+ const result = NestedDeclareElement$0(state);
17067
17371
  if (state.events)
17068
- state.events.exit?.("NestedTypeDeclaration", state, result, eventData);
17372
+ state.events.exit?.("NestedDeclareElement", state, result, eventData);
17373
+ return result;
17374
+ }
17375
+ }
17376
+ var DeclareElement$0 = $T($S($E($S(Export, $E(_))), TypeLexicalDeclaration), function(value) {
17377
+ return { "ts": true, "children": value };
17378
+ });
17379
+ var DeclareElement$1 = $T($S($E($S(Export, $E(_))), TypeDeclarationRest), function(value) {
17380
+ return { "ts": true, "children": value };
17381
+ });
17382
+ function DeclareElement(state) {
17383
+ let eventData;
17384
+ if (state.events) {
17385
+ const result = state.events.enter?.("DeclareElement", state);
17386
+ if (result) {
17387
+ if (result.cache)
17388
+ return result.cache;
17389
+ eventData = result.data;
17390
+ }
17391
+ }
17392
+ if (state.tokenize) {
17393
+ const result = $TOKEN("DeclareElement", state, DeclareElement$0(state) || DeclareElement$1(state));
17394
+ if (state.events)
17395
+ state.events.exit?.("DeclareElement", state, result, eventData);
17396
+ return result;
17397
+ } else {
17398
+ const result = DeclareElement$0(state) || DeclareElement$1(state);
17399
+ if (state.events)
17400
+ state.events.exit?.("DeclareElement", state, result, eventData);
17069
17401
  return result;
17070
17402
  }
17071
17403
  }
@@ -17119,6 +17451,9 @@ ${input.slice(result.pos)}
17119
17451
  var TypeSuffix$0 = $T($S($E(QuestionMark), $E(_), Colon, Type), function(value) {
17120
17452
  return { "type": "TypeSuffix", "ts": true, "children": value };
17121
17453
  });
17454
+ var TypeSuffix$1 = $T($S(QuestionMark, $E(_)), function(value) {
17455
+ return { "type": "TypeSuffix", "ts": true, "children": value };
17456
+ });
17122
17457
  function TypeSuffix(state) {
17123
17458
  let eventData;
17124
17459
  if (state.events) {
@@ -17130,18 +17465,18 @@ ${input.slice(result.pos)}
17130
17465
  }
17131
17466
  }
17132
17467
  if (state.tokenize) {
17133
- const result = $TOKEN("TypeSuffix", state, TypeSuffix$0(state));
17468
+ const result = $TOKEN("TypeSuffix", state, TypeSuffix$0(state) || TypeSuffix$1(state));
17134
17469
  if (state.events)
17135
17470
  state.events.exit?.("TypeSuffix", state, result, eventData);
17136
17471
  return result;
17137
17472
  } else {
17138
- const result = TypeSuffix$0(state);
17473
+ const result = TypeSuffix$0(state) || TypeSuffix$1(state);
17139
17474
  if (state.events)
17140
17475
  state.events.exit?.("TypeSuffix", state, result, eventData);
17141
17476
  return result;
17142
17477
  }
17143
17478
  }
17144
- var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($L174, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
17479
+ var ReturnTypeSuffix$0 = $TS($S($E(_), Colon, $E($S(__, $EXPECT($L176, fail, 'ReturnTypeSuffix "asserts"'), NonIdContinue)), TypePredicate), function($skip, $loc, $0, $1, $2, $3, $4) {
17145
17480
  var asserts = $3;
17146
17481
  var t = $4;
17147
17482
  if (asserts) {
@@ -17315,9 +17650,9 @@ ${input.slice(result.pos)}
17315
17650
  return result;
17316
17651
  }
17317
17652
  }
17318
- var TypeUnaryOp$0 = $S($EXPECT($L175, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
17653
+ var TypeUnaryOp$0 = $S($EXPECT($L177, fail, 'TypeUnaryOp "keyof"'), NonIdContinue);
17319
17654
  var TypeUnaryOp$1 = $S($EXPECT($L157, fail, 'TypeUnaryOp "typeof"'), NonIdContinue);
17320
- var TypeUnaryOp$2 = $S($EXPECT($L176, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
17655
+ var TypeUnaryOp$2 = $S($EXPECT($L178, fail, 'TypeUnaryOp "infer"'), NonIdContinue);
17321
17656
  var TypeUnaryOp$3 = $S($EXPECT($L141, fail, 'TypeUnaryOp "readonly"'), NonIdContinue);
17322
17657
  function TypeUnaryOp(state) {
17323
17658
  let eventData;
@@ -17563,7 +17898,7 @@ ${input.slice(result.pos)}
17563
17898
  var TypeLiteral$2 = $TS($S($EXPECT($L161, fail, 'TypeLiteral "void"'), NonIdContinue), function($skip, $loc, $0, $1, $2) {
17564
17899
  return { type: "VoidType", $loc, token: $1 };
17565
17900
  });
17566
- var TypeLiteral$3 = $TV($EXPECT($L177, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
17901
+ var TypeLiteral$3 = $TV($EXPECT($L179, fail, 'TypeLiteral "[]"'), function($skip, $loc, $0, $1) {
17567
17902
  return { $loc, token: "[]" };
17568
17903
  });
17569
17904
  function TypeLiteral(state) {
@@ -18023,7 +18358,7 @@ ${input.slice(result.pos)}
18023
18358
  return result;
18024
18359
  }
18025
18360
  }
18026
- var CivetPrologueContent$0 = $TS($S($EXPECT($L178, fail, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R61, fail, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
18361
+ 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) {
18027
18362
  var options = $3;
18028
18363
  return {
18029
18364
  type: "CivetPrologue",
@@ -19616,6 +19951,9 @@ ${input.slice(result.pos)}
19616
19951
  else
19617
19952
  exp.children.push([" else {\n", indent, ref, ".push(undefined)\n", indent, "}"]);
19618
19953
  return;
19954
+ case "PatternMatchingStatement":
19955
+ insertPush(exp.children[0][0], ref);
19956
+ return;
19619
19957
  case "SwitchStatement":
19620
19958
  insertPush(exp.children[2], ref);
19621
19959
  return;
@@ -19703,6 +20041,9 @@ ${input.slice(result.pos)}
19703
20041
  else
19704
20042
  exp.children.push(["\n", indent, wrapWithReturn()]);
19705
20043
  return;
20044
+ case "PatternMatchingStatement":
20045
+ insertReturn(exp.children[0][0]);
20046
+ return;
19706
20047
  case "SwitchStatement":
19707
20048
  insertSwitchReturns(exp);
19708
20049
  return;
@@ -20630,7 +20971,7 @@ ${input.slice(result.pos)}
20630
20971
  }
20631
20972
  }
20632
20973
  function processPatternMatching(statements) {
20633
- gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement").forEach((s) => {
20974
+ gatherRecursiveAll(statements, (n) => n.type === "SwitchStatement" || n.type === "SwitchExpression").forEach((s) => {
20634
20975
  const { caseBlock } = s;
20635
20976
  const { clauses } = caseBlock;
20636
20977
  let errors = false;
@@ -20709,15 +21050,21 @@ ${input.slice(result.pos)}
20709
21050
  block.children.push("}");
20710
21051
  block.bare = false;
20711
21052
  }
20712
- const e = i < l - 1 ? ["\nelse "] : [];
20713
- prev.push({
21053
+ if (i < l - 1)
21054
+ next.push("\n", "else ");
21055
+ prev.push(["", {
20714
21056
  type: "IfStatement",
20715
- children: ["if", condition, block, ...e, next],
21057
+ children: ["if", condition, block, next],
20716
21058
  then: block,
20717
- else: e
20718
- });
21059
+ else: next
21060
+ }]);
20719
21061
  prev = next;
20720
21062
  });
21063
+ if (module.config.implicitReturns && s.type === "SwitchExpression") {
21064
+ insertReturn(root[0]);
21065
+ root.unshift("(()=>{");
21066
+ root.push("})()");
21067
+ }
20721
21068
  s.type = "PatternMatchingStatement";
20722
21069
  s.children = [root];
20723
21070
  });
@@ -20770,10 +21117,10 @@ ${input.slice(result.pos)}
20770
21117
  addParentPointers(statements);
20771
21118
  processPipelineExpressions(statements);
20772
21119
  processAssignments(statements);
21120
+ processPatternMatching(statements);
20773
21121
  processFunctions(statements);
20774
21122
  processSwitchExpressions(statements);
20775
21123
  processTryExpressions(statements);
20776
- processPatternMatching(statements);
20777
21124
  gatherRecursiveAll(statements, (n) => n.type === "IterationExpression").forEach((e) => expressionizeIteration(e));
20778
21125
  checkSpliceRef(statements);
20779
21126
  statements.unshift(...module.prelude);
@@ -20972,6 +21319,15 @@ ${input.slice(result.pos)}
20972
21319
  module.gatherBindingCode = gatherBindingCode;
20973
21320
  module.constructInvocation = function(fn, arg) {
20974
21321
  const fnArr = [fn.leadingComment, fn.expr, fn.trailingComment];
21322
+ if (fn.expr.ampersandBlock) {
21323
+ const [ref, , prefix, rhs] = fn.expr.children;
21324
+ ref.type = "PipedExpression";
21325
+ ref.children = [module.makeLeftHandSideExpression(arg)];
21326
+ return {
21327
+ type: "UnwrappedExpression",
21328
+ children: [module.skipIfOnlyWS(fn.leadingComment), prefix, rhs, module.skipIfOnlyWS(fn.trailingComment)]
21329
+ };
21330
+ }
20975
21331
  const lhs = module.makeLeftHandSideExpression(fn.expr);
20976
21332
  let comment = module.skipIfOnlyWS(fn.trailingComment);
20977
21333
  if (comment)
@@ -20981,10 +21337,7 @@ ${input.slice(result.pos)}
20981
21337
  lhs.children.splice(1, 0, comment);
20982
21338
  switch (arg.type) {
20983
21339
  case "CommaExpression":
20984
- arg = {
20985
- type: "ParenthesizedExpression",
20986
- children: ["(", arg, ")"]
20987
- };
21340
+ arg = module.makeLeftHandSideExpression(arg);
20988
21341
  break;
20989
21342
  }
20990
21343
  return {
@@ -21704,7 +22057,7 @@ ${input.slice(result.pos)}
21704
22057
  var uncacheable;
21705
22058
  ({ parse } = import_parser.default);
21706
22059
  ({ SourceMap: SourceMap2, base64Encode: base64Encode2 } = util_exports);
21707
- uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
22060
+ uncacheable = /* @__PURE__ */ new Set(["ActualAssignment", "AllowAll", "AllowIndentedApplication", "AllowTrailingMemberProperty", "AllowedTrailingMemberExpressions", "ApplicationStart", "Arguments", "ArgumentsWithTrailingMemberExpressions", "ArrowFunction", "ArrowFunctionTail", "AssignmentExpression", "AssignmentExpressionTail", "BinaryOpExpression", "BinaryOpRHS", "BracedBlock", "BracedObjectLiteralContent", "BracedOrEmptyBlock", "CallExpression", "CallExpressionRest", "CoffeeCommentEnabled", "CommaDelimiter", "ConditionalExpression", "Declaration", "Debugger", "ElseClause", "Expression", "ExpressionStatement", "ExpressionWithIndentedApplicationForbidden", "ExtendedExpression", "FatArrowBody", "ForbidIndentedApplication", "ForbidTrailingMemberProperty", "FunctionDeclaration", "FunctionExpression", "HoistableDeclaration", "ImplicitArguments", "ImplicitInlineObjectPropertyDelimiter", "ImplicitNestedBlock", "IndentedApplicationAllowed", "IndentedFurther", "IndentedJSXChildExpression", "InlineObjectLiteral", "InsertIndent", "JSXChild", "JSXChildren", "JSXElement", "JSXFragment", "JSXImplicitFragment", "JSXMixedChildren", "JSXNested", "JSXNestedChildren", "JSXOptionalClosingElement", "JSXOptionalClosingFragment", "JSXTag", "LeftHandSideExpression", "MemberExpression", "MemberExpressionRest", "Nested", "NestedBindingElement", "NestedBindingElements", "NestedBlockExpression", "NestedBlockExpression", "NestedBlockStatement", "NestedBlockStatements", "NestedClassSignatureElement", "NestedClassSignatureElements", "NestedDeclareElement", "NestedDeclareElements", "NestedElement", "NestedElementList", "NestedImplicitObjectLiteral", "NestedImplicitPropertyDefinition", "NestedImplicitPropertyDefinitions", "NestedInterfaceProperty", "NestedJSXChildExpression", "NestedModuleItem", "NestedModuleItems", "NestedObject", "NestedPropertyDefinitions", "NonSingleBracedBlock", "ObjectLiteral", "PopIndent", "PopJSXStack", "PostfixedExpression", "PostfixedStatement", "PrimaryExpression", "PushIndent", "PushJSXOpeningElement", "PushJSXOpeningFragment", "RestoreAll", "RestoreIndentedApplication", "RestoreTrailingMemberProperty", "RHS", "Samedent", "ShortCircuitExpression", "SingleLineAssignmentExpression", "SingleLineComment", "SingleLineStatements", "SnugNamedProperty", "Statement", "StatementListItem", "SuffixedExpression", "SuffixedStatement", "ThinArrowFunction", "TrackIndented", "TrailingMemberExpressions", "TrailingMemberPropertyAllowed", "TypedJSXElement", "TypedJSXFragment", "UnaryExpression", "UpdateExpression"]);
21708
22061
  var compile = function(src, options) {
21709
22062
  var ast, code, events, filename, ref, result, sm, srcMapJSON;
21710
22063
  if (!options) {