@danielx/civet 0.4.25 → 0.4.27
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 +2 -2
- package/dist/browser.js +10 -7
- package/dist/main.js +10 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -118,13 +118,11 @@ Civet.
|
|
|
118
118
|
- `for ... when <condition>` (use `continue if exp` inside loop, `"civet coffeeCompat"`, or `"civet coffeeForLoops"`)
|
|
119
119
|
- `a ? b` (use `a ?? b`, though it doesn't check for undeclared variables, `"civet coffeeCompat"`, or `"civet coffeeBinaryExistential"` enables this at the cost of losing JS ternary operator)
|
|
120
120
|
- `a of b` (use `a in b` matching JS, or `"civet coffeeCompat"`, or `"civet coffeeOf"`)
|
|
121
|
-
- Iteration expression results
|
|
122
121
|
- Backtick embedded JS (replaced by template literals)
|
|
123
122
|
- Will likely add later
|
|
124
123
|
- Optional assignment `x?.y = 3` -> `x != null ? x.y = 3 : undefined`
|
|
125
124
|
- Conditional assignment `a?[x] = 3` -> `a ? a[x] = 3 : undefined`
|
|
126
125
|
- Might add later
|
|
127
|
-
- Rest parameter in any assignment position
|
|
128
126
|
- Multiple slice assignment `otherNumbers[0...] = numbers[3..6] = [-3, -4, -5, -6]`
|
|
129
127
|
|
|
130
128
|
Things Changed from CoffeeScript
|
|
@@ -242,6 +240,8 @@ could be a valid property `1.e10` -> `1..e10`. The workaround is to add a traili
|
|
|
242
240
|
@@methodDecorator
|
|
243
241
|
method() {}
|
|
244
242
|
```
|
|
243
|
+
- `when` inside switch automatically breaks and adds block scope.
|
|
244
|
+
- `else` inside switch adds block scope.
|
|
245
245
|
- No whitespace between unary operators and operands. Mandatory whitespace between condition and ternary `?` ex. `x ? a : b` since `x?` is the unary existential operator.
|
|
246
246
|
- No labels (yet...)
|
|
247
247
|
|
package/dist/browser.js
CHANGED
|
@@ -6517,9 +6517,10 @@ ${input.slice(result.pos)}
|
|
|
6517
6517
|
var expressions = value[2];
|
|
6518
6518
|
return { "type": "CaseClause", "cases": cases, "expressions": expressions, "children": value };
|
|
6519
6519
|
});
|
|
6520
|
-
var CaseClause$1 = $TS($S(When, CaseExpressionList, $C(ThenClause, NestedBlockStatements), InsertBreak), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6520
|
+
var CaseClause$1 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
6521
6521
|
var cases = $2;
|
|
6522
|
-
var expressions = $
|
|
6522
|
+
var expressions = $4;
|
|
6523
|
+
var b = $5;
|
|
6523
6524
|
if (expressions.expressions) {
|
|
6524
6525
|
expressions = expressions.expressions;
|
|
6525
6526
|
}
|
|
@@ -6527,6 +6528,7 @@ ${input.slice(result.pos)}
|
|
|
6527
6528
|
type: "WhenClause",
|
|
6528
6529
|
cases,
|
|
6529
6530
|
expressions,
|
|
6531
|
+
break: b,
|
|
6530
6532
|
children: $0
|
|
6531
6533
|
};
|
|
6532
6534
|
});
|
|
@@ -6540,8 +6542,8 @@ ${input.slice(result.pos)}
|
|
|
6540
6542
|
children: $0
|
|
6541
6543
|
};
|
|
6542
6544
|
});
|
|
6543
|
-
var CaseClause$3 = $TS($S(Else, ImpliedColon, $C(NestedBlockStatements, $S($Q(TrailingComment), Statement))), function($skip, $loc, $0, $1, $2, $3) {
|
|
6544
|
-
var expressions = $
|
|
6545
|
+
var CaseClause$3 = $TS($S(Else, ImpliedColon, InsertOpenBrace, $C(NestedBlockStatements, $S($Q(TrailingComment), Statement)), InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
6546
|
+
var expressions = $4;
|
|
6545
6547
|
$1.token = "default";
|
|
6546
6548
|
if (expressions.expressions)
|
|
6547
6549
|
expressions = expressions.expressions;
|
|
@@ -11041,6 +11043,7 @@ ${input.slice(result.pos)}
|
|
|
11041
11043
|
var TypeUnaryOp$0 = $EXPECT($L153, fail, 'TypeUnaryOp "keyof"');
|
|
11042
11044
|
var TypeUnaryOp$1 = $EXPECT($L135, fail, 'TypeUnaryOp "typeof"');
|
|
11043
11045
|
var TypeUnaryOp$2 = $EXPECT($L154, fail, 'TypeUnaryOp "infer"');
|
|
11046
|
+
var TypeUnaryOp$3 = $EXPECT($L151, fail, 'TypeUnaryOp "readonly"');
|
|
11044
11047
|
function TypeUnaryOp(state) {
|
|
11045
11048
|
if (state.events) {
|
|
11046
11049
|
const result = state.events.enter?.("TypeUnaryOp", state);
|
|
@@ -11048,12 +11051,12 @@ ${input.slice(result.pos)}
|
|
|
11048
11051
|
return result.cache;
|
|
11049
11052
|
}
|
|
11050
11053
|
if (state.tokenize) {
|
|
11051
|
-
const result = $TOKEN("TypeUnaryOp", state, TypeUnaryOp$0(state) || TypeUnaryOp$1(state) || TypeUnaryOp$2(state));
|
|
11054
|
+
const result = $TOKEN("TypeUnaryOp", state, TypeUnaryOp$0(state) || TypeUnaryOp$1(state) || TypeUnaryOp$2(state) || TypeUnaryOp$3(state));
|
|
11052
11055
|
if (state.events)
|
|
11053
11056
|
state.events.exit?.("TypeUnaryOp", state, result);
|
|
11054
11057
|
return result;
|
|
11055
11058
|
} else {
|
|
11056
|
-
const result = TypeUnaryOp$0(state) || TypeUnaryOp$1(state) || TypeUnaryOp$2(state);
|
|
11059
|
+
const result = TypeUnaryOp$0(state) || TypeUnaryOp$1(state) || TypeUnaryOp$2(state) || TypeUnaryOp$3(state);
|
|
11057
11060
|
if (state.events)
|
|
11058
11061
|
state.events.exit?.("TypeUnaryOp", state, result);
|
|
11059
11062
|
return result;
|
|
@@ -12418,7 +12421,7 @@ ${input.slice(result.pos)}
|
|
|
12418
12421
|
case "CaseClause":
|
|
12419
12422
|
return;
|
|
12420
12423
|
case "WhenClause":
|
|
12421
|
-
node.children.
|
|
12424
|
+
node.children.splice(node.children.indexOf(node.break), 1);
|
|
12422
12425
|
insertReturn(node.expressions[node.expressions.length - 1]);
|
|
12423
12426
|
return;
|
|
12424
12427
|
case "DefaultClause":
|
package/dist/main.js
CHANGED
|
@@ -6516,9 +6516,10 @@ ${input.slice(result.pos)}
|
|
|
6516
6516
|
var expressions = value[2];
|
|
6517
6517
|
return { "type": "CaseClause", "cases": cases, "expressions": expressions, "children": value };
|
|
6518
6518
|
});
|
|
6519
|
-
var CaseClause$1 = $TS($S(When, CaseExpressionList, $C(ThenClause, NestedBlockStatements), InsertBreak), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
6519
|
+
var CaseClause$1 = $TS($S(When, CaseExpressionList, InsertOpenBrace, $C(ThenClause, NestedBlockStatements), InsertBreak, InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8) {
|
|
6520
6520
|
var cases = $2;
|
|
6521
|
-
var expressions = $
|
|
6521
|
+
var expressions = $4;
|
|
6522
|
+
var b = $5;
|
|
6522
6523
|
if (expressions.expressions) {
|
|
6523
6524
|
expressions = expressions.expressions;
|
|
6524
6525
|
}
|
|
@@ -6526,6 +6527,7 @@ ${input.slice(result.pos)}
|
|
|
6526
6527
|
type: "WhenClause",
|
|
6527
6528
|
cases,
|
|
6528
6529
|
expressions,
|
|
6530
|
+
break: b,
|
|
6529
6531
|
children: $0
|
|
6530
6532
|
};
|
|
6531
6533
|
});
|
|
@@ -6539,8 +6541,8 @@ ${input.slice(result.pos)}
|
|
|
6539
6541
|
children: $0
|
|
6540
6542
|
};
|
|
6541
6543
|
});
|
|
6542
|
-
var CaseClause$3 = $TS($S(Else, ImpliedColon, $C(NestedBlockStatements, $S($Q(TrailingComment), Statement))), function($skip, $loc, $0, $1, $2, $3) {
|
|
6543
|
-
var expressions = $
|
|
6544
|
+
var CaseClause$3 = $TS($S(Else, ImpliedColon, InsertOpenBrace, $C(NestedBlockStatements, $S($Q(TrailingComment), Statement)), InsertNewline, InsertIndent, InsertCloseBrace), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7) {
|
|
6545
|
+
var expressions = $4;
|
|
6544
6546
|
$1.token = "default";
|
|
6545
6547
|
if (expressions.expressions)
|
|
6546
6548
|
expressions = expressions.expressions;
|
|
@@ -11040,6 +11042,7 @@ ${input.slice(result.pos)}
|
|
|
11040
11042
|
var TypeUnaryOp$0 = $EXPECT($L153, fail, 'TypeUnaryOp "keyof"');
|
|
11041
11043
|
var TypeUnaryOp$1 = $EXPECT($L135, fail, 'TypeUnaryOp "typeof"');
|
|
11042
11044
|
var TypeUnaryOp$2 = $EXPECT($L154, fail, 'TypeUnaryOp "infer"');
|
|
11045
|
+
var TypeUnaryOp$3 = $EXPECT($L151, fail, 'TypeUnaryOp "readonly"');
|
|
11043
11046
|
function TypeUnaryOp(state) {
|
|
11044
11047
|
if (state.events) {
|
|
11045
11048
|
const result = state.events.enter?.("TypeUnaryOp", state);
|
|
@@ -11047,12 +11050,12 @@ ${input.slice(result.pos)}
|
|
|
11047
11050
|
return result.cache;
|
|
11048
11051
|
}
|
|
11049
11052
|
if (state.tokenize) {
|
|
11050
|
-
const result = $TOKEN("TypeUnaryOp", state, TypeUnaryOp$0(state) || TypeUnaryOp$1(state) || TypeUnaryOp$2(state));
|
|
11053
|
+
const result = $TOKEN("TypeUnaryOp", state, TypeUnaryOp$0(state) || TypeUnaryOp$1(state) || TypeUnaryOp$2(state) || TypeUnaryOp$3(state));
|
|
11051
11054
|
if (state.events)
|
|
11052
11055
|
state.events.exit?.("TypeUnaryOp", state, result);
|
|
11053
11056
|
return result;
|
|
11054
11057
|
} else {
|
|
11055
|
-
const result = TypeUnaryOp$0(state) || TypeUnaryOp$1(state) || TypeUnaryOp$2(state);
|
|
11058
|
+
const result = TypeUnaryOp$0(state) || TypeUnaryOp$1(state) || TypeUnaryOp$2(state) || TypeUnaryOp$3(state);
|
|
11056
11059
|
if (state.events)
|
|
11057
11060
|
state.events.exit?.("TypeUnaryOp", state, result);
|
|
11058
11061
|
return result;
|
|
@@ -12417,7 +12420,7 @@ ${input.slice(result.pos)}
|
|
|
12417
12420
|
case "CaseClause":
|
|
12418
12421
|
return;
|
|
12419
12422
|
case "WhenClause":
|
|
12420
|
-
node.children.
|
|
12423
|
+
node.children.splice(node.children.indexOf(node.break), 1);
|
|
12421
12424
|
insertReturn(node.expressions[node.expressions.length - 1]);
|
|
12422
12425
|
return;
|
|
12423
12426
|
case "DefaultClause":
|