@danielx/civet 0.3.5 → 0.3.7

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/README.md CHANGED
@@ -135,6 +135,20 @@ Things Added that CoffeeScript didn't
135
135
  ---
136
136
 
137
137
  - TypeScript Types
138
+ - Function annotations
139
+ - `namespace`
140
+ - `interface`
141
+ - TypeParameters
142
+ - `:=` readonly class field initializer
143
+ ```typescript
144
+ class A
145
+ x := 3
146
+ ```
147
+ ```typescript
148
+ class A {
149
+ readonly x = 3;
150
+ };
151
+ ```
138
152
  - JS Compatability
139
153
  - `var`, `let`, `const`
140
154
  - JS Comment Syntax `//` and `/* */`
package/dist/browser.js CHANGED
@@ -839,7 +839,7 @@ var Civet = (() => {
839
839
  var $R15 = $R(new RegExp("(?:\\\\.|[^\\/\\r\\n])+", "suy"));
840
840
  var $R16 = $R(new RegExp("(?:\\p{ID_Continue}|[\\u200C\\u200D$])*", "suy"));
841
841
  var $R17 = $R(new RegExp("(?:\\$(?!\\{)|\\\\.|[^$`])+", "suy"));
842
- var $R18 = $R(new RegExp("(?:and|as|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|import|in|instanceof|interface|is|new|null|or|return|super|switch|this|throw|true|try|typeof|unless|var|void|while|with|yield)(?!\\p{ID_Continue})", "suy"));
842
+ var $R18 = $R(new RegExp("(?:and|as|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|import|in|instanceof|interface|is|new|null|or|return|static|super|switch|this|throw|true|try|typeof|unless|var|void|while|with|yield)(?!\\p{ID_Continue})", "suy"));
843
843
  var $R19 = $R(new RegExp("\\/\\/[^\\r\\n]*", "suy"));
844
844
  var $R20 = $R(new RegExp(".", "suy"));
845
845
  var $R21 = $R(new RegExp("#([^\\r\\n]*)", "suy"));
@@ -1214,8 +1214,8 @@ var Civet = (() => {
1214
1214
  return NestedClassElement$0(state);
1215
1215
  }
1216
1216
  }
1217
- var ClassElement$0 = $S(Static, BracedBlock);
1218
- var ClassElement$1 = $S($E($S(Static, __)), $C(MethodDefinition, FieldDefinition));
1217
+ var ClassElement$0 = $S($E($S(Static, $Q(TrailingComment))), $C(MethodDefinition, FieldDefinition));
1218
+ var ClassElement$1 = $S(Static, BracedBlock);
1219
1219
  function ClassElement(state) {
1220
1220
  if (state.tokenize) {
1221
1221
  return $TOKEN("ClassElement", state, ClassElement$0(state) || ClassElement$1(state));
@@ -1224,7 +1224,7 @@ var Civet = (() => {
1224
1224
  }
1225
1225
  }
1226
1226
  var Static$0 = $TV($EXPECT($L18, fail, 'Static "static"'), function($skip, $loc, $0, $1) {
1227
- return { $loc, token: $0 };
1227
+ return { $loc, token: $1 };
1228
1228
  });
1229
1229
  function Static(state) {
1230
1230
  if (state.verbose)
@@ -1235,14 +1235,27 @@ var Civet = (() => {
1235
1235
  return Static$0(state);
1236
1236
  }
1237
1237
  }
1238
- var FieldDefinition$0 = $S(ClassElementName, $E(TypeSuffix), $E(Initializer));
1238
+ var FieldDefinition$0 = $TS($S(ClassElementName, $E(TypeSuffix), __, ConstAssignment, AssignmentExpression), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
1239
+ var name = $1;
1240
+ var suffix = $2;
1241
+ var ws = $3;
1242
+ var ca = $4;
1243
+ var exp = $5;
1244
+ return [
1245
+ { ts: true, token: "readonly ", $loc: ca.$loc },
1246
+ name,
1247
+ suffix,
1248
+ ws,
1249
+ { token: "=", $loc: ca.$loc },
1250
+ exp
1251
+ ];
1252
+ });
1253
+ var FieldDefinition$1 = $S(ClassElementName, $E(TypeSuffix), $E(Initializer));
1239
1254
  function FieldDefinition(state) {
1240
- if (state.verbose)
1241
- console.log("ENTER:", "FieldDefinition");
1242
1255
  if (state.tokenize) {
1243
- return $TOKEN("FieldDefinition", state, FieldDefinition$0(state));
1256
+ return $TOKEN("FieldDefinition", state, FieldDefinition$0(state) || FieldDefinition$1(state));
1244
1257
  } else {
1245
- return FieldDefinition$0(state);
1258
+ return FieldDefinition$0(state) || FieldDefinition$1(state);
1246
1259
  }
1247
1260
  }
1248
1261
  var This$0 = $TV($EXPECT($L19, fail, 'This "this"'), function($skip, $loc, $0, $1) {
@@ -1409,7 +1422,7 @@ var Civet = (() => {
1409
1422
  return MetaProperty$0(state) || MetaProperty$1(state);
1410
1423
  }
1411
1424
  }
1412
- var Parameters$0 = $S($EXPECT($L1, fail, 'Parameters "("'), $Q(ParameterElement), __, $EXPECT($L2, fail, 'Parameters ")"'));
1425
+ var Parameters$0 = $S($E(TypeParameters), $EXPECT($L1, fail, 'Parameters "("'), $Q(ParameterElement), __, $EXPECT($L2, fail, 'Parameters ")"'));
1413
1426
  var Parameters$1 = $T($EXPECT($L32, fail, 'Parameters ""'), function(value) {
1414
1427
  return "()";
1415
1428
  });
@@ -3034,7 +3047,7 @@ var Civet = (() => {
3034
3047
  return TemplateCharacters$0(state);
3035
3048
  }
3036
3049
  }
3037
- var ReservedWord$0 = $R$0($EXPECT($R18, fail, "ReservedWord /(?:and|as|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|import|in|instanceof|interface|is|new|null|or|return|super|switch|this|throw|true|try|typeof|unless|var|void|while|with|yield)(?!\\p{ID_Continue})/"));
3050
+ var ReservedWord$0 = $R$0($EXPECT($R18, fail, "ReservedWord /(?:and|as|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|import|in|instanceof|interface|is|new|null|or|return|static|super|switch|this|throw|true|try|typeof|unless|var|void|while|with|yield)(?!\\p{ID_Continue})/"));
3038
3051
  function ReservedWord(state) {
3039
3052
  if (state.verbose)
3040
3053
  console.log("ENTER:", "ReservedWord");
@@ -3673,7 +3686,9 @@ var Civet = (() => {
3673
3686
  return TypeArguments$0(state);
3674
3687
  }
3675
3688
  }
3676
- var TypeParameters$0 = $S(__, $EXPECT($L16, fail, 'TypeParameters "<"'), __, Type, $Q($S(__, $EXPECT($L0, fail, 'TypeParameters ","'), __, Type)), $E($S(__, $EXPECT($L0, fail, 'TypeParameters ","'))), __, $EXPECT($L67, fail, 'TypeParameters ">"'));
3689
+ var TypeParameters$0 = $TS($S(__, $EXPECT($L16, fail, 'TypeParameters "<"'), __, Type, $Q($S(__, $EXPECT($L0, fail, 'TypeParameters ","'), __, Type)), $E($S(__, $EXPECT($L0, fail, 'TypeParameters ","'))), __, $EXPECT($L67, fail, 'TypeParameters ">"')), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
3690
+ return { ts: true, children: $0 };
3691
+ });
3677
3692
  function TypeParameters(state) {
3678
3693
  if (state.verbose)
3679
3694
  console.log("ENTER:", "TypeParameters");