@danielx/civet 0.2.7 → 0.2.10
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 +39 -10
- package/dist/browser.js +121 -49
- package/dist/browser.js.map +2 -2
- package/dist/civet +12 -12
- package/dist/cli.js.map +3 -3
- package/dist/main.js +121 -49
- package/dist/types.d.ts +16 -0
- package/package.json +2 -1
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,
|
|
@@ -534,6 +537,8 @@ var require_parser = __commonJS({
|
|
|
534
537
|
ModuleSpecifier,
|
|
535
538
|
ImportedBinding,
|
|
536
539
|
ExportDeclaration,
|
|
540
|
+
As,
|
|
541
|
+
Export,
|
|
537
542
|
ExportFromClause,
|
|
538
543
|
NamedExports,
|
|
539
544
|
ExportSpecifier,
|
|
@@ -725,10 +730,10 @@ var require_parser = __commonJS({
|
|
|
725
730
|
var $L82 = $L("delete");
|
|
726
731
|
var $L83 = $L("void");
|
|
727
732
|
var $L84 = $L("typeof");
|
|
728
|
-
var $L85 = $L("
|
|
729
|
-
var $L86 = $L("
|
|
730
|
-
var $L87 = $L("
|
|
731
|
-
var $L88 = $L("
|
|
733
|
+
var $L85 = $L("if");
|
|
734
|
+
var $L86 = $L("unless");
|
|
735
|
+
var $L87 = $L(";");
|
|
736
|
+
var $L88 = $L("else");
|
|
732
737
|
var $L89 = $L("loop");
|
|
733
738
|
var $L90 = $L("do");
|
|
734
739
|
var $L91 = $L("while");
|
|
@@ -950,7 +955,7 @@ var require_parser = __commonJS({
|
|
|
950
955
|
}
|
|
951
956
|
var AssignmentExpressionRest$0 = YieldExpression;
|
|
952
957
|
var AssignmentExpressionRest$1 = $S($E($S($EXPECT($L7, fail, 'AssignmentExpressionRest "async"'), __)), ArrowFunction);
|
|
953
|
-
var AssignmentExpressionRest$2 = $S($P($S(__, LeftHandSideExpression, __, AssignmentOp)),
|
|
958
|
+
var AssignmentExpressionRest$2 = $S($P($S(__, LeftHandSideExpression, __, AssignmentOp)), Expression);
|
|
954
959
|
var AssignmentExpressionRest$3 = ConditionalExpression;
|
|
955
960
|
function AssignmentExpressionRest(state) {
|
|
956
961
|
if (state.tokenize) {
|
|
@@ -970,7 +975,7 @@ var require_parser = __commonJS({
|
|
|
970
975
|
}
|
|
971
976
|
}
|
|
972
977
|
var ArrowFunction$0 = ThinArrowFunction;
|
|
973
|
-
var ArrowFunction$1 = $S(
|
|
978
|
+
var ArrowFunction$1 = $S(Parameters, $E(ReturnTypeSuffix), FatArrow, ConciseBody);
|
|
974
979
|
function ArrowFunction(state) {
|
|
975
980
|
if (state.tokenize) {
|
|
976
981
|
return $TOKEN("ArrowFunction", state, ArrowFunction$0(state) || ArrowFunction$1(state));
|
|
@@ -978,8 +983,23 @@ var require_parser = __commonJS({
|
|
|
978
983
|
return ArrowFunction$0(state) || ArrowFunction$1(state);
|
|
979
984
|
}
|
|
980
985
|
}
|
|
981
|
-
var
|
|
982
|
-
|
|
986
|
+
var FatArrow$0 = $TS($S(__, $EXPECT($L10, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
|
|
987
|
+
var ws = $1;
|
|
988
|
+
if (!ws.length)
|
|
989
|
+
return " =>";
|
|
990
|
+
return $0;
|
|
991
|
+
});
|
|
992
|
+
function FatArrow(state) {
|
|
993
|
+
if (state.verbose)
|
|
994
|
+
console.log("ENTER:", "FatArrow");
|
|
995
|
+
if (state.tokenize) {
|
|
996
|
+
return $TOKEN("FatArrow", state, FatArrow$0(state));
|
|
997
|
+
} else {
|
|
998
|
+
return FatArrow$0(state);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
var ConciseBody$0 = $S(EOS, SingleNestedBlockExpression);
|
|
1002
|
+
var ConciseBody$1 = $S($N($S($Q(_), $EXPECT($L11, fail, 'ConciseBody "{"'))), AssignmentExpression);
|
|
983
1003
|
var ConciseBody$2 = BracedBlock;
|
|
984
1004
|
function ConciseBody(state) {
|
|
985
1005
|
if (state.tokenize) {
|
|
@@ -1418,7 +1438,7 @@ var require_parser = __commonJS({
|
|
|
1418
1438
|
return BracedBlock$0(state) || BracedBlock$1(state) || BracedBlock$2(state);
|
|
1419
1439
|
}
|
|
1420
1440
|
}
|
|
1421
|
-
var SingleNestedBlockExpression$0 = $TS($S(PushIndent, $E($S(Nested, $C(
|
|
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) {
|
|
1422
1442
|
var exp = $2;
|
|
1423
1443
|
if (exp)
|
|
1424
1444
|
return exp;
|
|
@@ -1448,7 +1468,7 @@ var require_parser = __commonJS({
|
|
|
1448
1468
|
return NestedBlockExpressions$0(state);
|
|
1449
1469
|
}
|
|
1450
1470
|
}
|
|
1451
|
-
var BlockExpression$0 = $S(Nested,
|
|
1471
|
+
var BlockExpression$0 = $S(Nested, StatementListItem, StatementDelimiter);
|
|
1452
1472
|
function BlockExpression(state) {
|
|
1453
1473
|
if (state.verbose)
|
|
1454
1474
|
console.log("ENTER:", "BlockExpression");
|
|
@@ -1858,13 +1878,45 @@ var require_parser = __commonJS({
|
|
|
1858
1878
|
}
|
|
1859
1879
|
var ModuleItem$0 = ImportDeclaration;
|
|
1860
1880
|
var ModuleItem$1 = ExportDeclaration;
|
|
1861
|
-
var ModuleItem$2 =
|
|
1862
|
-
var ModuleItem$3 = Statement;
|
|
1881
|
+
var ModuleItem$2 = StatementListItem;
|
|
1863
1882
|
function ModuleItem(state) {
|
|
1864
1883
|
if (state.tokenize) {
|
|
1865
|
-
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));
|
|
1885
|
+
} else {
|
|
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));
|
|
1866
1918
|
} else {
|
|
1867
|
-
return
|
|
1919
|
+
return PostfixConditional$0(state);
|
|
1868
1920
|
}
|
|
1869
1921
|
}
|
|
1870
1922
|
var Statement$0 = KeywordStatement;
|
|
@@ -1883,7 +1935,7 @@ var require_parser = __commonJS({
|
|
|
1883
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);
|
|
1884
1936
|
}
|
|
1885
1937
|
}
|
|
1886
|
-
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($
|
|
1938
|
+
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($L87, fail, 'EmptyStatement ";"')));
|
|
1887
1939
|
function EmptyStatement(state) {
|
|
1888
1940
|
if (state.verbose)
|
|
1889
1941
|
console.log("ENTER:", "EmptyStatement");
|
|
@@ -1903,8 +1955,8 @@ var require_parser = __commonJS({
|
|
|
1903
1955
|
return BlockStatement$0(state);
|
|
1904
1956
|
}
|
|
1905
1957
|
}
|
|
1906
|
-
var IfStatement$0 = $S($EXPECT($
|
|
1907
|
-
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) {
|
|
1908
1960
|
var condition = $2;
|
|
1909
1961
|
var block = $3;
|
|
1910
1962
|
return ["if", condition.map((c) => {
|
|
@@ -1934,8 +1986,8 @@ var require_parser = __commonJS({
|
|
|
1934
1986
|
return IterationStatement$0(state) || IterationStatement$1(state) || IterationStatement$2(state) || IterationStatement$3(state) || IterationStatement$4(state);
|
|
1935
1987
|
}
|
|
1936
1988
|
}
|
|
1937
|
-
var LoopStatement$0 = $TS($S($EXPECT($L89, fail, 'LoopStatement "loop"'), Block), function($skip, $loc, $0, $1, $2) {
|
|
1938
|
-
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;
|
|
1939
1991
|
return ["while(true)", b];
|
|
1940
1992
|
});
|
|
1941
1993
|
function LoopStatement(state) {
|
|
@@ -1947,7 +1999,7 @@ var require_parser = __commonJS({
|
|
|
1947
1999
|
return LoopStatement$0(state);
|
|
1948
2000
|
}
|
|
1949
2001
|
}
|
|
1950
|
-
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);
|
|
1951
2003
|
function DoWhileStatement(state) {
|
|
1952
2004
|
if (state.verbose)
|
|
1953
2005
|
console.log("ENTER:", "DoWhileStatement");
|
|
@@ -1957,7 +2009,7 @@ var require_parser = __commonJS({
|
|
|
1957
2009
|
return DoWhileStatement$0(state);
|
|
1958
2010
|
}
|
|
1959
2011
|
}
|
|
1960
|
-
var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), Condition, Block);
|
|
2012
|
+
var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), NonIdContinue, Condition, Block);
|
|
1961
2013
|
function WhileStatement(state) {
|
|
1962
2014
|
if (state.verbose)
|
|
1963
2015
|
console.log("ENTER:", "WhileStatement");
|
|
@@ -1967,7 +2019,7 @@ var require_parser = __commonJS({
|
|
|
1967
2019
|
return WhileStatement$0(state);
|
|
1968
2020
|
}
|
|
1969
2021
|
}
|
|
1970
|
-
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);
|
|
1971
2023
|
function ForStatement(state) {
|
|
1972
2024
|
if (state.verbose)
|
|
1973
2025
|
console.log("ENTER:", "ForStatement");
|
|
@@ -1977,10 +2029,10 @@ var require_parser = __commonJS({
|
|
|
1977
2029
|
return ForStatement$0(state);
|
|
1978
2030
|
}
|
|
1979
2031
|
}
|
|
1980
|
-
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);
|
|
1981
|
-
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);
|
|
1982
|
-
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);
|
|
1983
|
-
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);
|
|
1984
2036
|
function ForInOfStatement(state) {
|
|
1985
2037
|
if (state.tokenize) {
|
|
1986
2038
|
return $TOKEN("ForInOfStatement", state, ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state));
|
|
@@ -1988,7 +2040,7 @@ var require_parser = __commonJS({
|
|
|
1988
2040
|
return ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state);
|
|
1989
2041
|
}
|
|
1990
2042
|
}
|
|
1991
|
-
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);
|
|
1992
2044
|
function ForDeclaration(state) {
|
|
1993
2045
|
if (state.verbose)
|
|
1994
2046
|
console.log("ENTER:", "ForDeclaration");
|
|
@@ -2007,7 +2059,7 @@ var require_parser = __commonJS({
|
|
|
2007
2059
|
return ForBinding$0(state) || ForBinding$1(state);
|
|
2008
2060
|
}
|
|
2009
2061
|
}
|
|
2010
|
-
var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), Condition, CaseBlock);
|
|
2062
|
+
var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), NonIdContinue, Condition, CaseBlock);
|
|
2011
2063
|
function SwitchStatement(state) {
|
|
2012
2064
|
if (state.verbose)
|
|
2013
2065
|
console.log("ENTER:", "SwitchStatement");
|
|
@@ -2051,9 +2103,9 @@ var require_parser = __commonJS({
|
|
|
2051
2103
|
return NestedCaseClause$0(state);
|
|
2052
2104
|
}
|
|
2053
2105
|
}
|
|
2054
|
-
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);
|
|
2055
2107
|
var CaseClause$1 = $S(When, $Q(_), Expression, ImpliedColon, NestedBlockExpressions, InsertBreak);
|
|
2056
|
-
var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), ImpliedColon, NestedBlockExpressions);
|
|
2108
|
+
var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), NonIdContinue, ImpliedColon, NestedBlockExpressions);
|
|
2057
2109
|
function CaseClause(state) {
|
|
2058
2110
|
if (state.tokenize) {
|
|
2059
2111
|
return $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state));
|
|
@@ -2061,7 +2113,7 @@ var require_parser = __commonJS({
|
|
|
2061
2113
|
return CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state);
|
|
2062
2114
|
}
|
|
2063
2115
|
}
|
|
2064
|
-
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) {
|
|
2065
2117
|
return "case";
|
|
2066
2118
|
});
|
|
2067
2119
|
function When(state) {
|
|
@@ -2158,12 +2210,12 @@ var require_parser = __commonJS({
|
|
|
2158
2210
|
return ExpressionStatement$0(state);
|
|
2159
2211
|
}
|
|
2160
2212
|
}
|
|
2161
|
-
var KeywordStatement$0 = $EXPECT($L105, fail, 'KeywordStatement "break"');
|
|
2162
|
-
var KeywordStatement$1 = $EXPECT($L106, fail, 'KeywordStatement "continue"');
|
|
2163
|
-
var KeywordStatement$2 = $EXPECT($L107, fail, 'KeywordStatement "debugger"');
|
|
2164
|
-
var KeywordStatement$3 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), Expression);
|
|
2165
|
-
var KeywordStatement$4 = $EXPECT($L108, fail, 'KeywordStatement "return"');
|
|
2166
|
-
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);
|
|
2167
2219
|
function KeywordStatement(state) {
|
|
2168
2220
|
if (state.tokenize) {
|
|
2169
2221
|
return $TOKEN("KeywordStatement", state, KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state));
|
|
@@ -2171,11 +2223,11 @@ var require_parser = __commonJS({
|
|
|
2171
2223
|
return KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state);
|
|
2172
2224
|
}
|
|
2173
2225
|
}
|
|
2174
|
-
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) {
|
|
2175
2227
|
return { "ts": true, "children": value };
|
|
2176
2228
|
});
|
|
2177
|
-
var ImportDeclaration$1 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), __, ImportClause, __, FromClause);
|
|
2178
|
-
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);
|
|
2179
2231
|
function ImportDeclaration(state) {
|
|
2180
2232
|
if (state.tokenize) {
|
|
2181
2233
|
return $TOKEN("ImportDeclaration", state, ImportDeclaration$0(state) || ImportDeclaration$1(state) || ImportDeclaration$2(state));
|
|
@@ -2193,7 +2245,7 @@ var require_parser = __commonJS({
|
|
|
2193
2245
|
return ImportClause$0(state) || ImportClause$1(state) || ImportClause$2(state);
|
|
2194
2246
|
}
|
|
2195
2247
|
}
|
|
2196
|
-
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);
|
|
2197
2249
|
function NameSpaceImport(state) {
|
|
2198
2250
|
if (state.verbose)
|
|
2199
2251
|
console.log("ENTER:", "NameSpaceImport");
|
|
@@ -2213,7 +2265,7 @@ var require_parser = __commonJS({
|
|
|
2213
2265
|
return NamedImports$0(state);
|
|
2214
2266
|
}
|
|
2215
2267
|
}
|
|
2216
|
-
var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), __, ModuleSpecifier);
|
|
2268
|
+
var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), NonIdContinue, __, ModuleSpecifier);
|
|
2217
2269
|
function FromClause(state) {
|
|
2218
2270
|
if (state.verbose)
|
|
2219
2271
|
console.log("ENTER:", "FromClause");
|
|
@@ -2223,7 +2275,7 @@ var require_parser = __commonJS({
|
|
|
2223
2275
|
return FromClause$0(state);
|
|
2224
2276
|
}
|
|
2225
2277
|
}
|
|
2226
|
-
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);
|
|
2227
2279
|
var ImportSpecifier$1 = $S(__, ImportedBinding, ObjectPropertyDelimiter);
|
|
2228
2280
|
function ImportSpecifier(state) {
|
|
2229
2281
|
if (state.tokenize) {
|
|
@@ -2261,9 +2313,9 @@ var require_parser = __commonJS({
|
|
|
2261
2313
|
return ImportedBinding$0(state);
|
|
2262
2314
|
}
|
|
2263
2315
|
}
|
|
2264
|
-
var ExportDeclaration$0 = $S(
|
|
2265
|
-
var ExportDeclaration$1 = $S(
|
|
2266
|
-
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));
|
|
2267
2319
|
function ExportDeclaration(state) {
|
|
2268
2320
|
if (state.tokenize) {
|
|
2269
2321
|
return $TOKEN("ExportDeclaration", state, ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state));
|
|
@@ -2271,7 +2323,27 @@ var require_parser = __commonJS({
|
|
|
2271
2323
|
return ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state);
|
|
2272
2324
|
}
|
|
2273
2325
|
}
|
|
2274
|
-
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)));
|
|
2275
2347
|
var ExportFromClause$1 = NamedExports;
|
|
2276
2348
|
function ExportFromClause(state) {
|
|
2277
2349
|
if (state.tokenize) {
|
|
@@ -2688,7 +2760,7 @@ var require_parser = __commonJS({
|
|
|
2688
2760
|
return __$0(state);
|
|
2689
2761
|
}
|
|
2690
2762
|
}
|
|
2691
|
-
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($
|
|
2763
|
+
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L87, fail, 'StatementDelimiter ";"'), $Q(TrailingComment));
|
|
2692
2764
|
var StatementDelimiter$1 = $T($Y(EOS), function(value) {
|
|
2693
2765
|
return [";", value];
|
|
2694
2766
|
});
|
|
@@ -2933,7 +3005,7 @@ var require_parser = __commonJS({
|
|
|
2933
3005
|
return InterfaceProperty$0(state);
|
|
2934
3006
|
}
|
|
2935
3007
|
}
|
|
2936
|
-
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($
|
|
3008
|
+
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($L87, fail, 'InterfacePropertyDelimiter ";"'));
|
|
2937
3009
|
var InterfacePropertyDelimiter$1 = $Y($S($Q(_), $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"')));
|
|
2938
3010
|
var InterfacePropertyDelimiter$2 = $T($Y($S(__, $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"'))), function(value) {
|
|
2939
3011
|
return ";";
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export default interface Civet {
|
|
12
|
+
compile: typeof compile;
|
|
13
|
+
parse: typeof parse;
|
|
14
|
+
generate: typeof generate;
|
|
15
|
+
}
|
|
16
|
+
}
|