@danielx/civet 0.2.2 → 0.2.5

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
@@ -596,6 +596,10 @@ var Civet = (() => {
596
596
  InterfaceBlock,
597
597
  NestedInterfaceProperties,
598
598
  NestedInterfaceProperty,
599
+ InterfaceProperty,
600
+ InterfacePropertyDelimiter,
601
+ TypeIndexSignature,
602
+ TypeIndex,
599
603
  TypeSuffix,
600
604
  ReturnTypeSuffix,
601
605
  TypePredicate,
@@ -762,12 +766,13 @@ var Civet = (() => {
762
766
  var $L124 = $L("</");
763
767
  var $L125 = $L("<>");
764
768
  var $L126 = $L("</>");
765
- var $L127 = $L("asserts");
766
- var $L128 = $L("keyof");
767
- var $L129 = $L("infer");
768
- var $L130 = $L("[]");
769
- var $L131 = $L(" ");
770
- var $L132 = $L(" ");
769
+ var $L127 = $L("readonly");
770
+ var $L128 = $L("asserts");
771
+ var $L129 = $L("keyof");
772
+ var $L130 = $L("infer");
773
+ var $L131 = $L("[]");
774
+ var $L132 = $L(" ");
775
+ var $L133 = $L(" ");
771
776
  var $R0 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
772
777
  var $R1 = $R(new RegExp("(of)(?!\\p{ID_Continue})", "suy"));
773
778
  var $R2 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
@@ -798,10 +803,12 @@ var Civet = (() => {
798
803
  var $R27 = $R(new RegExp("[^{}<>]+", "suy"));
799
804
  var $R28 = $R(new RegExp("type(?!\\p{ID_Continue})", "suy"));
800
805
  var $R29 = $R(new RegExp("interface(?!\\p{ID_Continue})", "suy"));
801
- var $R30 = $R(new RegExp("#![^\\r\\n]*", "suy"));
802
- var $R31 = $R(new RegExp("[\\t ]*", "suy"));
803
- var $R32 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
804
- var $R33 = $R(new RegExp("$", "suy"));
806
+ var $R30 = $R(new RegExp("[+-]?", "suy"));
807
+ var $R31 = $R(new RegExp("[+-]", "suy"));
808
+ var $R32 = $R(new RegExp("#![^\\r\\n]*", "suy"));
809
+ var $R33 = $R(new RegExp("[\\t ]*", "suy"));
810
+ var $R34 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
811
+ var $R35 = $R(new RegExp("$", "suy"));
805
812
  var Program$0 = $S(Init, __, $Q(TopLevelStatement), __);
806
813
  function Program(state) {
807
814
  if (state.verbose)
@@ -963,7 +970,7 @@ var Civet = (() => {
963
970
  }
964
971
  }
965
972
  var ArrowFunction$0 = ThinArrowFunction;
966
- var ArrowFunction$1 = $S($C(BindingIdentifier, Parameters), __, $EXPECT($L10, fail, 'ArrowFunction "=>"'), ConciseBody);
973
+ var ArrowFunction$1 = $S($C(BindingIdentifier, Parameters), $E(ReturnTypeSuffix), __, $EXPECT($L10, fail, 'ArrowFunction "=>"'), ConciseBody);
967
974
  function ArrowFunction(state) {
968
975
  if (state.tokenize) {
969
976
  return $TOKEN("ArrowFunction", state, ArrowFunction$0(state) || ArrowFunction$1(state));
@@ -1563,7 +1570,7 @@ var Civet = (() => {
1563
1570
  return ElementList$0(state);
1564
1571
  }
1565
1572
  }
1566
- var ArrayElementExpression$0 = $E($S($E($S($EXPECT($L31, fail, 'ArrayElementExpression "..."'), __)), AssignmentExpression));
1573
+ var ArrayElementExpression$0 = $E($S($E($S($EXPECT($L31, fail, 'ArrayElementExpression "..."'), __)), Expression));
1567
1574
  function ArrayElementExpression(state) {
1568
1575
  if (state.verbose)
1569
1576
  console.log("ENTER:", "ArrayElementExpression");
@@ -2862,12 +2869,13 @@ var Civet = (() => {
2862
2869
  }
2863
2870
  }
2864
2871
  var InterfaceBlock$0 = $S(__, $EXPECT($L11, fail, 'InterfaceBlock "{"'), EOS, NestedInterfaceProperties, __, $EXPECT($L16, fail, 'InterfaceBlock "}"'));
2865
- var InterfaceBlock$1 = $S(InsertOpenBrace, EOS, NestedInterfaceProperties, InsertNewline, InsertIndent, InsertCloseBrace);
2872
+ var InterfaceBlock$1 = $S(__, $EXPECT($L11, fail, 'InterfaceBlock "{"'), $Q($S(__, InterfaceProperty)), __, $EXPECT($L16, fail, 'InterfaceBlock "}"'));
2873
+ var InterfaceBlock$2 = $S(InsertOpenBrace, EOS, NestedInterfaceProperties, InsertNewline, InsertIndent, InsertCloseBrace);
2866
2874
  function InterfaceBlock(state) {
2867
2875
  if (state.tokenize) {
2868
- return $TOKEN("InterfaceBlock", state, InterfaceBlock$0(state) || InterfaceBlock$1(state));
2876
+ return $TOKEN("InterfaceBlock", state, InterfaceBlock$0(state) || InterfaceBlock$1(state) || InterfaceBlock$2(state));
2869
2877
  } else {
2870
- return InterfaceBlock$0(state) || InterfaceBlock$1(state);
2878
+ return InterfaceBlock$0(state) || InterfaceBlock$1(state) || InterfaceBlock$2(state);
2871
2879
  }
2872
2880
  }
2873
2881
  var NestedInterfaceProperties$0 = $TS($S(PushIndent, $Q(NestedInterfaceProperty), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
@@ -2885,7 +2893,7 @@ var Civet = (() => {
2885
2893
  return NestedInterfaceProperties$0(state);
2886
2894
  }
2887
2895
  }
2888
- var NestedInterfaceProperty$0 = $S(Nested, PropertyName, TypeSuffix, StatementDelimiter);
2896
+ var NestedInterfaceProperty$0 = $S(Nested, InterfaceProperty);
2889
2897
  function NestedInterfaceProperty(state) {
2890
2898
  if (state.verbose)
2891
2899
  console.log("ENTER:", "NestedInterfaceProperty");
@@ -2895,6 +2903,50 @@ var Civet = (() => {
2895
2903
  return NestedInterfaceProperty$0(state);
2896
2904
  }
2897
2905
  }
2906
+ var InterfaceProperty$0 = $S($C(TypeIndexSignature, PropertyName), TypeSuffix, InterfacePropertyDelimiter);
2907
+ function InterfaceProperty(state) {
2908
+ if (state.verbose)
2909
+ console.log("ENTER:", "InterfaceProperty");
2910
+ if (state.tokenize) {
2911
+ return $TOKEN("InterfaceProperty", state, InterfaceProperty$0(state));
2912
+ } else {
2913
+ return InterfaceProperty$0(state);
2914
+ }
2915
+ }
2916
+ var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($L85, fail, 'InterfacePropertyDelimiter ";"'));
2917
+ var InterfacePropertyDelimiter$1 = $Y($S($Q(_), $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"')));
2918
+ var InterfacePropertyDelimiter$2 = $T($Y($S(__, $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"'))), function(value) {
2919
+ return ";";
2920
+ });
2921
+ var InterfacePropertyDelimiter$3 = $T($Y(EOS), function(value) {
2922
+ return ";";
2923
+ });
2924
+ function InterfacePropertyDelimiter(state) {
2925
+ if (state.tokenize) {
2926
+ return $TOKEN("InterfacePropertyDelimiter", state, InterfacePropertyDelimiter$0(state) || InterfacePropertyDelimiter$1(state) || InterfacePropertyDelimiter$2(state) || InterfacePropertyDelimiter$3(state));
2927
+ } else {
2928
+ return InterfacePropertyDelimiter$0(state) || InterfacePropertyDelimiter$1(state) || InterfacePropertyDelimiter$2(state) || InterfacePropertyDelimiter$3(state);
2929
+ }
2930
+ }
2931
+ var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R30, fail, "TypeIndexSignature /[+-]?/")), $EXPECT($L127, fail, 'TypeIndexSignature "readonly"'), __)), $EXPECT($L24, fail, 'TypeIndexSignature "["'), TypeIndex, $EXPECT($L25, fail, 'TypeIndexSignature "]"'), $E($S(__, $R$0($EXPECT($R31, fail, "TypeIndexSignature /[+-]/")), $EXPECT($L3, fail, 'TypeIndexSignature "?"'))));
2932
+ function TypeIndexSignature(state) {
2933
+ if (state.verbose)
2934
+ console.log("ENTER:", "TypeIndexSignature");
2935
+ if (state.tokenize) {
2936
+ return $TOKEN("TypeIndexSignature", state, TypeIndexSignature$0(state));
2937
+ } else {
2938
+ return TypeIndexSignature$0(state);
2939
+ }
2940
+ }
2941
+ var TypeIndex$0 = $S(__, Identifier, TypeSuffix);
2942
+ var TypeIndex$1 = $S(__, PropertyName, __, $EXPECT($L78, fail, 'TypeIndex "in"'), Type, $E($S(__, $EXPECT($L4, fail, 'TypeIndex "as"'), Type)));
2943
+ function TypeIndex(state) {
2944
+ if (state.tokenize) {
2945
+ return $TOKEN("TypeIndex", state, TypeIndex$0(state) || TypeIndex$1(state));
2946
+ } else {
2947
+ return TypeIndex$0(state) || TypeIndex$1(state);
2948
+ }
2949
+ }
2898
2950
  var TypeSuffix$0 = $T($S($E($EXPECT($L3, fail, 'TypeSuffix "?"')), __, $EXPECT($L12, fail, 'TypeSuffix ":"'), Type), function(value) {
2899
2951
  return { "ts": true, "children": value };
2900
2952
  });
@@ -2907,7 +2959,7 @@ var Civet = (() => {
2907
2959
  return TypeSuffix$0(state);
2908
2960
  }
2909
2961
  }
2910
- var ReturnTypeSuffix$0 = $T($S(__, $EXPECT($L12, fail, 'ReturnTypeSuffix ":"'), $E($S(__, $EXPECT($L127, fail, 'ReturnTypeSuffix "asserts"'), $EXPECT($R0, fail, "ReturnTypeSuffix /(?!\\p{ID_Continue})/"))), TypePredicate), function(value) {
2962
+ var ReturnTypeSuffix$0 = $T($S(__, $EXPECT($L12, fail, 'ReturnTypeSuffix ":"'), $E($S(__, $EXPECT($L128, fail, 'ReturnTypeSuffix "asserts"'), $EXPECT($R0, fail, "ReturnTypeSuffix /(?!\\p{ID_Continue})/"))), TypePredicate), function(value) {
2911
2963
  return { "ts": true, "children": value };
2912
2964
  });
2913
2965
  function ReturnTypeSuffix(state) {
@@ -2969,9 +3021,9 @@ var Civet = (() => {
2969
3021
  return TypeUnarySuffix$0(state);
2970
3022
  }
2971
3023
  }
2972
- var TypeUnaryOp$0 = $EXPECT($L128, fail, 'TypeUnaryOp "keyof"');
3024
+ var TypeUnaryOp$0 = $EXPECT($L129, fail, 'TypeUnaryOp "keyof"');
2973
3025
  var TypeUnaryOp$1 = $EXPECT($L84, fail, 'TypeUnaryOp "typeof"');
2974
- var TypeUnaryOp$2 = $EXPECT($L129, fail, 'TypeUnaryOp "infer"');
3026
+ var TypeUnaryOp$2 = $EXPECT($L130, fail, 'TypeUnaryOp "infer"');
2975
3027
  function TypeUnaryOp(state) {
2976
3028
  if (state.tokenize) {
2977
3029
  return $TOKEN("TypeUnaryOp", state, TypeUnaryOp$0(state) || TypeUnaryOp$1(state) || TypeUnaryOp$2(state));
@@ -3001,7 +3053,7 @@ var Civet = (() => {
3001
3053
  return TypePrimary$0(state) || TypePrimary$1(state) || TypePrimary$2(state) || TypePrimary$3(state) || TypePrimary$4(state);
3002
3054
  }
3003
3055
  }
3004
- var TypeConditional$0 = $S(TypeBinary, $E($S(__, $EXPECT($L15, fail, 'TypeConditional "extends"'), Type, __, $EXPECT($L3, fail, 'TypeConditional "?"'), Type, __, $EXPECT($L12, fail, 'TypeConditional ":"'), Type)));
3056
+ var TypeConditional$0 = $S(TypeBinary, $E($S(__, $EXPECT($L15, fail, 'TypeConditional "extends"'), Type, $E($S(__, $EXPECT($L3, fail, 'TypeConditional "?"'), Type, __, $EXPECT($L12, fail, 'TypeConditional ":"'), Type)))));
3005
3057
  function TypeConditional(state) {
3006
3058
  if (state.verbose)
3007
3059
  console.log("ENTER:", "TypeConditional");
@@ -3013,7 +3065,7 @@ var Civet = (() => {
3013
3065
  }
3014
3066
  var TypeLiteral$0 = Literal;
3015
3067
  var TypeLiteral$1 = $EXPECT($L83, fail, 'TypeLiteral "void"');
3016
- var TypeLiteral$2 = $EXPECT($L130, fail, 'TypeLiteral "[]"');
3068
+ var TypeLiteral$2 = $EXPECT($L131, fail, 'TypeLiteral "[]"');
3017
3069
  function TypeLiteral(state) {
3018
3070
  if (state.tokenize) {
3019
3071
  return $TOKEN("TypeLiteral", state, TypeLiteral$0(state) || TypeLiteral$1(state) || TypeLiteral$2(state));
@@ -3095,7 +3147,7 @@ var Civet = (() => {
3095
3147
  return TypeParameterDelimiter$0(state) || TypeParameterDelimiter$1(state) || TypeParameterDelimiter$2(state) || TypeParameterDelimiter$3(state);
3096
3148
  }
3097
3149
  }
3098
- var Shebang$0 = $R$0($EXPECT($R30, fail, "Shebang /#![^\\r\\n]*/"));
3150
+ var Shebang$0 = $R$0($EXPECT($R32, fail, "Shebang /#![^\\r\\n]*/"));
3099
3151
  function Shebang(state) {
3100
3152
  if (state.verbose)
3101
3153
  console.log("ENTER:", "Shebang");
@@ -3105,7 +3157,7 @@ var Civet = (() => {
3105
3157
  return Shebang$0(state);
3106
3158
  }
3107
3159
  }
3108
- var DirectivePrologue$0 = $TV($Q($S($TEXT($EXPECT($R31, fail, "DirectivePrologue /[\\t ]*/")), $TEXT(StringLiteral), $TEXT(StatementDelimiter), $TEXT(EOS))), function($skip, $loc, $0, $1) {
3160
+ var DirectivePrologue$0 = $TV($Q($S($TEXT($EXPECT($R33, fail, "DirectivePrologue /[\\t ]*/")), $TEXT(StringLiteral), $TEXT(StatementDelimiter), $TEXT(EOS))), function($skip, $loc, $0, $1) {
3109
3161
  return $0.map((p) => p.join(""));
3110
3162
  });
3111
3163
  function DirectivePrologue(state) {
@@ -3127,7 +3179,7 @@ var Civet = (() => {
3127
3179
  return EOS$0(state);
3128
3180
  }
3129
3181
  }
3130
- var EOL$0 = $R$0($EXPECT($R32, fail, "EOL /\\r\\n|\\n|\\r|$/"));
3182
+ var EOL$0 = $R$0($EXPECT($R34, fail, "EOL /\\r\\n|\\n|\\r|$/"));
3131
3183
  function EOL(state) {
3132
3184
  if (state.verbose)
3133
3185
  console.log("ENTER:", "EOL");
@@ -3137,7 +3189,7 @@ var Civet = (() => {
3137
3189
  return EOL$0(state);
3138
3190
  }
3139
3191
  }
3140
- var EOF$0 = $R$0($EXPECT($R33, fail, "EOF /$/"));
3192
+ var EOF$0 = $R$0($EXPECT($R35, fail, "EOF /$/"));
3141
3193
  function EOF(state) {
3142
3194
  if (state.verbose)
3143
3195
  console.log("ENTER:", "EOF");
@@ -3275,7 +3327,7 @@ var Civet = (() => {
3275
3327
  return Init$0(state);
3276
3328
  }
3277
3329
  }
3278
- var Indent$0 = $TV($Q($C($EXPECT($L131, fail, 'Indent " "'), $EXPECT($L132, fail, 'Indent "\\\\t"'))), function($skip, $loc, $0, $1) {
3330
+ var Indent$0 = $TV($Q($C($EXPECT($L132, fail, 'Indent " "'), $EXPECT($L133, fail, 'Indent "\\\\t"'))), function($skip, $loc, $0, $1) {
3279
3331
  return $1.length;
3280
3332
  });
3281
3333
  function Indent(state) {