@danielx/civet 0.2.8 → 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/README.md +6 -3
- package/dist/browser.js +50 -16
- package/dist/browser.js.map +2 -2
- package/dist/civet +12 -12
- package/dist/cli.js.map +3 -3
- package/dist/main.js +50 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,17 +60,16 @@ Things Kept from CoffeeScript
|
|
|
60
60
|
- OptionalChain shorthand for index and function application `a?[b]` -> `a?.[b]`, `a?(b)` -> `a?.(b)`
|
|
61
61
|
- `@` -> `this`
|
|
62
62
|
- `@id` -> `this.id`
|
|
63
|
+
- Postfix `if/unless`
|
|
63
64
|
- JSX 😿
|
|
64
65
|
- TODO
|
|
65
66
|
- [ ] `"""` Strings (for compatibility with existing .coffee code)
|
|
66
|
-
- [ ] `///` Heregexp
|
|
67
67
|
- [ ] Chained comparisons
|
|
68
68
|
|
|
69
69
|
Things Removed from CoffeeScript
|
|
70
70
|
---
|
|
71
71
|
|
|
72
|
-
- `on` (use `true`)
|
|
73
|
-
- `off` (use `false`)
|
|
72
|
+
- `on/yes/off/no` (use `true/false`)
|
|
74
73
|
- `do` keyword (replaced with JS `do`)
|
|
75
74
|
- `for from` (use JS `for of`)
|
|
76
75
|
- Array slices `list[0...2]` (use `list.slice(0, 2)`)
|
|
@@ -79,6 +78,8 @@ Things Removed from CoffeeScript
|
|
|
79
78
|
- Implicit declarations
|
|
80
79
|
- Implicit returns (will probably add later)
|
|
81
80
|
- Rest parameter in any assignment position (might add later)
|
|
81
|
+
- `///` Heregexp
|
|
82
|
+
- Embedded JS
|
|
82
83
|
|
|
83
84
|
Things Changed from CoffeeScript
|
|
84
85
|
---
|
|
@@ -89,6 +90,8 @@ Things Changed from CoffeeScript
|
|
|
89
90
|
- `a...` is now `...a` just like JS
|
|
90
91
|
- `x?.y` now compiles to `x?.y` rather than the `if typeof x !== 'undefined' && x !== null` if check
|
|
91
92
|
- Existential `x?` -> `(x != null)` no longer checks for undeclared variables.
|
|
93
|
+
- Embedded JS `\`\`` has been replaced with JS template literals.
|
|
94
|
+
- No longer allowing multiple postfix `if/unless` on the same line.
|
|
92
95
|
|
|
93
96
|
Things Added that CoffeeScript didn't
|
|
94
97
|
---
|
package/dist/browser.js
CHANGED
|
@@ -499,6 +499,8 @@ var Civet = (() => {
|
|
|
499
499
|
BinaryOp,
|
|
500
500
|
UnaryOp,
|
|
501
501
|
ModuleItem,
|
|
502
|
+
StatementListItem,
|
|
503
|
+
PostfixConditional,
|
|
502
504
|
Statement,
|
|
503
505
|
EmptyStatement,
|
|
504
506
|
BlockStatement,
|
|
@@ -727,10 +729,10 @@ var Civet = (() => {
|
|
|
727
729
|
var $L82 = $L("delete");
|
|
728
730
|
var $L83 = $L("void");
|
|
729
731
|
var $L84 = $L("typeof");
|
|
730
|
-
var $L85 = $L("
|
|
731
|
-
var $L86 = $L("
|
|
732
|
-
var $L87 = $L("
|
|
733
|
-
var $L88 = $L("
|
|
732
|
+
var $L85 = $L("if");
|
|
733
|
+
var $L86 = $L("unless");
|
|
734
|
+
var $L87 = $L(";");
|
|
735
|
+
var $L88 = $L("else");
|
|
734
736
|
var $L89 = $L("loop");
|
|
735
737
|
var $L90 = $L("do");
|
|
736
738
|
var $L91 = $L("while");
|
|
@@ -1435,7 +1437,7 @@ var Civet = (() => {
|
|
|
1435
1437
|
return BracedBlock$0(state) || BracedBlock$1(state) || BracedBlock$2(state);
|
|
1436
1438
|
}
|
|
1437
1439
|
}
|
|
1438
|
-
var SingleNestedBlockExpression$0 = $TS($S(PushIndent, $E($S(Nested,
|
|
1440
|
+
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) {
|
|
1439
1441
|
var exp = $2;
|
|
1440
1442
|
if (exp)
|
|
1441
1443
|
return exp;
|
|
@@ -1465,7 +1467,7 @@ var Civet = (() => {
|
|
|
1465
1467
|
return NestedBlockExpressions$0(state);
|
|
1466
1468
|
}
|
|
1467
1469
|
}
|
|
1468
|
-
var BlockExpression$0 = $S(Nested,
|
|
1470
|
+
var BlockExpression$0 = $S(Nested, StatementListItem, StatementDelimiter);
|
|
1469
1471
|
function BlockExpression(state) {
|
|
1470
1472
|
if (state.verbose)
|
|
1471
1473
|
console.log("ENTER:", "BlockExpression");
|
|
@@ -1875,13 +1877,45 @@ var Civet = (() => {
|
|
|
1875
1877
|
}
|
|
1876
1878
|
var ModuleItem$0 = ImportDeclaration;
|
|
1877
1879
|
var ModuleItem$1 = ExportDeclaration;
|
|
1878
|
-
var ModuleItem$2 =
|
|
1879
|
-
var ModuleItem$3 = Statement;
|
|
1880
|
+
var ModuleItem$2 = StatementListItem;
|
|
1880
1881
|
function ModuleItem(state) {
|
|
1881
1882
|
if (state.tokenize) {
|
|
1882
|
-
return $TOKEN("ModuleItem", state, ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state)
|
|
1883
|
+
return $TOKEN("ModuleItem", state, ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state));
|
|
1883
1884
|
} else {
|
|
1884
|
-
return ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state)
|
|
1885
|
+
return ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state);
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
var StatementListItem$0 = $TS($S($C(Declaration, Statement), $E(PostfixConditional)), function($skip, $loc, $0, $1, $2) {
|
|
1889
|
+
var statement = $1;
|
|
1890
|
+
var cond = $2;
|
|
1891
|
+
if (cond)
|
|
1892
|
+
return [cond, statement, "}"];
|
|
1893
|
+
return $0;
|
|
1894
|
+
});
|
|
1895
|
+
function StatementListItem(state) {
|
|
1896
|
+
if (state.verbose)
|
|
1897
|
+
console.log("ENTER:", "StatementListItem");
|
|
1898
|
+
if (state.tokenize) {
|
|
1899
|
+
return $TOKEN("StatementListItem", state, StatementListItem$0(state));
|
|
1900
|
+
} else {
|
|
1901
|
+
return StatementListItem$0(state);
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1904
|
+
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) {
|
|
1905
|
+
var ws = $1;
|
|
1906
|
+
var cond = $2;
|
|
1907
|
+
var exp = $4;
|
|
1908
|
+
if (cond === "if")
|
|
1909
|
+
return [ws, "if(", exp, ") {"];
|
|
1910
|
+
return [ws, "if(!(", exp, ")) {"];
|
|
1911
|
+
});
|
|
1912
|
+
function PostfixConditional(state) {
|
|
1913
|
+
if (state.verbose)
|
|
1914
|
+
console.log("ENTER:", "PostfixConditional");
|
|
1915
|
+
if (state.tokenize) {
|
|
1916
|
+
return $TOKEN("PostfixConditional", state, PostfixConditional$0(state));
|
|
1917
|
+
} else {
|
|
1918
|
+
return PostfixConditional$0(state);
|
|
1885
1919
|
}
|
|
1886
1920
|
}
|
|
1887
1921
|
var Statement$0 = KeywordStatement;
|
|
@@ -1900,7 +1934,7 @@ var Civet = (() => {
|
|
|
1900
1934
|
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);
|
|
1901
1935
|
}
|
|
1902
1936
|
}
|
|
1903
|
-
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($
|
|
1937
|
+
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($L87, fail, 'EmptyStatement ";"')));
|
|
1904
1938
|
function EmptyStatement(state) {
|
|
1905
1939
|
if (state.verbose)
|
|
1906
1940
|
console.log("ENTER:", "EmptyStatement");
|
|
@@ -1920,8 +1954,8 @@ var Civet = (() => {
|
|
|
1920
1954
|
return BlockStatement$0(state);
|
|
1921
1955
|
}
|
|
1922
1956
|
}
|
|
1923
|
-
var IfStatement$0 = $S($EXPECT($
|
|
1924
|
-
var IfStatement$1 = $TS($S($EXPECT($
|
|
1957
|
+
var IfStatement$0 = $S($EXPECT($L85, fail, 'IfStatement "if"'), Condition, Block, $E($S(__, $EXPECT($L88, fail, 'IfStatement "else"'), Block)));
|
|
1958
|
+
var IfStatement$1 = $TS($S($EXPECT($L86, fail, 'IfStatement "unless"'), Condition, Block), function($skip, $loc, $0, $1, $2, $3) {
|
|
1925
1959
|
var condition = $2;
|
|
1926
1960
|
var block = $3;
|
|
1927
1961
|
return ["if", condition.map((c) => {
|
|
@@ -1984,7 +2018,7 @@ var Civet = (() => {
|
|
|
1984
2018
|
return WhileStatement$0(state);
|
|
1985
2019
|
}
|
|
1986
2020
|
}
|
|
1987
|
-
var ForStatement$0 = $S($EXPECT($L92, fail, 'ForStatement "for"'), __, $EXPECT($L1, fail, 'ForStatement "("'), __, $C(LexicalDeclaration, VariableStatement, $E(Expression)), __, $EXPECT($
|
|
2021
|
+
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);
|
|
1988
2022
|
function ForStatement(state) {
|
|
1989
2023
|
if (state.verbose)
|
|
1990
2024
|
console.log("ENTER:", "ForStatement");
|
|
@@ -2705,7 +2739,7 @@ var Civet = (() => {
|
|
|
2705
2739
|
return __$0(state);
|
|
2706
2740
|
}
|
|
2707
2741
|
}
|
|
2708
|
-
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($
|
|
2742
|
+
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L87, fail, 'StatementDelimiter ";"'), $Q(TrailingComment));
|
|
2709
2743
|
var StatementDelimiter$1 = $T($Y(EOS), function(value) {
|
|
2710
2744
|
return [";", value];
|
|
2711
2745
|
});
|
|
@@ -2950,7 +2984,7 @@ var Civet = (() => {
|
|
|
2950
2984
|
return InterfaceProperty$0(state);
|
|
2951
2985
|
}
|
|
2952
2986
|
}
|
|
2953
|
-
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($
|
|
2987
|
+
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($L87, fail, 'InterfacePropertyDelimiter ";"'));
|
|
2954
2988
|
var InterfacePropertyDelimiter$1 = $Y($S($Q(_), $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"')));
|
|
2955
2989
|
var InterfacePropertyDelimiter$2 = $T($Y($S(__, $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"'))), function(value) {
|
|
2956
2990
|
return ";";
|