@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/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,4 +136,11 @@ Things Added that CoffeeScript didn't
|
|
|
114
136
|
#!./node_modules/.bin/ts-node
|
|
115
137
|
console.log "hi"
|
|
116
138
|
```
|
|
117
|
-
|
|
139
|
+
|
|
140
|
+
Things Changed from ES6
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
- Disallow no parens on single argument arrow function. `x => ...` must become `(x) => ...`
|
|
144
|
+
The reasoning is `x -> ` => `x(function() ...)` in CoffeeScript and having `->` and `=>`
|
|
145
|
+
behave more differently than they already do is bad. Passing an anonymous function to an
|
|
146
|
+
application without parens is also convenient.
|
package/dist/browser.js
CHANGED
|
@@ -421,6 +421,7 @@ var Civet = (() => {
|
|
|
421
421
|
AssignmentExpressionRest,
|
|
422
422
|
YieldExpression,
|
|
423
423
|
ArrowFunction,
|
|
424
|
+
FatArrow,
|
|
424
425
|
ConciseBody,
|
|
425
426
|
ConditionalExpression,
|
|
426
427
|
ShortCircuitExpression,
|
|
@@ -498,6 +499,8 @@ var Civet = (() => {
|
|
|
498
499
|
BinaryOp,
|
|
499
500
|
UnaryOp,
|
|
500
501
|
ModuleItem,
|
|
502
|
+
StatementListItem,
|
|
503
|
+
PostfixConditional,
|
|
501
504
|
Statement,
|
|
502
505
|
EmptyStatement,
|
|
503
506
|
BlockStatement,
|
|
@@ -535,6 +538,8 @@ var Civet = (() => {
|
|
|
535
538
|
ModuleSpecifier,
|
|
536
539
|
ImportedBinding,
|
|
537
540
|
ExportDeclaration,
|
|
541
|
+
As,
|
|
542
|
+
Export,
|
|
538
543
|
ExportFromClause,
|
|
539
544
|
NamedExports,
|
|
540
545
|
ExportSpecifier,
|
|
@@ -726,10 +731,10 @@ var Civet = (() => {
|
|
|
726
731
|
var $L82 = $L("delete");
|
|
727
732
|
var $L83 = $L("void");
|
|
728
733
|
var $L84 = $L("typeof");
|
|
729
|
-
var $L85 = $L("
|
|
730
|
-
var $L86 = $L("
|
|
731
|
-
var $L87 = $L("
|
|
732
|
-
var $L88 = $L("
|
|
734
|
+
var $L85 = $L("if");
|
|
735
|
+
var $L86 = $L("unless");
|
|
736
|
+
var $L87 = $L(";");
|
|
737
|
+
var $L88 = $L("else");
|
|
733
738
|
var $L89 = $L("loop");
|
|
734
739
|
var $L90 = $L("do");
|
|
735
740
|
var $L91 = $L("while");
|
|
@@ -951,7 +956,7 @@ var Civet = (() => {
|
|
|
951
956
|
}
|
|
952
957
|
var AssignmentExpressionRest$0 = YieldExpression;
|
|
953
958
|
var AssignmentExpressionRest$1 = $S($E($S($EXPECT($L7, fail, 'AssignmentExpressionRest "async"'), __)), ArrowFunction);
|
|
954
|
-
var AssignmentExpressionRest$2 = $S($P($S(__, LeftHandSideExpression, __, AssignmentOp)),
|
|
959
|
+
var AssignmentExpressionRest$2 = $S($P($S(__, LeftHandSideExpression, __, AssignmentOp)), Expression);
|
|
955
960
|
var AssignmentExpressionRest$3 = ConditionalExpression;
|
|
956
961
|
function AssignmentExpressionRest(state) {
|
|
957
962
|
if (state.tokenize) {
|
|
@@ -971,7 +976,7 @@ var Civet = (() => {
|
|
|
971
976
|
}
|
|
972
977
|
}
|
|
973
978
|
var ArrowFunction$0 = ThinArrowFunction;
|
|
974
|
-
var ArrowFunction$1 = $S(
|
|
979
|
+
var ArrowFunction$1 = $S(Parameters, $E(ReturnTypeSuffix), FatArrow, ConciseBody);
|
|
975
980
|
function ArrowFunction(state) {
|
|
976
981
|
if (state.tokenize) {
|
|
977
982
|
return $TOKEN("ArrowFunction", state, ArrowFunction$0(state) || ArrowFunction$1(state));
|
|
@@ -979,8 +984,23 @@ var Civet = (() => {
|
|
|
979
984
|
return ArrowFunction$0(state) || ArrowFunction$1(state);
|
|
980
985
|
}
|
|
981
986
|
}
|
|
982
|
-
var
|
|
983
|
-
|
|
987
|
+
var FatArrow$0 = $TS($S(__, $EXPECT($L10, fail, 'FatArrow "=>"')), function($skip, $loc, $0, $1, $2) {
|
|
988
|
+
var ws = $1;
|
|
989
|
+
if (!ws.length)
|
|
990
|
+
return " =>";
|
|
991
|
+
return $0;
|
|
992
|
+
});
|
|
993
|
+
function FatArrow(state) {
|
|
994
|
+
if (state.verbose)
|
|
995
|
+
console.log("ENTER:", "FatArrow");
|
|
996
|
+
if (state.tokenize) {
|
|
997
|
+
return $TOKEN("FatArrow", state, FatArrow$0(state));
|
|
998
|
+
} else {
|
|
999
|
+
return FatArrow$0(state);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
var ConciseBody$0 = $S(EOS, SingleNestedBlockExpression);
|
|
1003
|
+
var ConciseBody$1 = $S($N($S($Q(_), $EXPECT($L11, fail, 'ConciseBody "{"'))), AssignmentExpression);
|
|
984
1004
|
var ConciseBody$2 = BracedBlock;
|
|
985
1005
|
function ConciseBody(state) {
|
|
986
1006
|
if (state.tokenize) {
|
|
@@ -1419,7 +1439,7 @@ var Civet = (() => {
|
|
|
1419
1439
|
return BracedBlock$0(state) || BracedBlock$1(state) || BracedBlock$2(state);
|
|
1420
1440
|
}
|
|
1421
1441
|
}
|
|
1422
|
-
var SingleNestedBlockExpression$0 = $TS($S(PushIndent, $E($S(Nested, $C(
|
|
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) {
|
|
1423
1443
|
var exp = $2;
|
|
1424
1444
|
if (exp)
|
|
1425
1445
|
return exp;
|
|
@@ -1449,7 +1469,7 @@ var Civet = (() => {
|
|
|
1449
1469
|
return NestedBlockExpressions$0(state);
|
|
1450
1470
|
}
|
|
1451
1471
|
}
|
|
1452
|
-
var BlockExpression$0 = $S(Nested,
|
|
1472
|
+
var BlockExpression$0 = $S(Nested, StatementListItem, StatementDelimiter);
|
|
1453
1473
|
function BlockExpression(state) {
|
|
1454
1474
|
if (state.verbose)
|
|
1455
1475
|
console.log("ENTER:", "BlockExpression");
|
|
@@ -1859,13 +1879,45 @@ var Civet = (() => {
|
|
|
1859
1879
|
}
|
|
1860
1880
|
var ModuleItem$0 = ImportDeclaration;
|
|
1861
1881
|
var ModuleItem$1 = ExportDeclaration;
|
|
1862
|
-
var ModuleItem$2 =
|
|
1863
|
-
var ModuleItem$3 = Statement;
|
|
1882
|
+
var ModuleItem$2 = StatementListItem;
|
|
1864
1883
|
function ModuleItem(state) {
|
|
1865
1884
|
if (state.tokenize) {
|
|
1866
|
-
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));
|
|
1886
|
+
} else {
|
|
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));
|
|
1867
1919
|
} else {
|
|
1868
|
-
return
|
|
1920
|
+
return PostfixConditional$0(state);
|
|
1869
1921
|
}
|
|
1870
1922
|
}
|
|
1871
1923
|
var Statement$0 = KeywordStatement;
|
|
@@ -1884,7 +1936,7 @@ var Civet = (() => {
|
|
|
1884
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);
|
|
1885
1937
|
}
|
|
1886
1938
|
}
|
|
1887
|
-
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($
|
|
1939
|
+
var EmptyStatement$0 = $S($Q(TrailingComment), $Y($EXPECT($L87, fail, 'EmptyStatement ";"')));
|
|
1888
1940
|
function EmptyStatement(state) {
|
|
1889
1941
|
if (state.verbose)
|
|
1890
1942
|
console.log("ENTER:", "EmptyStatement");
|
|
@@ -1904,8 +1956,8 @@ var Civet = (() => {
|
|
|
1904
1956
|
return BlockStatement$0(state);
|
|
1905
1957
|
}
|
|
1906
1958
|
}
|
|
1907
|
-
var IfStatement$0 = $S($EXPECT($
|
|
1908
|
-
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) {
|
|
1909
1961
|
var condition = $2;
|
|
1910
1962
|
var block = $3;
|
|
1911
1963
|
return ["if", condition.map((c) => {
|
|
@@ -1935,8 +1987,8 @@ var Civet = (() => {
|
|
|
1935
1987
|
return IterationStatement$0(state) || IterationStatement$1(state) || IterationStatement$2(state) || IterationStatement$3(state) || IterationStatement$4(state);
|
|
1936
1988
|
}
|
|
1937
1989
|
}
|
|
1938
|
-
var LoopStatement$0 = $TS($S($EXPECT($L89, fail, 'LoopStatement "loop"'), Block), function($skip, $loc, $0, $1, $2) {
|
|
1939
|
-
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;
|
|
1940
1992
|
return ["while(true)", b];
|
|
1941
1993
|
});
|
|
1942
1994
|
function LoopStatement(state) {
|
|
@@ -1948,7 +2000,7 @@ var Civet = (() => {
|
|
|
1948
2000
|
return LoopStatement$0(state);
|
|
1949
2001
|
}
|
|
1950
2002
|
}
|
|
1951
|
-
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);
|
|
1952
2004
|
function DoWhileStatement(state) {
|
|
1953
2005
|
if (state.verbose)
|
|
1954
2006
|
console.log("ENTER:", "DoWhileStatement");
|
|
@@ -1958,7 +2010,7 @@ var Civet = (() => {
|
|
|
1958
2010
|
return DoWhileStatement$0(state);
|
|
1959
2011
|
}
|
|
1960
2012
|
}
|
|
1961
|
-
var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), Condition, Block);
|
|
2013
|
+
var WhileStatement$0 = $S($EXPECT($L91, fail, 'WhileStatement "while"'), NonIdContinue, Condition, Block);
|
|
1962
2014
|
function WhileStatement(state) {
|
|
1963
2015
|
if (state.verbose)
|
|
1964
2016
|
console.log("ENTER:", "WhileStatement");
|
|
@@ -1968,7 +2020,7 @@ var Civet = (() => {
|
|
|
1968
2020
|
return WhileStatement$0(state);
|
|
1969
2021
|
}
|
|
1970
2022
|
}
|
|
1971
|
-
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);
|
|
1972
2024
|
function ForStatement(state) {
|
|
1973
2025
|
if (state.verbose)
|
|
1974
2026
|
console.log("ENTER:", "ForStatement");
|
|
@@ -1978,10 +2030,10 @@ var Civet = (() => {
|
|
|
1978
2030
|
return ForStatement$0(state);
|
|
1979
2031
|
}
|
|
1980
2032
|
}
|
|
1981
|
-
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);
|
|
1982
|
-
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);
|
|
1983
|
-
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);
|
|
1984
|
-
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);
|
|
1985
2037
|
function ForInOfStatement(state) {
|
|
1986
2038
|
if (state.tokenize) {
|
|
1987
2039
|
return $TOKEN("ForInOfStatement", state, ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state));
|
|
@@ -1989,7 +2041,7 @@ var Civet = (() => {
|
|
|
1989
2041
|
return ForInOfStatement$0(state) || ForInOfStatement$1(state) || ForInOfStatement$2(state) || ForInOfStatement$3(state);
|
|
1990
2042
|
}
|
|
1991
2043
|
}
|
|
1992
|
-
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);
|
|
1993
2045
|
function ForDeclaration(state) {
|
|
1994
2046
|
if (state.verbose)
|
|
1995
2047
|
console.log("ENTER:", "ForDeclaration");
|
|
@@ -2008,7 +2060,7 @@ var Civet = (() => {
|
|
|
2008
2060
|
return ForBinding$0(state) || ForBinding$1(state);
|
|
2009
2061
|
}
|
|
2010
2062
|
}
|
|
2011
|
-
var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), Condition, CaseBlock);
|
|
2063
|
+
var SwitchStatement$0 = $S($EXPECT($L98, fail, 'SwitchStatement "switch"'), NonIdContinue, Condition, CaseBlock);
|
|
2012
2064
|
function SwitchStatement(state) {
|
|
2013
2065
|
if (state.verbose)
|
|
2014
2066
|
console.log("ENTER:", "SwitchStatement");
|
|
@@ -2052,9 +2104,9 @@ var Civet = (() => {
|
|
|
2052
2104
|
return NestedCaseClause$0(state);
|
|
2053
2105
|
}
|
|
2054
2106
|
}
|
|
2055
|
-
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);
|
|
2056
2108
|
var CaseClause$1 = $S(When, $Q(_), Expression, ImpliedColon, NestedBlockExpressions, InsertBreak);
|
|
2057
|
-
var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), ImpliedColon, NestedBlockExpressions);
|
|
2109
|
+
var CaseClause$2 = $S($EXPECT($L100, fail, 'CaseClause "default"'), NonIdContinue, ImpliedColon, NestedBlockExpressions);
|
|
2058
2110
|
function CaseClause(state) {
|
|
2059
2111
|
if (state.tokenize) {
|
|
2060
2112
|
return $TOKEN("CaseClause", state, CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state));
|
|
@@ -2062,7 +2114,7 @@ var Civet = (() => {
|
|
|
2062
2114
|
return CaseClause$0(state) || CaseClause$1(state) || CaseClause$2(state);
|
|
2063
2115
|
}
|
|
2064
2116
|
}
|
|
2065
|
-
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) {
|
|
2066
2118
|
return "case";
|
|
2067
2119
|
});
|
|
2068
2120
|
function When(state) {
|
|
@@ -2159,12 +2211,12 @@ var Civet = (() => {
|
|
|
2159
2211
|
return ExpressionStatement$0(state);
|
|
2160
2212
|
}
|
|
2161
2213
|
}
|
|
2162
|
-
var KeywordStatement$0 = $EXPECT($L105, fail, 'KeywordStatement "break"');
|
|
2163
|
-
var KeywordStatement$1 = $EXPECT($L106, fail, 'KeywordStatement "continue"');
|
|
2164
|
-
var KeywordStatement$2 = $EXPECT($L107, fail, 'KeywordStatement "debugger"');
|
|
2165
|
-
var KeywordStatement$3 = $S($EXPECT($L108, fail, 'KeywordStatement "return"'), Expression);
|
|
2166
|
-
var KeywordStatement$4 = $EXPECT($L108, fail, 'KeywordStatement "return"');
|
|
2167
|
-
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);
|
|
2168
2220
|
function KeywordStatement(state) {
|
|
2169
2221
|
if (state.tokenize) {
|
|
2170
2222
|
return $TOKEN("KeywordStatement", state, KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state));
|
|
@@ -2172,11 +2224,11 @@ var Civet = (() => {
|
|
|
2172
2224
|
return KeywordStatement$0(state) || KeywordStatement$1(state) || KeywordStatement$2(state) || KeywordStatement$3(state) || KeywordStatement$4(state) || KeywordStatement$5(state);
|
|
2173
2225
|
}
|
|
2174
2226
|
}
|
|
2175
|
-
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) {
|
|
2176
2228
|
return { "ts": true, "children": value };
|
|
2177
2229
|
});
|
|
2178
|
-
var ImportDeclaration$1 = $S($EXPECT($L23, fail, 'ImportDeclaration "import"'), __, ImportClause, __, FromClause);
|
|
2179
|
-
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);
|
|
2180
2232
|
function ImportDeclaration(state) {
|
|
2181
2233
|
if (state.tokenize) {
|
|
2182
2234
|
return $TOKEN("ImportDeclaration", state, ImportDeclaration$0(state) || ImportDeclaration$1(state) || ImportDeclaration$2(state));
|
|
@@ -2194,7 +2246,7 @@ var Civet = (() => {
|
|
|
2194
2246
|
return ImportClause$0(state) || ImportClause$1(state) || ImportClause$2(state);
|
|
2195
2247
|
}
|
|
2196
2248
|
}
|
|
2197
|
-
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);
|
|
2198
2250
|
function NameSpaceImport(state) {
|
|
2199
2251
|
if (state.verbose)
|
|
2200
2252
|
console.log("ENTER:", "NameSpaceImport");
|
|
@@ -2214,7 +2266,7 @@ var Civet = (() => {
|
|
|
2214
2266
|
return NamedImports$0(state);
|
|
2215
2267
|
}
|
|
2216
2268
|
}
|
|
2217
|
-
var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), __, ModuleSpecifier);
|
|
2269
|
+
var FromClause$0 = $S($EXPECT($L111, fail, 'FromClause "from"'), NonIdContinue, __, ModuleSpecifier);
|
|
2218
2270
|
function FromClause(state) {
|
|
2219
2271
|
if (state.verbose)
|
|
2220
2272
|
console.log("ENTER:", "FromClause");
|
|
@@ -2224,7 +2276,7 @@ var Civet = (() => {
|
|
|
2224
2276
|
return FromClause$0(state);
|
|
2225
2277
|
}
|
|
2226
2278
|
}
|
|
2227
|
-
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);
|
|
2228
2280
|
var ImportSpecifier$1 = $S(__, ImportedBinding, ObjectPropertyDelimiter);
|
|
2229
2281
|
function ImportSpecifier(state) {
|
|
2230
2282
|
if (state.tokenize) {
|
|
@@ -2262,9 +2314,9 @@ var Civet = (() => {
|
|
|
2262
2314
|
return ImportedBinding$0(state);
|
|
2263
2315
|
}
|
|
2264
2316
|
}
|
|
2265
|
-
var ExportDeclaration$0 = $S(
|
|
2266
|
-
var ExportDeclaration$1 = $S(
|
|
2267
|
-
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));
|
|
2268
2320
|
function ExportDeclaration(state) {
|
|
2269
2321
|
if (state.tokenize) {
|
|
2270
2322
|
return $TOKEN("ExportDeclaration", state, ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state));
|
|
@@ -2272,7 +2324,27 @@ var Civet = (() => {
|
|
|
2272
2324
|
return ExportDeclaration$0(state) || ExportDeclaration$1(state) || ExportDeclaration$2(state);
|
|
2273
2325
|
}
|
|
2274
2326
|
}
|
|
2275
|
-
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)));
|
|
2276
2348
|
var ExportFromClause$1 = NamedExports;
|
|
2277
2349
|
function ExportFromClause(state) {
|
|
2278
2350
|
if (state.tokenize) {
|
|
@@ -2689,7 +2761,7 @@ var Civet = (() => {
|
|
|
2689
2761
|
return __$0(state);
|
|
2690
2762
|
}
|
|
2691
2763
|
}
|
|
2692
|
-
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($
|
|
2764
|
+
var StatementDelimiter$0 = $S($Q(TrailingComment), $EXPECT($L87, fail, 'StatementDelimiter ";"'), $Q(TrailingComment));
|
|
2693
2765
|
var StatementDelimiter$1 = $T($Y(EOS), function(value) {
|
|
2694
2766
|
return [";", value];
|
|
2695
2767
|
});
|
|
@@ -2934,7 +3006,7 @@ var Civet = (() => {
|
|
|
2934
3006
|
return InterfaceProperty$0(state);
|
|
2935
3007
|
}
|
|
2936
3008
|
}
|
|
2937
|
-
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($
|
|
3009
|
+
var InterfacePropertyDelimiter$0 = $S($Q(_), $EXPECT($L87, fail, 'InterfacePropertyDelimiter ";"'));
|
|
2938
3010
|
var InterfacePropertyDelimiter$1 = $Y($S($Q(_), $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"')));
|
|
2939
3011
|
var InterfacePropertyDelimiter$2 = $T($Y($S(__, $EXPECT($L16, fail, 'InterfacePropertyDelimiter "}"'))), function(value) {
|
|
2940
3012
|
return ";";
|