@danielx/civet 0.2.6 → 0.2.9

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/main.js CHANGED
@@ -420,6 +420,7 @@ var require_parser = __commonJS({
420
420
  AssignmentExpressionRest,
421
421
  YieldExpression,
422
422
  ArrowFunction,
423
+ FatArrow,
423
424
  ConciseBody,
424
425
  ConditionalExpression,
425
426
  ShortCircuitExpression,
@@ -497,6 +498,8 @@ var require_parser = __commonJS({
497
498
  BinaryOp,
498
499
  UnaryOp,
499
500
  ModuleItem,
501
+ StatementListItem,
502
+ PostfixConditional,
500
503
  Statement,
501
504
  EmptyStatement,
502
505
  BlockStatement,
@@ -725,10 +728,10 @@ var require_parser = __commonJS({
725
728
  var $L82 = $L("delete");
726
729
  var $L83 = $L("void");
727
730
  var $L84 = $L("typeof");
728
- var $L85 = $L(";");
729
- var $L86 = $L("if");
730
- var $L87 = $L("else");
731
- var $L88 = $L("unless");
731
+ var $L85 = $L("if");
732
+ var $L86 = $L("unless");
733
+ var $L87 = $L(";");
734
+ var $L88 = $L("else");
732
735
  var $L89 = $L("loop");
733
736
  var $L90 = $L("do");
734
737
  var $L91 = $L("while");
@@ -950,7 +953,7 @@ var require_parser = __commonJS({
950
953
  }
951
954
  var AssignmentExpressionRest$0 = YieldExpression;
952
955
  var AssignmentExpressionRest$1 = $S($E($S($EXPECT($L7, fail, 'AssignmentExpressionRest "async"'), __)), ArrowFunction);
953
- var AssignmentExpressionRest$2 = $S($P($S(__, LeftHandSideExpression, __, AssignmentOp)), $C($S($Q(_), Expression), $S(__, Expression)));
956
+ var AssignmentExpressionRest$2 = $S($P($S(__, LeftHandSideExpression, __, AssignmentOp)), Expression);
954
957
  var AssignmentExpressionRest$3 = ConditionalExpression;
955
958
  function AssignmentExpressionRest(state) {
956
959
  if (state.tokenize) {
@@ -970,7 +973,7 @@ var require_parser = __commonJS({
970
973
  }
971
974
  }
972
975
  var ArrowFunction$0 = ThinArrowFunction;
973
- var ArrowFunction$1 = $S($C(BindingIdentifier, Parameters), $E(ReturnTypeSuffix), __, $EXPECT($L10, fail, 'ArrowFunction "=>"'), ConciseBody);
976
+ var ArrowFunction$1 = $S(Parameters, $E(ReturnTypeSuffix), FatArrow, ConciseBody);
974
977
  function ArrowFunction(state) {
975
978
  if (state.tokenize) {
976
979
  return $TOKEN("ArrowFunction", state, ArrowFunction$0(state) || ArrowFunction$1(state));
@@ -978,8 +981,23 @@ var require_parser = __commonJS({
978
981
  return ArrowFunction$0(state) || ArrowFunction$1(state);
979
982
  }
980
983
  }
981
- var ConciseBody$0 = $S($N($S($Q(_), $EXPECT($L11, fail, 'ConciseBody "{"'))), AssignmentExpression);
982
- var ConciseBody$1 = $S(EOS, SingleNestedBlockExpression);
984
+ var FatArrow$0 = $TS($S(__, $EXPECT($L10, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
985
+ var ws = $1;
986
+ if (!ws.length)
987
+ return " =>";
988
+ return $0;
989
+ });
990
+ function FatArrow(state) {
991
+ if (state.verbose)
992
+ console.log("ENTER:", "FatArrow");
993
+ if (state.tokenize) {
994
+ return $TOKEN("FatArrow", state, FatArrow$0(state));
995
+ } else {
996
+ return FatArrow$0(state);
997
+ }
998
+ }
999
+ var ConciseBody$0 = $S(EOS, SingleNestedBlockExpression);
1000
+ var ConciseBody$1 = $S($N($S($Q(_), $EXPECT($L11, fail, 'ConciseBody "{"'))), AssignmentExpression);
983
1001
  var ConciseBody$2 = BracedBlock;
984
1002
  function ConciseBody(state) {
985
1003
  if (state.tokenize) {
@@ -1418,7 +1436,7 @@ var require_parser = __commonJS({
1418
1436
  return BracedBlock$0(state) || BracedBlock$1(state) || BracedBlock$2(state);
1419
1437
  }
1420
1438
  }
1421
- var SingleNestedBlockExpression$0 = $TS($S(PushIndent, $E($S(Nested, $C(Declaration, Statement))), PopIndent), function($skip, $loc, $0, $1, $2, $3) {
1439
+ var SingleNestedBlockExpression$0 = $TS($S(PushIndent, $E($S(Nested, StatementListItem)), $C($C($N($S(Nested, StatementListItem)), $S(PopIndent, $N($EXPECT($L30, fail, 'SingleNestedBlockExpression ""')))), PopIndent)), function($skip, $loc, $0, $1, $2, $3) {
1422
1440
  var exp = $2;
1423
1441
  if (exp)
1424
1442
  return exp;
@@ -1448,7 +1466,7 @@ var require_parser = __commonJS({
1448
1466
  return NestedBlockExpressions$0(state);
1449
1467
  }
1450
1468
  }
1451
- var BlockExpression$0 = $S(Nested, $C(Declaration, Statement), StatementDelimiter);
1469
+ var BlockExpression$0 = $S(Nested, StatementListItem, StatementDelimiter);
1452
1470
  function BlockExpression(state) {
1453
1471
  if (state.verbose)
1454
1472
  console.log("ENTER:", "BlockExpression");
@@ -1858,13 +1876,45 @@ var require_parser = __commonJS({
1858
1876
  }
1859
1877
  var ModuleItem$0 = ImportDeclaration;
1860
1878
  var ModuleItem$1 = ExportDeclaration;
1861
- var ModuleItem$2 = Declaration;
1862
- var ModuleItem$3 = Statement;
1879
+ var ModuleItem$2 = StatementListItem;
1863
1880
  function ModuleItem(state) {
1864
1881
  if (state.tokenize) {
1865
- return $TOKEN("ModuleItem", state, ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state) || ModuleItem$3(state));
1882
+ return $TOKEN("ModuleItem", state, ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state));
1866
1883
  } else {
1867
- return ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state) || ModuleItem$3(state);
1884
+ return ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state);
1885
+ }
1886
+ }
1887
+ var StatementListItem$0 = $TS($S($C(Declaration, Statement), $E(PostfixConditional)), function($skip, $loc, $0, $1, $2) {
1888
+ var statement = $1;
1889
+ var cond = $2;
1890
+ if (cond)
1891
+ return [cond, statement, "}"];
1892
+ return $0;
1893
+ });
1894
+ function StatementListItem(state) {
1895
+ if (state.verbose)
1896
+ console.log("ENTER:", "StatementListItem");
1897
+ if (state.tokenize) {
1898
+ return $TOKEN("StatementListItem", state, StatementListItem$0(state));
1899
+ } else {
1900
+ return StatementListItem$0(state);
1901
+ }
1902
+ }
1903
+ var PostfixConditional$0 = $TS($S($Q(TrailingComment), $C($EXPECT($L85, fail, 'PostfixConditional "if"'), $EXPECT($L86, fail, 'PostfixConditional "unless"')), NonIdContinue, Expression), function($skip, $loc, $0, $1, $2, $3, $4) {
1904
+ var ws = $1;
1905
+ var cond = $2;
1906
+ var exp = $4;
1907
+ if (cond === "if")
1908
+ return [ws, "if(", exp, ") {"];
1909
+ return [ws, "if(!(", exp, ")) {"];
1910
+ });
1911
+ function PostfixConditional(state) {
1912
+ if (state.verbose)
1913
+ console.log("ENTER:", "PostfixConditional");
1914
+ if (state.tokenize) {
1915
+ return $TOKEN("PostfixConditional", state, PostfixConditional$0(state));
1916
+ } else {
1917
+ return PostfixConditional$0(state);
1868
1918
  }
1869
1919
  }
1870
1920
  var Statement$0 = KeywordStatement;
@@ -1883,7 +1933,7 @@ var require_parser = __commonJS({
1883
1933
  return Statement$0(state) || Statement$1(state) || Statement$2(state) || Statement$3(state) || Statement$4(state) || Statement$5(state) || Statement$6(state) || Statement$7(state) || Statement$8(state);
1884
1934
  }
1885
1935
  }
1886
- var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($L85, fail, 'EmptyStatement ";"')));
1936
+ var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($L87, fail, 'EmptyStatement ";"')));
1887
1937
  function EmptyStatement(state) {
1888
1938
  if (state.verbose)
1889
1939
  console.log("ENTER:", "EmptyStatement");
@@ -1903,8 +1953,8 @@ var require_parser = __commonJS({
1903
1953
  return BlockStatement$0(state);
1904
1954
  }
1905
1955
  }
1906
- var IfStatement$0 = $S($EXPECT($L86, fail, 'IfStatement "if"'), Condition, Block, $E($S(__, $EXPECT($L87, fail, 'IfStatement "else"'), Block)));
1907
- var IfStatement$1 = $TS($S($EXPECT($L88, fail, 'IfStatement "unless"'), Condition, Block), function($skip, $loc, $0, $1, $2, $3) {
1956
+ var IfStatement$0 = $S($EXPECT($L85, fail, 'IfStatement "if"'), Condition, Block, $E($S(__, $EXPECT($L88, fail, 'IfStatement "else"'), Block)));
1957
+ var IfStatement$1 = $TS($S($EXPECT($L86, fail, 'IfStatement "unless"'), Condition, Block), function($skip, $loc, $0, $1, $2, $3) {
1908
1958
  var condition = $2;
1909
1959
  var block = $3;
1910
1960
  return ["if", condition.map((c) => {
@@ -1967,7 +2017,7 @@ var require_parser = __commonJS({
1967
2017
  return WhileStatement$0(state);
1968
2018
  }
1969
2019
  }
1970
- var ForStatement$0 = $S($EXPECT($L92, fail, 'ForStatement "for"'), __, $EXPECT($L1, fail, 'ForStatement "("'), __, $C(LexicalDeclaration, VariableStatement, $E(Expression)), __, $EXPECT($L85, fail, 'ForStatement ";"'), __, $E(Expression), $EXPECT($L85, fail, 'ForStatement ";"'), __, $E(Expression), $EXPECT($L2, fail, 'ForStatement ")"'), Block);
2020
+ var ForStatement$0 = $S($EXPECT($L92, fail, 'ForStatement "for"'), __, $EXPECT($L1, fail, 'ForStatement "("'), __, $C(LexicalDeclaration, VariableStatement, $E(Expression)), __, $EXPECT($L87, fail, 'ForStatement ";"'), __, $E(Expression), $EXPECT($L87, fail, 'ForStatement ";"'), __, $E(Expression), $EXPECT($L2, fail, 'ForStatement ")"'), Block);
1971
2021
  function ForStatement(state) {
1972
2022
  if (state.verbose)
1973
2023
  console.log("ENTER:", "ForStatement");
@@ -2688,7 +2738,7 @@ var require_parser = __commonJS({
2688
2738
  return __$0(state);
2689
2739
  }
2690
2740
  }
2691
- var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L85, fail, 'StatementDelimiter ";"'), $Q(TrailingComment));
2741
+ var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L87, fail, 'StatementDelimiter ";"'), $Q(TrailingComment));
2692
2742
  var StatementDelimiter$1 = $T($Y(EOS), function(value) {
2693
2743
  return [";", value];
2694
2744
  });
@@ -2933,7 +2983,7 @@ var require_parser = __commonJS({
2933
2983
  return InterfaceProperty$0(state);
2934
2984
  }
2935
2985
  }
2936
- var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($L85, fail, 'InterfacePropertyDelimiter ";"'));
2986
+ var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($L87, fail, 'InterfacePropertyDelimiter ";"'));
2937
2987
  var InterfacePropertyDelimiter$1 = $Y($S($Q(_), $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"')));
2938
2988
  var InterfacePropertyDelimiter$2 = $T($Y($S(__, $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"'))), function(value) {
2939
2989
  return ";";
@@ -3466,5 +3516,6 @@ module.exports = {
3466
3516
  parse,
3467
3517
  compile: function(src, options) {
3468
3518
  return gen(parse(src), options);
3469
- }
3519
+ },
3520
+ generate: gen
3470
3521
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielx/civet",
3
- "version": "0.2.6",
3
+ "version": "0.2.9",
4
4
  "description": "CoffeeScript style syntax for TypeScript",
5
5
  "main": "dist/main.js",
6
6
  "bin": {
@@ -37,7 +37,7 @@
37
37
  "coffeescript/register",
38
38
  "@danielx/hera/register"
39
39
  ],
40
- "reporter": "spec",
40
+ "reporter": "dot",
41
41
  "recursive": true,
42
42
  "spec": [
43
43
  "test"