@danielx/civet 0.3.6 → 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,10 +135,20 @@ Things Added that CoffeeScript didn't
135
135
  ---
136
136
 
137
137
  - TypeScript Types
138
- - Function annotaions
138
+ - Function annotations
139
139
  - `namespace`
140
140
  - `interface`
141
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
+ ```
142
152
  - JS Compatability
143
153
  - `var`, `let`, `const`
144
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) {
@@ -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");