@danielx/civet 0.2.8 → 0.2.11
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 +31 -10
- package/dist/browser.js +101 -45
- package/dist/browser.js.map +2 -2
- package/dist/civet +8 -8
- package/dist/cli.js.map +3 -3
- package/dist/main.js +101 -45
- package/dist/types.d.ts +18 -0
- package/package.json +2 -1
package/dist/main.js
CHANGED
|
@@ -498,6 +498,8 @@ var require_parser = __commonJS({
|
|
|
498
498
|
BinaryOp,
|
|
499
499
|
UnaryOp,
|
|
500
500
|
ModuleItem,
|
|
501
|
+
StatementListItem,
|
|
502
|
+
PostfixConditional,
|
|
501
503
|
Statement,
|
|
502
504
|
EmptyStatement,
|
|
503
505
|
BlockStatement,
|
|
@@ -535,6 +537,8 @@ var require_parser = __commonJS({
|
|
|
535
537
|
ModuleSpecifier,
|
|
536
538
|
ImportedBinding,
|
|
537
539
|
ExportDeclaration,
|
|
540
|
+
As,
|
|
541
|
+
Export,
|
|
538
542
|
ExportFromClause,
|
|
539
543
|
NamedExports,
|
|
540
544
|
ExportSpecifier,
|
|
@@ -726,10 +730,10 @@ var require_parser = __commonJS({
|
|
|
726
730
|
var $L82 = $L("delete");
|
|
727
731
|
var $L83 = $L("void");
|
|
728
732
|
var $L84 = $L("typeof");
|
|
729
|
-
var $L85 = $L("
|
|
730
|
-
var $L86 = $L("
|
|
731
|
-
var $L87 = $L("
|
|
732
|
-
var $L88 = $L("
|
|
733
|
+
var $L85 = $L("if");
|
|
734
|
+
var $L86 = $L("unless");
|
|
735
|
+
var $L87 = $L(";");
|
|
736
|
+
var $L88 = $L("else");
|
|
733
737
|
var $L89 = $L("loop");
|
|
734
738
|
var $L90 = $L("do");
|
|
735
739
|
var $L91 = $L("while");
|
|
@@ -1434,7 +1438,7 @@ var require_parser = __commonJS({
|
|
|
1434
1438
|
return BracedBlock$0(state) || BracedBlock$1(state) || BracedBlock$2(state);
|
|
1435
1439
|
}
|
|
1436
1440
|
}
|
|
1437
|
-
var SingleNestedBlockExpression$0 = $TS($S(PushIndent, $E($S(Nested,
|
|
1441
|
+
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) {
|
|
1438
1442
|
var exp = $2;
|
|
1439
1443
|
if (exp)
|
|
1440
1444
|
return exp;
|
|
@@ -1464,7 +1468,7 @@ var require_parser = __commonJS({
|
|
|
1464
1468
|
return NestedBlockExpressions$0(state);
|
|
1465
1469
|
}
|
|
1466
1470
|
}
|
|
1467
|
-
var BlockExpression$0 = $S(Nested,
|
|
1471
|
+
var BlockExpression$0 = $S(Nested, StatementListItem, StatementDelimiter);
|
|
1468
1472
|
function BlockExpression(state) {
|
|
1469
1473
|
if (state.verbose)
|
|
1470
1474
|
console.log("ENTER:", "BlockExpression");
|
|
@@ -1874,13 +1878,45 @@ var require_parser = __commonJS({
|
|
|
1874
1878
|
}
|
|
1875
1879
|
var ModuleItem$0 = ImportDeclaration;
|
|
1876
1880
|
var ModuleItem$1 = ExportDeclaration;
|
|
1877
|
-
var ModuleItem$2 =
|
|
1878
|
-
var ModuleItem$3 = Statement;
|
|
1881
|
+
var ModuleItem$2 = StatementListItem;
|
|
1879
1882
|
function ModuleItem(state) {
|
|
1880
1883
|
if (state.tokenize) {
|
|
1881
|
-
return $TOKEN("ModuleItem", state, ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state)
|
|
1884
|
+
return $TOKEN("ModuleItem", state, ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state));
|
|
1882
1885
|
} else {
|
|
1883
|
-
return ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state)
|
|
1886
|
+
return ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state);
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
var StatementListItem$0 = $TS($S($C(Declaration, Statement), $E(PostfixConditional)), function($skip, $loc, $0, $1, $2) {
|
|
1890
|
+
var statement = $1;
|
|
1891
|
+
var cond = $2;
|
|
1892
|
+
if (cond)
|
|
1893
|
+
return [cond, statement, "}"];
|
|
1894
|
+
return $0;
|
|
1895
|
+
});
|
|
1896
|
+
function StatementListItem(state) {
|
|
1897
|
+
if (state.verbose)
|
|
1898
|
+
console.log("ENTER:", "StatementListItem");
|
|
1899
|
+
if (state.tokenize) {
|
|
1900
|
+
return $TOKEN("StatementListItem", state, StatementListItem$0(state));
|
|
1901
|
+
} else {
|
|
1902
|
+
return StatementListItem$0(state);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
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) {
|
|
1906
|
+
var ws = $1;
|
|
1907
|
+
var cond = $2;
|
|
1908
|
+
var exp = $4;
|
|
1909
|
+
if (cond === "if")
|
|
1910
|
+
return [ws, "if(", exp, ") {"];
|
|
1911
|
+
return [ws, "if(!(", exp, ")) {"];
|
|
1912
|
+
});
|
|
1913
|
+
function PostfixConditional(state) {
|
|
1914
|
+
if (state.verbose)
|
|
1915
|
+
console.log("ENTER:", "PostfixConditional");
|
|
1916
|
+
if (state.tokenize) {
|
|
1917
|
+
return $TOKEN("PostfixConditional", state, PostfixConditional$0(state));
|
|
1918
|
+
} else {
|
|
1919
|
+
return PostfixConditional$0(state);
|
|
1884
1920
|
}
|
|
1885
1921
|
}
|
|
1886
1922
|
var Statement$0 = KeywordStatement;
|
|
@@ -1899,7 +1935,7 @@ var require_parser = __commonJS({
|
|
|
1899
1935
|
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);
|
|
1900
1936
|
}
|
|
1901
1937
|
}
|
|
1902
|
-
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($
|
|
1938
|
+
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($L87, fail, 'EmptyStatement ";"')));
|
|
1903
1939
|
function EmptyStatement(state) {
|
|
1904
1940
|
if (state.verbose)
|
|
1905
1941
|
console.log("ENTER:", "EmptyStatement");
|
|
@@ -1919,8 +1955,8 @@ var require_parser = __commonJS({
|
|
|
1919
1955
|
return BlockStatement$0(state);
|
|
1920
1956
|
}
|
|
1921
1957
|
}
|
|
1922
|
-
var IfStatement$0 = $S($EXPECT($
|
|
1923
|
-
var IfStatement$1 = $TS($S($EXPECT($
|
|
1958
|
+
var IfStatement$0 = $S($EXPECT($L85, fail, 'IfStatement "if"'), Condition, Block, $E($S(__, $EXPECT($L88, fail, 'IfStatement "else"'), Block)));
|
|
1959
|
+
var IfStatement$1 = $TS($S($EXPECT($L86, fail, 'IfStatement "unless"'), Condition, Block), function($skip, $loc, $0, $1, $2, $3) {
|
|
1924
1960
|
var condition = $2;
|
|
1925
1961
|
var block = $3;
|
|
1926
1962
|
return ["if", condition.map((c) => {
|
|
@@ -1950,8 +1986,8 @@ var require_parser = __commonJS({
|
|
|
1950
1986
|
return IterationStatement$0(state) || IterationStatement$1(state) || IterationStatement$2(state) || IterationStatement$3(state) || IterationStatement$4(state);
|
|
1951
1987
|
}
|
|
1952
1988
|
}
|
|
1953
|
-
var LoopStatement$0 = $TS($S($EXPECT($L89, fail, 'LoopStatement "loop"'), Block), function($skip, $loc, $0, $1, $2) {
|
|
1954
|
-
var b = $
|
|
1989
|
+
var LoopStatement$0 = $TS($S($EXPECT($L89, fail, 'LoopStatement "loop"'), NonIdContinue, Block), function($skip, $loc, $0, $1, $2, $3) {
|
|
1990
|
+
var b = $3;
|
|
1955
1991
|
return ["while(true)", b];
|
|
1956
1992
|
});
|
|
1957
1993
|
function LoopStatement(state) {
|
|
@@ -1963,7 +1999,7 @@ var require_parser = __commonJS({
|
|
|
1963
1999
|
return LoopStatement$0(state);
|
|
1964
2000
|
}
|
|
1965
2001
|
}
|
|
1966
|
-
var DoWhileStatement$0 = $S($EXPECT($L90, fail, 'DoWhileStatement "do"'), Block, __, $EXPECT($L91, fail, 'DoWhileStatement "while"'), Condition);
|
|
2002
|
+
var DoWhileStatement$0 = $S($EXPECT($L90, fail, 'DoWhileStatement "do"'), NonIdContinue, Block, __, $EXPECT($L91, fail, 'DoWhileStatement "while"'), Condition);
|
|
1967
2003
|
function DoWhileStatement(state) {
|
|
1968
2004
|
if (state.verbose)
|
|
1969
2005
|
console.log("ENTER:", "DoWhileStatement");
|
|
@@ -1973,7 +2009,7 @@ var require_parser = __commonJS({
|
|
|
1973
2009
|
return DoWhileStatement$0(state);
|
|
1974
2010
|
}
|
|
1975
2011
|
}
|
|
1976
|
-
var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), Condition, Block);
|
|
2012
|
+
var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), NonIdContinue, Condition, Block);
|
|
1977
2013
|
function WhileStatement(state) {
|
|
1978
2014
|
if (state.verbose)
|
|
1979
2015
|
console.log("ENTER:", "WhileStatement");
|
|
@@ -1983,7 +2019,7 @@ var require_parser = __commonJS({
|
|
|
1983
2019
|
return WhileStatement$0(state);
|
|
1984
2020
|
}
|
|
1985
2021
|
}
|
|
1986
|
-
var ForStatement$0 = $S($EXPECT($L92, fail, 'ForStatement "for"'), __, $EXPECT($L1, fail, 'ForStatement "("'), __, $C(LexicalDeclaration, VariableStatement, $E(Expression)), __, $EXPECT($
|
|
2022
|
+
var ForStatement$0 = $S($EXPECT($L92, fail, 'ForStatement "for"'), NonIdContinue, __, $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);
|
|
1987
2023
|
function ForStatement(state) {
|
|
1988
2024
|
if (state.verbose)
|
|
1989
2025
|
console.log("ENTER:", "ForStatement");
|
|
@@ -1993,10 +2029,10 @@ var require_parser = __commonJS({
|
|
|
1993
2029
|
return ForStatement$0(state);
|
|
1994
2030
|
}
|
|
1995
2031
|
}
|
|
1996
|
-
var ForInOfStatement$0 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), __, $EXPECT($L1, fail, 'ForInOfStatement "("'), __, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L78, fail, 'ForInOfStatement "in"'), __, Expression, __, $EXPECT($L2, fail, 'ForInOfStatement ")"'), Block);
|
|
1997
|
-
var ForInOfStatement$1 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), __, InsertOpenParen, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L78, fail, 'ForInOfStatement "in"'), __, Expression, InsertCloseParen, Block);
|
|
1998
|
-
var ForInOfStatement$2 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), $E($S(__, $EXPECT($L94, fail, 'ForInOfStatement "await"'))), __, $EXPECT($L1, fail, 'ForInOfStatement "("'), __, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L95, fail, 'ForInOfStatement "of"'), AssignmentExpression, __, $EXPECT($L2, fail, 'ForInOfStatement ")"'), Block);
|
|
1999
|
-
var ForInOfStatement$3 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), $E($S(__, $EXPECT($L94, fail, 'ForInOfStatement "await"'))), __, InsertOpenParen, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L95, fail, 'ForInOfStatement "of"'), AssignmentExpression, InsertCloseParen, Block);
|
|
2032
|
+
var ForInOfStatement$0 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), NonIdContinue, __, $EXPECT($L1, fail, 'ForInOfStatement "("'), __, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L78, fail, 'ForInOfStatement "in"'), __, Expression, __, $EXPECT($L2, fail, 'ForInOfStatement ")"'), Block);
|
|
2033
|
+
var ForInOfStatement$1 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), NonIdContinue, __, InsertOpenParen, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L78, fail, 'ForInOfStatement "in"'), __, Expression, InsertCloseParen, Block);
|
|
2034
|
+
var ForInOfStatement$2 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), NonIdContinue, $E($S(__, $EXPECT($L94, fail, 'ForInOfStatement "await"'))), __, $EXPECT($L1, fail, 'ForInOfStatement "("'), __, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L95, fail, 'ForInOfStatement "of"'), AssignmentExpression, __, $EXPECT($L2, fail, 'ForInOfStatement ")"'), Block);
|
|
2035
|
+
var ForInOfStatement$3 = $S($EXPECT($L92, fail, 'ForInOfStatement "for"'), NonIdContinue, $E($S(__, $EXPECT($L94, fail, 'ForInOfStatement "await"'))), __, InsertOpenParen, $C($S($EXPECT($L93, fail, 'ForInOfStatement "var"'), __, ForBinding), ForDeclaration, LeftHandSideExpression), __, $EXPECT($L95, fail, 'ForInOfStatement "of"'), AssignmentExpression, InsertCloseParen, Block);
|
|
2000
2036
|
function ForInOfStatement(state) {
|
|
2001
2037
|
if (state.tokenize) {
|
|
2002
2038
|
return $TOKEN("ForInOfStatement", state, ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state));
|
|
@@ -2004,7 +2040,7 @@ var require_parser = __commonJS({
|
|
|
2004
2040
|
return ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state);
|
|
2005
2041
|
}
|
|
2006
2042
|
}
|
|
2007
|
-
var ForDeclaration$0 = $S($C($EXPECT($L96, fail, 'ForDeclaration "let"'), $EXPECT($L97, fail, 'ForDeclaration "const"')), __, ForBinding);
|
|
2043
|
+
var ForDeclaration$0 = $S($C($EXPECT($L96, fail, 'ForDeclaration "let"'), $EXPECT($L97, fail, 'ForDeclaration "const"')), NonIdContinue, __, ForBinding);
|
|
2008
2044
|
function ForDeclaration(state) {
|
|
2009
2045
|
if (state.verbose)
|
|
2010
2046
|
console.log("ENTER:", "ForDeclaration");
|
|
@@ -2023,7 +2059,7 @@ var require_parser = __commonJS({
|
|
|
2023
2059
|
return ForBinding$0(state) || ForBinding$1(state);
|
|
2024
2060
|
}
|
|
2025
2061
|
}
|
|
2026
|
-
var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), Condition, CaseBlock);
|
|
2062
|
+
var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), NonIdContinue, Condition, CaseBlock);
|
|
2027
2063
|
function SwitchStatement(state) {
|
|
2028
2064
|
if (state.verbose)
|
|
2029
2065
|
console.log("ENTER:", "SwitchStatement");
|
|
@@ -2067,9 +2103,9 @@ var require_parser = __commonJS({
|
|
|
2067
2103
|
return NestedCaseClause$0(state);
|
|
2068
2104
|
}
|
|
2069
2105
|
}
|
|
2070
|
-
var CaseClause$0 = $S($EXPECT($L99, fail, 'CaseClause "case"'), $Q(_), Expression, ImpliedColon, NestedBlockExpressions);
|
|
2106
|
+
var CaseClause$0 = $S($EXPECT($L99, fail, 'CaseClause "case"'), NonIdContinue, $Q(_), Expression, ImpliedColon, NestedBlockExpressions);
|
|
2071
2107
|
var CaseClause$1 = $S(When, $Q(_), Expression, ImpliedColon, NestedBlockExpressions, InsertBreak);
|
|
2072
|
-
var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), ImpliedColon, NestedBlockExpressions);
|
|
2108
|
+
var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), NonIdContinue, ImpliedColon, NestedBlockExpressions);
|
|
2073
2109
|
function CaseClause(state) {
|
|
2074
2110
|
if (state.tokenize) {
|
|
2075
2111
|
return $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state));
|
|
@@ -2077,7 +2113,7 @@ var require_parser = __commonJS({
|
|
|
2077
2113
|
return CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state);
|
|
2078
2114
|
}
|
|
2079
2115
|
}
|
|
2080
|
-
var When$0 = $T($EXPECT($L101, fail, 'When "when"'), function(value) {
|
|
2116
|
+
var When$0 = $T($S($EXPECT($L101, fail, 'When "when"'), NonIdContinue), function(value) {
|
|
2081
2117
|
return "case";
|
|
2082
2118
|
});
|
|
2083
2119
|
function When(state) {
|
|
@@ -2174,12 +2210,12 @@ var require_parser = __commonJS({
|
|
|
2174
2210
|
return ExpressionStatement$0(state);
|
|
2175
2211
|
}
|
|
2176
2212
|
}
|
|
2177
|
-
var KeywordStatement$0 = $EXPECT($L105, fail, 'KeywordStatement "break"');
|
|
2178
|
-
var KeywordStatement$1 = $EXPECT($L106, fail, 'KeywordStatement "continue"');
|
|
2179
|
-
var KeywordStatement$2 = $EXPECT($L107, fail, 'KeywordStatement "debugger"');
|
|
2180
|
-
var KeywordStatement$3 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), Expression);
|
|
2181
|
-
var KeywordStatement$4 = $EXPECT($L108, fail, 'KeywordStatement "return"');
|
|
2182
|
-
var KeywordStatement$5 = $S($EXPECT($L109, fail, 'KeywordStatement "throw"'), Expression);
|
|
2213
|
+
var KeywordStatement$0 = $S($EXPECT($L105, fail, 'KeywordStatement "break"'), NonIdContinue);
|
|
2214
|
+
var KeywordStatement$1 = $S($EXPECT($L106, fail, 'KeywordStatement "continue"'), NonIdContinue);
|
|
2215
|
+
var KeywordStatement$2 = $S($EXPECT($L107, fail, 'KeywordStatement "debugger"'), NonIdContinue);
|
|
2216
|
+
var KeywordStatement$3 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), NonIdContinue, Expression);
|
|
2217
|
+
var KeywordStatement$4 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), NonIdContinue);
|
|
2218
|
+
var KeywordStatement$5 = $S($EXPECT($L109, fail, 'KeywordStatement "throw"'), NonIdContinue, Expression);
|
|
2183
2219
|
function KeywordStatement(state) {
|
|
2184
2220
|
if (state.tokenize) {
|
|
2185
2221
|
return $TOKEN("KeywordStatement", state, KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state));
|
|
@@ -2187,11 +2223,11 @@ var require_parser = __commonJS({
|
|
|
2187
2223
|
return KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state);
|
|
2188
2224
|
}
|
|
2189
2225
|
}
|
|
2190
|
-
var ImportDeclaration$0 = $T($S($EXPECT($L110, fail, 'ImportDeclaration "import type"'), __, ImportClause, __, FromClause), function(value) {
|
|
2226
|
+
var ImportDeclaration$0 = $T($S($EXPECT($L110, fail, 'ImportDeclaration "import type"'), NonIdContinue, __, ImportClause, __, FromClause), function(value) {
|
|
2191
2227
|
return { "ts": true, "children": value };
|
|
2192
2228
|
});
|
|
2193
|
-
var ImportDeclaration$1 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), __, ImportClause, __, FromClause);
|
|
2194
|
-
var ImportDeclaration$2 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), __, ModuleSpecifier);
|
|
2229
|
+
var ImportDeclaration$1 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), NonIdContinue, __, ImportClause, __, FromClause);
|
|
2230
|
+
var ImportDeclaration$2 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), NonIdContinue, __, ModuleSpecifier);
|
|
2195
2231
|
function ImportDeclaration(state) {
|
|
2196
2232
|
if (state.tokenize) {
|
|
2197
2233
|
return $TOKEN("ImportDeclaration", state, ImportDeclaration$0(state) || ImportDeclaration$1(state) || ImportDeclaration$2(state));
|
|
@@ -2209,7 +2245,7 @@ var require_parser = __commonJS({
|
|
|
2209
2245
|
return ImportClause$0(state) || ImportClause$1(state) || ImportClause$2(state);
|
|
2210
2246
|
}
|
|
2211
2247
|
}
|
|
2212
|
-
var NameSpaceImport$0 = $S($EXPECT($L9, fail, 'NameSpaceImport "*"'), __, $EXPECT($L4, fail, 'NameSpaceImport "as"'), __, ImportedBinding);
|
|
2248
|
+
var NameSpaceImport$0 = $S($EXPECT($L9, fail, 'NameSpaceImport "*"'), __, $EXPECT($L4, fail, 'NameSpaceImport "as"'), NonIdContinue, __, ImportedBinding);
|
|
2213
2249
|
function NameSpaceImport(state) {
|
|
2214
2250
|
if (state.verbose)
|
|
2215
2251
|
console.log("ENTER:", "NameSpaceImport");
|
|
@@ -2229,7 +2265,7 @@ var require_parser = __commonJS({
|
|
|
2229
2265
|
return NamedImports$0(state);
|
|
2230
2266
|
}
|
|
2231
2267
|
}
|
|
2232
|
-
var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), __, ModuleSpecifier);
|
|
2268
|
+
var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), NonIdContinue, __, ModuleSpecifier);
|
|
2233
2269
|
function FromClause(state) {
|
|
2234
2270
|
if (state.verbose)
|
|
2235
2271
|
console.log("ENTER:", "FromClause");
|
|
@@ -2239,7 +2275,7 @@ var require_parser = __commonJS({
|
|
|
2239
2275
|
return FromClause$0(state);
|
|
2240
2276
|
}
|
|
2241
2277
|
}
|
|
2242
|
-
var ImportSpecifier$0 = $S(__, ModuleExportName, __, $EXPECT($L4, fail, 'ImportSpecifier "as"'), __, ImportedBinding, ObjectPropertyDelimiter);
|
|
2278
|
+
var ImportSpecifier$0 = $S(__, ModuleExportName, __, $EXPECT($L4, fail, 'ImportSpecifier "as"'), NonIdContinue, __, ImportedBinding, ObjectPropertyDelimiter);
|
|
2243
2279
|
var ImportSpecifier$1 = $S(__, ImportedBinding, ObjectPropertyDelimiter);
|
|
2244
2280
|
function ImportSpecifier(state) {
|
|
2245
2281
|
if (state.tokenize) {
|
|
@@ -2277,9 +2313,9 @@ var require_parser = __commonJS({
|
|
|
2277
2313
|
return ImportedBinding$0(state);
|
|
2278
2314
|
}
|
|
2279
2315
|
}
|
|
2280
|
-
var ExportDeclaration$0 = $S(
|
|
2281
|
-
var ExportDeclaration$1 = $S(
|
|
2282
|
-
var ExportDeclaration$2 = $S(
|
|
2316
|
+
var ExportDeclaration$0 = $S(Export, __, $EXPECT($L100, fail, 'ExportDeclaration "default"'), NonIdContinue, __, $C(HoistableDeclaration, ClassDeclaration, AssignmentExpression));
|
|
2317
|
+
var ExportDeclaration$1 = $S(Export, __, ExportFromClause, __, FromClause);
|
|
2318
|
+
var ExportDeclaration$2 = $S(Export, __, $C(NamedExports, VariableStatement, Declaration));
|
|
2283
2319
|
function ExportDeclaration(state) {
|
|
2284
2320
|
if (state.tokenize) {
|
|
2285
2321
|
return $TOKEN("ExportDeclaration", state, ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state));
|
|
@@ -2287,7 +2323,27 @@ var require_parser = __commonJS({
|
|
|
2287
2323
|
return ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state);
|
|
2288
2324
|
}
|
|
2289
2325
|
}
|
|
2290
|
-
var
|
|
2326
|
+
var As$0 = $S($EXPECT($L4, fail, 'As "as"'), NonIdContinue);
|
|
2327
|
+
function As(state) {
|
|
2328
|
+
if (state.verbose)
|
|
2329
|
+
console.log("ENTER:", "As");
|
|
2330
|
+
if (state.tokenize) {
|
|
2331
|
+
return $TOKEN("As", state, As$0(state));
|
|
2332
|
+
} else {
|
|
2333
|
+
return As$0(state);
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
var Export$0 = $S($EXPECT($L112, fail, 'Export "export"'), NonIdContinue);
|
|
2337
|
+
function Export(state) {
|
|
2338
|
+
if (state.verbose)
|
|
2339
|
+
console.log("ENTER:", "Export");
|
|
2340
|
+
if (state.tokenize) {
|
|
2341
|
+
return $TOKEN("Export", state, Export$0(state));
|
|
2342
|
+
} else {
|
|
2343
|
+
return Export$0(state);
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
var ExportFromClause$0 = $S($EXPECT($L9, fail, 'ExportFromClause "*"'), $E($S(__, $EXPECT($L4, fail, 'ExportFromClause "as"'), NonIdContinue, __, ModuleExportName)));
|
|
2291
2347
|
var ExportFromClause$1 = NamedExports;
|
|
2292
2348
|
function ExportFromClause(state) {
|
|
2293
2349
|
if (state.tokenize) {
|
|
@@ -2704,7 +2760,7 @@ var require_parser = __commonJS({
|
|
|
2704
2760
|
return __$0(state);
|
|
2705
2761
|
}
|
|
2706
2762
|
}
|
|
2707
|
-
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($
|
|
2763
|
+
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L87, fail, 'StatementDelimiter ";"'), $Q(TrailingComment));
|
|
2708
2764
|
var StatementDelimiter$1 = $T($Y(EOS), function(value) {
|
|
2709
2765
|
return [";", value];
|
|
2710
2766
|
});
|
|
@@ -2949,7 +3005,7 @@ var require_parser = __commonJS({
|
|
|
2949
3005
|
return InterfaceProperty$0(state);
|
|
2950
3006
|
}
|
|
2951
3007
|
}
|
|
2952
|
-
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($
|
|
3008
|
+
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($L87, fail, 'InterfacePropertyDelimiter ";"'));
|
|
2953
3009
|
var InterfacePropertyDelimiter$1 = $Y($S($Q(_), $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"')));
|
|
2954
3010
|
var InterfacePropertyDelimiter$2 = $T($Y($S(__, $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"'))), function(value) {
|
|
2955
3011
|
return ";";
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare module "@danielx/civet" {
|
|
2
|
+
export type CivetAST = unknown;
|
|
3
|
+
export type CompileOptions = {
|
|
4
|
+
js?: boolean
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function compile(source: string, options?: CompileOptions): string
|
|
8
|
+
export function parse(source: string): CivetAST
|
|
9
|
+
export function generate(ast: CivetAST, options?: CompileOptions): string
|
|
10
|
+
|
|
11
|
+
const Civet: {
|
|
12
|
+
compile: typeof compile;
|
|
13
|
+
parse: typeof parse;
|
|
14
|
+
generate: typeof generate;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default Civet;
|
|
18
|
+
}
|