@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/README.md
CHANGED
|
@@ -5,11 +5,18 @@ Civet
|
|
|
5
5
|
|
|
6
6
|
A new CoffeeScript. Much closer to ES2015+ (for better or worse).
|
|
7
7
|
|
|
8
|
-
Also TypeScript, the sky is the limit.
|
|
8
|
+
Also TypeScript, the sky is the limit. [Online Civet Playground](https://civet-web.vercel.app/)
|
|
9
|
+
|
|
10
|
+
Quickstart Guide
|
|
11
|
+
---
|
|
9
12
|
|
|
10
13
|
```bash
|
|
14
|
+
# Install
|
|
11
15
|
npm install -g @danielx/civet
|
|
16
|
+
# Compile civet source file to typescript
|
|
12
17
|
civet < source.civet > output.ts
|
|
18
|
+
# Execute a civet source file in node
|
|
19
|
+
node --loader @danielx/civet/register.mjs source.civet
|
|
13
20
|
```
|
|
14
21
|
|
|
15
22
|

|
|
@@ -20,7 +27,7 @@ Code Sample
|
|
|
20
27
|
```typescript
|
|
21
28
|
import ts, {CompilerOptions} from "typescript"
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
DefaultCompilerOptions : CompilerOptions :=
|
|
24
31
|
allowNonTsExtensions: true
|
|
25
32
|
allowJs: true
|
|
26
33
|
target: ts.ScriptTarget.Latest
|
|
@@ -29,13 +36,13 @@ const DefaultCompilerOptions : CompilerOptions =
|
|
|
29
36
|
allowSyntheticDefaultImports: true
|
|
30
37
|
experimentalDecorators: true
|
|
31
38
|
|
|
32
|
-
|
|
39
|
+
fileCache : Record<string, any> := {}
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
createCompilerHost := (options: CompilerOptions, moduleSearchLocations : string[]) ->
|
|
42
|
+
fileExists := (fileName: string) : boolean ->
|
|
36
43
|
return fileCache[fileName]?
|
|
37
44
|
|
|
38
|
-
|
|
45
|
+
readFile := (fileName: string) ->
|
|
39
46
|
return fileCache[fileName]
|
|
40
47
|
```
|
|
41
48
|
|
|
@@ -46,6 +53,7 @@ Things Kept from CoffeeScript
|
|
|
46
53
|
- `or` -> `||`
|
|
47
54
|
- `and` -> `&&`
|
|
48
55
|
- `loop` -> `while(true)`
|
|
56
|
+
- `unless` conditional (without the `else`)
|
|
49
57
|
- Object literal syntax
|
|
50
58
|
```coffee
|
|
51
59
|
x =
|
|
@@ -60,25 +68,32 @@ Things Kept from CoffeeScript
|
|
|
60
68
|
- OptionalChain shorthand for index and function application `a?[b]` -> `a?.[b]`, `a?(b)` -> `a?.(b)`
|
|
61
69
|
- `@` -> `this`
|
|
62
70
|
- `@id` -> `this.id`
|
|
71
|
+
- Postfix `if/unless`
|
|
63
72
|
- JSX 😿
|
|
64
73
|
- TODO
|
|
65
74
|
- [ ] `"""` Strings (for compatibility with existing .coffee code)
|
|
66
|
-
- [ ] `///` Heregexp
|
|
67
75
|
- [ ] Chained comparisons
|
|
76
|
+
- [ ] `until`
|
|
77
|
+
- [ ] Prototype shorthand `X::` -> `X.prototype`, `X::a` -> `X.prototype.a`
|
|
68
78
|
|
|
69
79
|
Things Removed from CoffeeScript
|
|
70
80
|
---
|
|
71
81
|
|
|
72
|
-
- `on` (use `true`)
|
|
73
|
-
- `
|
|
82
|
+
- `on/yes/off/no` (use `true/false`)
|
|
83
|
+
- `isnt` (use `!==`)
|
|
84
|
+
- `not` (use `!`)
|
|
74
85
|
- `do` keyword (replaced with JS `do`)
|
|
75
86
|
- `for from` (use JS `for of`)
|
|
76
87
|
- Array slices `list[0...2]` (use `list.slice(0, 2)`)
|
|
88
|
+
- Slice assignment `numbers[3..6] = [-3, -4, -5, -6]`
|
|
77
89
|
- Comprensions (a case could be made for keeping them)
|
|
78
90
|
- Iteration expression results
|
|
79
91
|
- Implicit declarations
|
|
80
92
|
- Implicit returns (will probably add later)
|
|
81
93
|
- Rest parameter in any assignment position (might add later)
|
|
94
|
+
- Postfix `while/until`
|
|
95
|
+
- `///` Heregexp
|
|
96
|
+
- Embedded JS
|
|
82
97
|
|
|
83
98
|
Things Changed from CoffeeScript
|
|
84
99
|
---
|
|
@@ -89,10 +104,17 @@ Things Changed from CoffeeScript
|
|
|
89
104
|
- `a...` is now `...a` just like JS
|
|
90
105
|
- `x?.y` now compiles to `x?.y` rather than the `if typeof x !== 'undefined' && x !== null` if check
|
|
91
106
|
- Existential `x?` -> `(x != null)` no longer checks for undeclared variables.
|
|
107
|
+
- Embedded JS `\`\`` has been replaced with JS template literals.
|
|
108
|
+
- No longer allowing multiple postfix `if/unless` on the same line.
|
|
109
|
+
- No `else` block on `unless` (negate condition and use `if`)
|
|
110
|
+
- Civet tries to keep the transpiled output verbatim as much as possible.
|
|
111
|
+
In Coffee `(x)` -> `x;` but in Civet `(x)` -> `(x);`.
|
|
112
|
+
Also in Coffee `x + 3` -> `x + 3` but in Civet `x + 3` remains as is.
|
|
92
113
|
|
|
93
114
|
Things Added that CoffeeScript didn't
|
|
94
115
|
---
|
|
95
116
|
|
|
117
|
+
- TypeScript Types
|
|
96
118
|
- JS Compatability
|
|
97
119
|
- `var`, `let`, `const`
|
|
98
120
|
- JS Comment Syntax `//` and `/* */`
|
|
@@ -114,7 +136,6 @@ Things Added that CoffeeScript didn't
|
|
|
114
136
|
#!./node_modules/.bin/ts-node
|
|
115
137
|
console.log "hi"
|
|
116
138
|
```
|
|
117
|
-
- TypeScript Types
|
|
118
139
|
|
|
119
140
|
Things Changed from ES6
|
|
120
141
|
---
|
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,
|
|
@@ -536,6 +538,8 @@ var Civet = (() => {
|
|
|
536
538
|
ModuleSpecifier,
|
|
537
539
|
ImportedBinding,
|
|
538
540
|
ExportDeclaration,
|
|
541
|
+
As,
|
|
542
|
+
Export,
|
|
539
543
|
ExportFromClause,
|
|
540
544
|
NamedExports,
|
|
541
545
|
ExportSpecifier,
|
|
@@ -727,10 +731,10 @@ var Civet = (() => {
|
|
|
727
731
|
var $L82 = $L("delete");
|
|
728
732
|
var $L83 = $L("void");
|
|
729
733
|
var $L84 = $L("typeof");
|
|
730
|
-
var $L85 = $L("
|
|
731
|
-
var $L86 = $L("
|
|
732
|
-
var $L87 = $L("
|
|
733
|
-
var $L88 = $L("
|
|
734
|
+
var $L85 = $L("if");
|
|
735
|
+
var $L86 = $L("unless");
|
|
736
|
+
var $L87 = $L(";");
|
|
737
|
+
var $L88 = $L("else");
|
|
734
738
|
var $L89 = $L("loop");
|
|
735
739
|
var $L90 = $L("do");
|
|
736
740
|
var $L91 = $L("while");
|
|
@@ -1435,7 +1439,7 @@ var Civet = (() => {
|
|
|
1435
1439
|
return BracedBlock$0(state) || BracedBlock$1(state) || BracedBlock$2(state);
|
|
1436
1440
|
}
|
|
1437
1441
|
}
|
|
1438
|
-
var SingleNestedBlockExpression$0 = $TS($S(PushIndent, $E($S(Nested,
|
|
1442
|
+
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
1443
|
var exp = $2;
|
|
1440
1444
|
if (exp)
|
|
1441
1445
|
return exp;
|
|
@@ -1465,7 +1469,7 @@ var Civet = (() => {
|
|
|
1465
1469
|
return NestedBlockExpressions$0(state);
|
|
1466
1470
|
}
|
|
1467
1471
|
}
|
|
1468
|
-
var BlockExpression$0 = $S(Nested,
|
|
1472
|
+
var BlockExpression$0 = $S(Nested, StatementListItem, StatementDelimiter);
|
|
1469
1473
|
function BlockExpression(state) {
|
|
1470
1474
|
if (state.verbose)
|
|
1471
1475
|
console.log("ENTER:", "BlockExpression");
|
|
@@ -1875,13 +1879,45 @@ var Civet = (() => {
|
|
|
1875
1879
|
}
|
|
1876
1880
|
var ModuleItem$0 = ImportDeclaration;
|
|
1877
1881
|
var ModuleItem$1 = ExportDeclaration;
|
|
1878
|
-
var ModuleItem$2 =
|
|
1879
|
-
var ModuleItem$3 = Statement;
|
|
1882
|
+
var ModuleItem$2 = StatementListItem;
|
|
1880
1883
|
function ModuleItem(state) {
|
|
1881
1884
|
if (state.tokenize) {
|
|
1882
|
-
return $TOKEN("ModuleItem", state, ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state)
|
|
1885
|
+
return $TOKEN("ModuleItem", state, ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state));
|
|
1883
1886
|
} else {
|
|
1884
|
-
return ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state)
|
|
1887
|
+
return ModuleItem$0(state) || ModuleItem$1(state) || ModuleItem$2(state);
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
var StatementListItem$0 = $TS($S($C(Declaration, Statement), $E(PostfixConditional)), function($skip, $loc, $0, $1, $2) {
|
|
1891
|
+
var statement = $1;
|
|
1892
|
+
var cond = $2;
|
|
1893
|
+
if (cond)
|
|
1894
|
+
return [cond, statement, "}"];
|
|
1895
|
+
return $0;
|
|
1896
|
+
});
|
|
1897
|
+
function StatementListItem(state) {
|
|
1898
|
+
if (state.verbose)
|
|
1899
|
+
console.log("ENTER:", "StatementListItem");
|
|
1900
|
+
if (state.tokenize) {
|
|
1901
|
+
return $TOKEN("StatementListItem", state, StatementListItem$0(state));
|
|
1902
|
+
} else {
|
|
1903
|
+
return StatementListItem$0(state);
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
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) {
|
|
1907
|
+
var ws = $1;
|
|
1908
|
+
var cond = $2;
|
|
1909
|
+
var exp = $4;
|
|
1910
|
+
if (cond === "if")
|
|
1911
|
+
return [ws, "if(", exp, ") {"];
|
|
1912
|
+
return [ws, "if(!(", exp, ")) {"];
|
|
1913
|
+
});
|
|
1914
|
+
function PostfixConditional(state) {
|
|
1915
|
+
if (state.verbose)
|
|
1916
|
+
console.log("ENTER:", "PostfixConditional");
|
|
1917
|
+
if (state.tokenize) {
|
|
1918
|
+
return $TOKEN("PostfixConditional", state, PostfixConditional$0(state));
|
|
1919
|
+
} else {
|
|
1920
|
+
return PostfixConditional$0(state);
|
|
1885
1921
|
}
|
|
1886
1922
|
}
|
|
1887
1923
|
var Statement$0 = KeywordStatement;
|
|
@@ -1900,7 +1936,7 @@ var Civet = (() => {
|
|
|
1900
1936
|
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
1937
|
}
|
|
1902
1938
|
}
|
|
1903
|
-
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($
|
|
1939
|
+
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($L87, fail, 'EmptyStatement ";"')));
|
|
1904
1940
|
function EmptyStatement(state) {
|
|
1905
1941
|
if (state.verbose)
|
|
1906
1942
|
console.log("ENTER:", "EmptyStatement");
|
|
@@ -1920,8 +1956,8 @@ var Civet = (() => {
|
|
|
1920
1956
|
return BlockStatement$0(state);
|
|
1921
1957
|
}
|
|
1922
1958
|
}
|
|
1923
|
-
var IfStatement$0 = $S($EXPECT($
|
|
1924
|
-
var IfStatement$1 = $TS($S($EXPECT($
|
|
1959
|
+
var IfStatement$0 = $S($EXPECT($L85, fail, 'IfStatement "if"'), Condition, Block, $E($S(__, $EXPECT($L88, fail, 'IfStatement "else"'), Block)));
|
|
1960
|
+
var IfStatement$1 = $TS($S($EXPECT($L86, fail, 'IfStatement "unless"'), Condition, Block), function($skip, $loc, $0, $1, $2, $3) {
|
|
1925
1961
|
var condition = $2;
|
|
1926
1962
|
var block = $3;
|
|
1927
1963
|
return ["if", condition.map((c) => {
|
|
@@ -1951,8 +1987,8 @@ var Civet = (() => {
|
|
|
1951
1987
|
return IterationStatement$0(state) || IterationStatement$1(state) || IterationStatement$2(state) || IterationStatement$3(state) || IterationStatement$4(state);
|
|
1952
1988
|
}
|
|
1953
1989
|
}
|
|
1954
|
-
var LoopStatement$0 = $TS($S($EXPECT($L89, fail, 'LoopStatement "loop"'), Block), function($skip, $loc, $0, $1, $2) {
|
|
1955
|
-
var b = $
|
|
1990
|
+
var LoopStatement$0 = $TS($S($EXPECT($L89, fail, 'LoopStatement "loop"'), NonIdContinue, Block), function($skip, $loc, $0, $1, $2, $3) {
|
|
1991
|
+
var b = $3;
|
|
1956
1992
|
return ["while(true)", b];
|
|
1957
1993
|
});
|
|
1958
1994
|
function LoopStatement(state) {
|
|
@@ -1964,7 +2000,7 @@ var Civet = (() => {
|
|
|
1964
2000
|
return LoopStatement$0(state);
|
|
1965
2001
|
}
|
|
1966
2002
|
}
|
|
1967
|
-
var DoWhileStatement$0 = $S($EXPECT($L90, fail, 'DoWhileStatement "do"'), Block, __, $EXPECT($L91, fail, 'DoWhileStatement "while"'), Condition);
|
|
2003
|
+
var DoWhileStatement$0 = $S($EXPECT($L90, fail, 'DoWhileStatement "do"'), NonIdContinue, Block, __, $EXPECT($L91, fail, 'DoWhileStatement "while"'), Condition);
|
|
1968
2004
|
function DoWhileStatement(state) {
|
|
1969
2005
|
if (state.verbose)
|
|
1970
2006
|
console.log("ENTER:", "DoWhileStatement");
|
|
@@ -1974,7 +2010,7 @@ var Civet = (() => {
|
|
|
1974
2010
|
return DoWhileStatement$0(state);
|
|
1975
2011
|
}
|
|
1976
2012
|
}
|
|
1977
|
-
var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), Condition, Block);
|
|
2013
|
+
var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), NonIdContinue, Condition, Block);
|
|
1978
2014
|
function WhileStatement(state) {
|
|
1979
2015
|
if (state.verbose)
|
|
1980
2016
|
console.log("ENTER:", "WhileStatement");
|
|
@@ -1984,7 +2020,7 @@ var Civet = (() => {
|
|
|
1984
2020
|
return WhileStatement$0(state);
|
|
1985
2021
|
}
|
|
1986
2022
|
}
|
|
1987
|
-
var ForStatement$0 = $S($EXPECT($L92, fail, 'ForStatement "for"'), __, $EXPECT($L1, fail, 'ForStatement "("'), __, $C(LexicalDeclaration, VariableStatement, $E(Expression)), __, $EXPECT($
|
|
2023
|
+
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);
|
|
1988
2024
|
function ForStatement(state) {
|
|
1989
2025
|
if (state.verbose)
|
|
1990
2026
|
console.log("ENTER:", "ForStatement");
|
|
@@ -1994,10 +2030,10 @@ var Civet = (() => {
|
|
|
1994
2030
|
return ForStatement$0(state);
|
|
1995
2031
|
}
|
|
1996
2032
|
}
|
|
1997
|
-
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);
|
|
1998
|
-
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);
|
|
1999
|
-
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);
|
|
2000
|
-
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);
|
|
2033
|
+
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);
|
|
2034
|
+
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);
|
|
2035
|
+
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);
|
|
2036
|
+
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);
|
|
2001
2037
|
function ForInOfStatement(state) {
|
|
2002
2038
|
if (state.tokenize) {
|
|
2003
2039
|
return $TOKEN("ForInOfStatement", state, ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state));
|
|
@@ -2005,7 +2041,7 @@ var Civet = (() => {
|
|
|
2005
2041
|
return ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state);
|
|
2006
2042
|
}
|
|
2007
2043
|
}
|
|
2008
|
-
var ForDeclaration$0 = $S($C($EXPECT($L96, fail, 'ForDeclaration "let"'), $EXPECT($L97, fail, 'ForDeclaration "const"')), __, ForBinding);
|
|
2044
|
+
var ForDeclaration$0 = $S($C($EXPECT($L96, fail, 'ForDeclaration "let"'), $EXPECT($L97, fail, 'ForDeclaration "const"')), NonIdContinue, __, ForBinding);
|
|
2009
2045
|
function ForDeclaration(state) {
|
|
2010
2046
|
if (state.verbose)
|
|
2011
2047
|
console.log("ENTER:", "ForDeclaration");
|
|
@@ -2024,7 +2060,7 @@ var Civet = (() => {
|
|
|
2024
2060
|
return ForBinding$0(state) || ForBinding$1(state);
|
|
2025
2061
|
}
|
|
2026
2062
|
}
|
|
2027
|
-
var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), Condition, CaseBlock);
|
|
2063
|
+
var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), NonIdContinue, Condition, CaseBlock);
|
|
2028
2064
|
function SwitchStatement(state) {
|
|
2029
2065
|
if (state.verbose)
|
|
2030
2066
|
console.log("ENTER:", "SwitchStatement");
|
|
@@ -2068,9 +2104,9 @@ var Civet = (() => {
|
|
|
2068
2104
|
return NestedCaseClause$0(state);
|
|
2069
2105
|
}
|
|
2070
2106
|
}
|
|
2071
|
-
var CaseClause$0 = $S($EXPECT($L99, fail, 'CaseClause "case"'), $Q(_), Expression, ImpliedColon, NestedBlockExpressions);
|
|
2107
|
+
var CaseClause$0 = $S($EXPECT($L99, fail, 'CaseClause "case"'), NonIdContinue, $Q(_), Expression, ImpliedColon, NestedBlockExpressions);
|
|
2072
2108
|
var CaseClause$1 = $S(When, $Q(_), Expression, ImpliedColon, NestedBlockExpressions, InsertBreak);
|
|
2073
|
-
var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), ImpliedColon, NestedBlockExpressions);
|
|
2109
|
+
var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), NonIdContinue, ImpliedColon, NestedBlockExpressions);
|
|
2074
2110
|
function CaseClause(state) {
|
|
2075
2111
|
if (state.tokenize) {
|
|
2076
2112
|
return $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state));
|
|
@@ -2078,7 +2114,7 @@ var Civet = (() => {
|
|
|
2078
2114
|
return CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state);
|
|
2079
2115
|
}
|
|
2080
2116
|
}
|
|
2081
|
-
var When$0 = $T($EXPECT($L101, fail, 'When "when"'), function(value) {
|
|
2117
|
+
var When$0 = $T($S($EXPECT($L101, fail, 'When "when"'), NonIdContinue), function(value) {
|
|
2082
2118
|
return "case";
|
|
2083
2119
|
});
|
|
2084
2120
|
function When(state) {
|
|
@@ -2175,12 +2211,12 @@ var Civet = (() => {
|
|
|
2175
2211
|
return ExpressionStatement$0(state);
|
|
2176
2212
|
}
|
|
2177
2213
|
}
|
|
2178
|
-
var KeywordStatement$0 = $EXPECT($L105, fail, 'KeywordStatement "break"');
|
|
2179
|
-
var KeywordStatement$1 = $EXPECT($L106, fail, 'KeywordStatement "continue"');
|
|
2180
|
-
var KeywordStatement$2 = $EXPECT($L107, fail, 'KeywordStatement "debugger"');
|
|
2181
|
-
var KeywordStatement$3 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), Expression);
|
|
2182
|
-
var KeywordStatement$4 = $EXPECT($L108, fail, 'KeywordStatement "return"');
|
|
2183
|
-
var KeywordStatement$5 = $S($EXPECT($L109, fail, 'KeywordStatement "throw"'), Expression);
|
|
2214
|
+
var KeywordStatement$0 = $S($EXPECT($L105, fail, 'KeywordStatement "break"'), NonIdContinue);
|
|
2215
|
+
var KeywordStatement$1 = $S($EXPECT($L106, fail, 'KeywordStatement "continue"'), NonIdContinue);
|
|
2216
|
+
var KeywordStatement$2 = $S($EXPECT($L107, fail, 'KeywordStatement "debugger"'), NonIdContinue);
|
|
2217
|
+
var KeywordStatement$3 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), NonIdContinue, Expression);
|
|
2218
|
+
var KeywordStatement$4 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), NonIdContinue);
|
|
2219
|
+
var KeywordStatement$5 = $S($EXPECT($L109, fail, 'KeywordStatement "throw"'), NonIdContinue, Expression);
|
|
2184
2220
|
function KeywordStatement(state) {
|
|
2185
2221
|
if (state.tokenize) {
|
|
2186
2222
|
return $TOKEN("KeywordStatement", state, KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state));
|
|
@@ -2188,11 +2224,11 @@ var Civet = (() => {
|
|
|
2188
2224
|
return KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state);
|
|
2189
2225
|
}
|
|
2190
2226
|
}
|
|
2191
|
-
var ImportDeclaration$0 = $T($S($EXPECT($L110, fail, 'ImportDeclaration "import type"'), __, ImportClause, __, FromClause), function(value) {
|
|
2227
|
+
var ImportDeclaration$0 = $T($S($EXPECT($L110, fail, 'ImportDeclaration "import type"'), NonIdContinue, __, ImportClause, __, FromClause), function(value) {
|
|
2192
2228
|
return { "ts": true, "children": value };
|
|
2193
2229
|
});
|
|
2194
|
-
var ImportDeclaration$1 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), __, ImportClause, __, FromClause);
|
|
2195
|
-
var ImportDeclaration$2 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), __, ModuleSpecifier);
|
|
2230
|
+
var ImportDeclaration$1 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), NonIdContinue, __, ImportClause, __, FromClause);
|
|
2231
|
+
var ImportDeclaration$2 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), NonIdContinue, __, ModuleSpecifier);
|
|
2196
2232
|
function ImportDeclaration(state) {
|
|
2197
2233
|
if (state.tokenize) {
|
|
2198
2234
|
return $TOKEN("ImportDeclaration", state, ImportDeclaration$0(state) || ImportDeclaration$1(state) || ImportDeclaration$2(state));
|
|
@@ -2210,7 +2246,7 @@ var Civet = (() => {
|
|
|
2210
2246
|
return ImportClause$0(state) || ImportClause$1(state) || ImportClause$2(state);
|
|
2211
2247
|
}
|
|
2212
2248
|
}
|
|
2213
|
-
var NameSpaceImport$0 = $S($EXPECT($L9, fail, 'NameSpaceImport "*"'), __, $EXPECT($L4, fail, 'NameSpaceImport "as"'), __, ImportedBinding);
|
|
2249
|
+
var NameSpaceImport$0 = $S($EXPECT($L9, fail, 'NameSpaceImport "*"'), __, $EXPECT($L4, fail, 'NameSpaceImport "as"'), NonIdContinue, __, ImportedBinding);
|
|
2214
2250
|
function NameSpaceImport(state) {
|
|
2215
2251
|
if (state.verbose)
|
|
2216
2252
|
console.log("ENTER:", "NameSpaceImport");
|
|
@@ -2230,7 +2266,7 @@ var Civet = (() => {
|
|
|
2230
2266
|
return NamedImports$0(state);
|
|
2231
2267
|
}
|
|
2232
2268
|
}
|
|
2233
|
-
var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), __, ModuleSpecifier);
|
|
2269
|
+
var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), NonIdContinue, __, ModuleSpecifier);
|
|
2234
2270
|
function FromClause(state) {
|
|
2235
2271
|
if (state.verbose)
|
|
2236
2272
|
console.log("ENTER:", "FromClause");
|
|
@@ -2240,7 +2276,7 @@ var Civet = (() => {
|
|
|
2240
2276
|
return FromClause$0(state);
|
|
2241
2277
|
}
|
|
2242
2278
|
}
|
|
2243
|
-
var ImportSpecifier$0 = $S(__, ModuleExportName, __, $EXPECT($L4, fail, 'ImportSpecifier "as"'), __, ImportedBinding, ObjectPropertyDelimiter);
|
|
2279
|
+
var ImportSpecifier$0 = $S(__, ModuleExportName, __, $EXPECT($L4, fail, 'ImportSpecifier "as"'), NonIdContinue, __, ImportedBinding, ObjectPropertyDelimiter);
|
|
2244
2280
|
var ImportSpecifier$1 = $S(__, ImportedBinding, ObjectPropertyDelimiter);
|
|
2245
2281
|
function ImportSpecifier(state) {
|
|
2246
2282
|
if (state.tokenize) {
|
|
@@ -2278,9 +2314,9 @@ var Civet = (() => {
|
|
|
2278
2314
|
return ImportedBinding$0(state);
|
|
2279
2315
|
}
|
|
2280
2316
|
}
|
|
2281
|
-
var ExportDeclaration$0 = $S(
|
|
2282
|
-
var ExportDeclaration$1 = $S(
|
|
2283
|
-
var ExportDeclaration$2 = $S(
|
|
2317
|
+
var ExportDeclaration$0 = $S(Export, __, $EXPECT($L100, fail, 'ExportDeclaration "default"'), NonIdContinue, __, $C(HoistableDeclaration, ClassDeclaration, AssignmentExpression));
|
|
2318
|
+
var ExportDeclaration$1 = $S(Export, __, ExportFromClause, __, FromClause);
|
|
2319
|
+
var ExportDeclaration$2 = $S(Export, __, $C(NamedExports, VariableStatement, Declaration));
|
|
2284
2320
|
function ExportDeclaration(state) {
|
|
2285
2321
|
if (state.tokenize) {
|
|
2286
2322
|
return $TOKEN("ExportDeclaration", state, ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state));
|
|
@@ -2288,7 +2324,27 @@ var Civet = (() => {
|
|
|
2288
2324
|
return ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state);
|
|
2289
2325
|
}
|
|
2290
2326
|
}
|
|
2291
|
-
var
|
|
2327
|
+
var As$0 = $S($EXPECT($L4, fail, 'As "as"'), NonIdContinue);
|
|
2328
|
+
function As(state) {
|
|
2329
|
+
if (state.verbose)
|
|
2330
|
+
console.log("ENTER:", "As");
|
|
2331
|
+
if (state.tokenize) {
|
|
2332
|
+
return $TOKEN("As", state, As$0(state));
|
|
2333
|
+
} else {
|
|
2334
|
+
return As$0(state);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
var Export$0 = $S($EXPECT($L112, fail, 'Export "export"'), NonIdContinue);
|
|
2338
|
+
function Export(state) {
|
|
2339
|
+
if (state.verbose)
|
|
2340
|
+
console.log("ENTER:", "Export");
|
|
2341
|
+
if (state.tokenize) {
|
|
2342
|
+
return $TOKEN("Export", state, Export$0(state));
|
|
2343
|
+
} else {
|
|
2344
|
+
return Export$0(state);
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
var ExportFromClause$0 = $S($EXPECT($L9, fail, 'ExportFromClause "*"'), $E($S(__, $EXPECT($L4, fail, 'ExportFromClause "as"'), NonIdContinue, __, ModuleExportName)));
|
|
2292
2348
|
var ExportFromClause$1 = NamedExports;
|
|
2293
2349
|
function ExportFromClause(state) {
|
|
2294
2350
|
if (state.tokenize) {
|
|
@@ -2705,7 +2761,7 @@ var Civet = (() => {
|
|
|
2705
2761
|
return __$0(state);
|
|
2706
2762
|
}
|
|
2707
2763
|
}
|
|
2708
|
-
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($
|
|
2764
|
+
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L87, fail, 'StatementDelimiter ";"'), $Q(TrailingComment));
|
|
2709
2765
|
var StatementDelimiter$1 = $T($Y(EOS), function(value) {
|
|
2710
2766
|
return [";", value];
|
|
2711
2767
|
});
|
|
@@ -2950,7 +3006,7 @@ var Civet = (() => {
|
|
|
2950
3006
|
return InterfaceProperty$0(state);
|
|
2951
3007
|
}
|
|
2952
3008
|
}
|
|
2953
|
-
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($
|
|
3009
|
+
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($L87, fail, 'InterfacePropertyDelimiter ";"'));
|
|
2954
3010
|
var InterfacePropertyDelimiter$1 = $Y($S($Q(_), $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"')));
|
|
2955
3011
|
var InterfacePropertyDelimiter$2 = $T($Y($S(__, $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"'))), function(value) {
|
|
2956
3012
|
return ";";
|