@danielx/civet 0.6.40 → 0.6.42
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/dist/browser.js +127 -84
- package/dist/civet +28 -28
- package/dist/main.js +127 -84
- package/dist/main.mjs +127 -84
- package/dist/ts-diagnostic.js +0 -61
- package/dist/ts-diagnostic.mjs +0 -49
- package/package.json +2 -2
package/dist/browser.js
CHANGED
|
@@ -859,14 +859,36 @@ ${input.slice(result.pos)}
|
|
|
859
859
|
})
|
|
860
860
|
);
|
|
861
861
|
}
|
|
862
|
+
function negateCondition(condition) {
|
|
863
|
+
let { expression } = condition;
|
|
864
|
+
const children = condition.children.slice();
|
|
865
|
+
const i = children.indexOf(expression);
|
|
866
|
+
if (i < 0) {
|
|
867
|
+
throw new Error(`Could not find expression in condition`);
|
|
868
|
+
}
|
|
869
|
+
children[i] = expression = {
|
|
870
|
+
type: "UnaryExpression",
|
|
871
|
+
children: [
|
|
872
|
+
"!",
|
|
873
|
+
makeLeftHandSideExpression(expression)
|
|
874
|
+
]
|
|
875
|
+
};
|
|
876
|
+
return { ...condition, expression, children };
|
|
877
|
+
}
|
|
862
878
|
function expressionizeIfClause(clause, b, e) {
|
|
863
|
-
const
|
|
864
|
-
children.
|
|
879
|
+
const { condition } = clause;
|
|
880
|
+
const [...condRest] = condition.children, [closeParen] = condRest.splice(-1);
|
|
881
|
+
const children = [
|
|
882
|
+
...condRest,
|
|
883
|
+
"?",
|
|
884
|
+
b
|
|
885
|
+
];
|
|
865
886
|
if (e) {
|
|
866
887
|
children.push(e[0], ":", ...e.slice(2));
|
|
867
888
|
} else {
|
|
868
889
|
children.push(":void 0");
|
|
869
890
|
}
|
|
891
|
+
children.push(closeParen);
|
|
870
892
|
return {
|
|
871
893
|
type: "IfExpression",
|
|
872
894
|
children
|
|
@@ -1550,7 +1572,6 @@ ${input.slice(result.pos)}
|
|
|
1550
1572
|
const [, exp, semi] = node;
|
|
1551
1573
|
if (semi?.type === "SemicolonDelimiter")
|
|
1552
1574
|
return;
|
|
1553
|
-
let indent = getIndent(node);
|
|
1554
1575
|
if (!exp)
|
|
1555
1576
|
return;
|
|
1556
1577
|
switch (exp.type) {
|
|
@@ -1975,6 +1996,7 @@ ${input.slice(result.pos)}
|
|
|
1975
1996
|
case "CallExpression":
|
|
1976
1997
|
case "MemberExpression":
|
|
1977
1998
|
case "ParenthesizedExpression":
|
|
1999
|
+
case "IfExpression":
|
|
1978
2000
|
case "DebuggerExpression":
|
|
1979
2001
|
case "SwitchExpression":
|
|
1980
2002
|
case "ThrowExpression":
|
|
@@ -2214,7 +2236,7 @@ ${input.slice(result.pos)}
|
|
|
2214
2236
|
children
|
|
2215
2237
|
};
|
|
2216
2238
|
}
|
|
2217
|
-
function processDeclarationCondition(condition) {
|
|
2239
|
+
function processDeclarationCondition(condition, rootCondition) {
|
|
2218
2240
|
if (!(condition.type === "DeclarationCondition")) {
|
|
2219
2241
|
return;
|
|
2220
2242
|
}
|
|
@@ -2222,7 +2244,7 @@ ${input.slice(result.pos)}
|
|
|
2222
2244
|
const { decl, bindings } = condition.declaration;
|
|
2223
2245
|
const binding = bindings[0];
|
|
2224
2246
|
const { pattern, suffix, initializer, splices, thisAssignments } = binding;
|
|
2225
|
-
|
|
2247
|
+
Object.assign(condition, {
|
|
2226
2248
|
type: "AssignmentExpression",
|
|
2227
2249
|
children: [ref, initializer],
|
|
2228
2250
|
hoistDec: {
|
|
@@ -2230,14 +2252,15 @@ ${input.slice(result.pos)}
|
|
|
2230
2252
|
children: ["let ", ref, suffix],
|
|
2231
2253
|
names: []
|
|
2232
2254
|
},
|
|
2255
|
+
pattern,
|
|
2256
|
+
ref
|
|
2257
|
+
});
|
|
2258
|
+
Object.assign(rootCondition, {
|
|
2233
2259
|
blockPrefix: [
|
|
2234
2260
|
["", [decl, pattern, suffix, " = ", ref, ...splices], ";"],
|
|
2235
2261
|
...thisAssignments
|
|
2236
|
-
]
|
|
2237
|
-
|
|
2238
|
-
ref
|
|
2239
|
-
};
|
|
2240
|
-
Object.assign(condition, initCondition);
|
|
2262
|
+
]
|
|
2263
|
+
});
|
|
2241
2264
|
}
|
|
2242
2265
|
function processDeclarationConditions(node) {
|
|
2243
2266
|
gatherRecursiveAll(node, (n) => {
|
|
@@ -2249,8 +2272,15 @@ ${input.slice(result.pos)}
|
|
|
2249
2272
|
if (!condition?.expression) {
|
|
2250
2273
|
return;
|
|
2251
2274
|
}
|
|
2252
|
-
|
|
2253
|
-
|
|
2275
|
+
;
|
|
2276
|
+
let { expression } = condition;
|
|
2277
|
+
if (typeof expression === "object" && expression != null && "type" in expression && expression.type === "UnaryExpression" && "children" in expression && Array.isArray(expression.children) && expression.children.length === 2 && expression.children[0] === "!" && typeof expression.children[1] === "object" && expression.children[1] != null && "type" in expression.children[1] && expression.children[1].type === "ParenthesizedExpression" && "expression" in expression.children[1]) {
|
|
2278
|
+
const { type: type1, children: [, { type: type2, expression: expression2 }] } = expression;
|
|
2279
|
+
const type = [type1, type2];
|
|
2280
|
+
expression = expression2;
|
|
2281
|
+
}
|
|
2282
|
+
processDeclarationCondition(expression, condition.expression);
|
|
2283
|
+
const { ref, pattern } = expression;
|
|
2254
2284
|
if (pattern) {
|
|
2255
2285
|
let conditions = [];
|
|
2256
2286
|
getPatternConditions(pattern, ref, conditions);
|
|
@@ -3542,6 +3572,7 @@ ${input.slice(result.pos)}
|
|
|
3542
3572
|
maybeRef,
|
|
3543
3573
|
modifyString,
|
|
3544
3574
|
needsRef,
|
|
3575
|
+
negateCondition,
|
|
3545
3576
|
processAssignmentDeclaration,
|
|
3546
3577
|
processBinaryOpExpression,
|
|
3547
3578
|
processCallMemberExpression,
|
|
@@ -3984,6 +4015,7 @@ ${input.slice(result.pos)}
|
|
|
3984
4015
|
TemplateBlockCharacters,
|
|
3985
4016
|
ReservedWord,
|
|
3986
4017
|
Comment,
|
|
4018
|
+
_Comment,
|
|
3987
4019
|
SingleLineComment,
|
|
3988
4020
|
JSSingleLineComment,
|
|
3989
4021
|
MultiLineComment,
|
|
@@ -4524,33 +4556,36 @@ ${input.slice(result.pos)}
|
|
|
4524
4556
|
var $R38 = $R(new RegExp("(?:by)(?!\\p{ID_Continue})", "suy"));
|
|
4525
4557
|
var $R39 = $R(new RegExp("(?:of)(?!\\p{ID_Continue})", "suy"));
|
|
4526
4558
|
var $R40 = $R(new RegExp("(?:and|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|finally|for|function|if|import|in|instanceof|interface|is|let|loop|new|not|null|or|private|protected|public|return|static|super|switch|this|throw|true|try|typeof|unless|until|var|void|while|with|yield)(?!\\p{ID_Continue})", "suy"));
|
|
4527
|
-
var $R41 = $R(new RegExp("
|
|
4528
|
-
var $R42 = $R(new RegExp("
|
|
4529
|
-
var $R43 = $R(new RegExp("
|
|
4530
|
-
var $R44 = $R(new RegExp("[
|
|
4531
|
-
var $R45 = $R(new RegExp("
|
|
4532
|
-
var $R46 = $R(new RegExp("
|
|
4533
|
-
var $R47 = $R(new RegExp("[
|
|
4534
|
-
var $R48 = $R(new RegExp("(
|
|
4535
|
-
var $R49 = $R(new RegExp("[
|
|
4536
|
-
var $R50 = $R(new RegExp("
|
|
4537
|
-
var $R51 = $R(new RegExp("
|
|
4538
|
-
var $R52 = $R(new RegExp("
|
|
4539
|
-
var $R53 = $R(new RegExp("(
|
|
4540
|
-
var $R54 = $R(new RegExp(
|
|
4541
|
-
var $R55 = $R(new RegExp("[
|
|
4542
|
-
var $R56 = $R(new RegExp("[
|
|
4543
|
-
var $R57 = $R(new RegExp("
|
|
4544
|
-
var $R58 = $R(new RegExp("[
|
|
4545
|
-
var $R59 = $R(new RegExp("[
|
|
4546
|
-
var $R60 = $R(new RegExp("[
|
|
4547
|
-
var $R61 = $R(new RegExp("
|
|
4548
|
-
var $R62 = $R(new RegExp("[
|
|
4549
|
-
var $R63 = $R(new RegExp("[\\
|
|
4550
|
-
var $R64 = $R(new RegExp("
|
|
4551
|
-
var $R65 = $R(new RegExp("
|
|
4552
|
-
var $R66 = $R(new RegExp("\\
|
|
4553
|
-
var $R67 = $R(new RegExp("[
|
|
4559
|
+
var $R41 = $R(new RegExp("(?=\\/|#)", "suy"));
|
|
4560
|
+
var $R42 = $R(new RegExp("\\/\\/(?!\\/)[^\\r\\n]*", "suy"));
|
|
4561
|
+
var $R43 = $R(new RegExp(".", "suy"));
|
|
4562
|
+
var $R44 = $R(new RegExp("#(?!##(?!#))([^\\r\\n]*)", "suy"));
|
|
4563
|
+
var $R45 = $R(new RegExp("[^]*?###", "suy"));
|
|
4564
|
+
var $R46 = $R(new RegExp("###(?!#)", "suy"));
|
|
4565
|
+
var $R47 = $R(new RegExp("\\/\\*(?:(?!\\*\\/)[^\\r\\n])*\\*\\/", "suy"));
|
|
4566
|
+
var $R48 = $R(new RegExp("(?=[ \\t\\/])", "suy"));
|
|
4567
|
+
var $R49 = $R(new RegExp("[ \\t]+", "suy"));
|
|
4568
|
+
var $R50 = $R(new RegExp("(?!\\p{ID_Continue})", "suy"));
|
|
4569
|
+
var $R51 = $R(new RegExp("['\u2019]s", "suy"));
|
|
4570
|
+
var $R52 = $R(new RegExp("\\s", "suy"));
|
|
4571
|
+
var $R53 = $R(new RegExp("(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*", "suy"));
|
|
4572
|
+
var $R54 = $R(new RegExp("[\\s>]|\\/>", "suy"));
|
|
4573
|
+
var $R55 = $R(new RegExp("(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+", "suy"));
|
|
4574
|
+
var $R56 = $R(new RegExp(`"[^"]*"|'[^']*'`, "suy"));
|
|
4575
|
+
var $R57 = $R(new RegExp("[<>]", "suy"));
|
|
4576
|
+
var $R58 = $R(new RegExp("[!~+-](?!\\s|[!~+-]*&)", "suy"));
|
|
4577
|
+
var $R59 = $R(new RegExp("(?:-[^-]|[^-]*)*", "suy"));
|
|
4578
|
+
var $R60 = $R(new RegExp("[^{}<>\\r\\n]+", "suy"));
|
|
4579
|
+
var $R61 = $R(new RegExp("[+-]?", "suy"));
|
|
4580
|
+
var $R62 = $R(new RegExp("[+-]", "suy"));
|
|
4581
|
+
var $R63 = $R(new RegExp("#![^\\r\\n]*", "suy"));
|
|
4582
|
+
var $R64 = $R(new RegExp("[\\t ]*", "suy"));
|
|
4583
|
+
var $R65 = $R(new RegExp("[\\s]*", "suy"));
|
|
4584
|
+
var $R66 = $R(new RegExp("\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?", "suy"));
|
|
4585
|
+
var $R67 = $R(new RegExp("\\/\\/\\/[^\\r\\n]*", "suy"));
|
|
4586
|
+
var $R68 = $R(new RegExp("(?=[ \\t\\r\\n\\/#]|$)", "suy"));
|
|
4587
|
+
var $R69 = $R(new RegExp("\\r\\n|\\n|\\r|$", "suy"));
|
|
4588
|
+
var $R70 = $R(new RegExp("[ \\t]*", "suy"));
|
|
4554
4589
|
var Program$0 = $TS($S(Reset, Init, $E(EOS), TopLevelStatements, __), function($skip, $loc, $0, $1, $2, $3, $4, $5) {
|
|
4555
4590
|
var statements = $4;
|
|
4556
4591
|
processProgram({
|
|
@@ -5957,8 +5992,8 @@ ${input.slice(result.pos)}
|
|
|
5957
5992
|
function NonEmptyParameters(ctx, state) {
|
|
5958
5993
|
return $EVENT(ctx, state, "NonEmptyParameters", NonEmptyParameters$0);
|
|
5959
5994
|
}
|
|
5960
|
-
var FunctionRestParameter$0 = $TS($S(BindingRestElement, $E(TypeSuffix), ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3) {
|
|
5961
|
-
var id = $
|
|
5995
|
+
var FunctionRestParameter$0 = $TS($S(__, BindingRestElement, $E(TypeSuffix), ParameterElementDelimiter), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
5996
|
+
var id = $2;
|
|
5962
5997
|
return {
|
|
5963
5998
|
type: "FunctionRestParameter",
|
|
5964
5999
|
children: $0,
|
|
@@ -8321,10 +8356,10 @@ ${input.slice(result.pos)}
|
|
|
8321
8356
|
kind = { ...kind, token: "if" };
|
|
8322
8357
|
kind.token += getTrimmingSpace(condition);
|
|
8323
8358
|
condition = insertTrimmingSpace(condition, "");
|
|
8359
|
+
condition = negateCondition(condition);
|
|
8324
8360
|
return {
|
|
8325
8361
|
type: "IfStatement",
|
|
8326
|
-
|
|
8327
|
-
children: [kind, ["(!", condition, ")"]],
|
|
8362
|
+
children: [kind, condition],
|
|
8328
8363
|
condition
|
|
8329
8364
|
};
|
|
8330
8365
|
});
|
|
@@ -8527,16 +8562,12 @@ ${input.slice(result.pos)}
|
|
|
8527
8562
|
var ws = $2;
|
|
8528
8563
|
var condition = $3;
|
|
8529
8564
|
if (kind.token === "until") {
|
|
8530
|
-
kind
|
|
8531
|
-
|
|
8532
|
-
type: "IterationStatement",
|
|
8533
|
-
children: [kind, ...ws, ["(!", ...condition.children, ")"]],
|
|
8534
|
-
condition
|
|
8535
|
-
};
|
|
8565
|
+
kind = { ...kind, token: "while" };
|
|
8566
|
+
condition = negateCondition(condition);
|
|
8536
8567
|
}
|
|
8537
8568
|
return {
|
|
8538
8569
|
type: "IterationStatement",
|
|
8539
|
-
children: [kind,
|
|
8570
|
+
children: [kind, ws, condition],
|
|
8540
8571
|
condition
|
|
8541
8572
|
};
|
|
8542
8573
|
});
|
|
@@ -10077,11 +10108,17 @@ ${input.slice(result.pos)}
|
|
|
10077
10108
|
function ReservedWord(ctx, state) {
|
|
10078
10109
|
return $EVENT_C(ctx, state, "ReservedWord", ReservedWord$$);
|
|
10079
10110
|
}
|
|
10080
|
-
var Comment$0 =
|
|
10081
|
-
|
|
10082
|
-
|
|
10111
|
+
var Comment$0 = $T($S($EXPECT($R41, "Comment /(?=\\/|#)/"), _Comment), function(value) {
|
|
10112
|
+
return value[1];
|
|
10113
|
+
});
|
|
10083
10114
|
function Comment(ctx, state) {
|
|
10084
|
-
return $
|
|
10115
|
+
return $EVENT(ctx, state, "Comment", Comment$0);
|
|
10116
|
+
}
|
|
10117
|
+
var _Comment$0 = MultiLineComment;
|
|
10118
|
+
var _Comment$1 = SingleLineComment;
|
|
10119
|
+
var _Comment$$ = [_Comment$0, _Comment$1];
|
|
10120
|
+
function _Comment(ctx, state) {
|
|
10121
|
+
return $EVENT_C(ctx, state, "_Comment", _Comment$$);
|
|
10085
10122
|
}
|
|
10086
10123
|
var SingleLineComment$0 = JSSingleLineComment;
|
|
10087
10124
|
var SingleLineComment$1 = $S(CoffeeCommentEnabled, CoffeeSingleLineComment);
|
|
@@ -10089,7 +10126,7 @@ ${input.slice(result.pos)}
|
|
|
10089
10126
|
function SingleLineComment(ctx, state) {
|
|
10090
10127
|
return $EVENT_C(ctx, state, "SingleLineComment", SingleLineComment$$);
|
|
10091
10128
|
}
|
|
10092
|
-
var JSSingleLineComment$0 = $TR($EXPECT($
|
|
10129
|
+
var JSSingleLineComment$0 = $TR($EXPECT($R42, "JSSingleLineComment /\\/\\/(?!\\/)[^\\r\\n]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
10093
10130
|
return { type: "Comment", $loc, token: $0 };
|
|
10094
10131
|
});
|
|
10095
10132
|
function JSSingleLineComment(ctx, state) {
|
|
@@ -10101,30 +10138,30 @@ ${input.slice(result.pos)}
|
|
|
10101
10138
|
function MultiLineComment(ctx, state) {
|
|
10102
10139
|
return $EVENT_C(ctx, state, "MultiLineComment", MultiLineComment$$);
|
|
10103
10140
|
}
|
|
10104
|
-
var JSMultiLineComment$0 = $TV($TEXT($S($EXPECT($L109, 'JSMultiLineComment "/*"'), $Q($S($N($EXPECT($L110, 'JSMultiLineComment "*/"')), $EXPECT($
|
|
10141
|
+
var JSMultiLineComment$0 = $TV($TEXT($S($EXPECT($L109, 'JSMultiLineComment "/*"'), $Q($S($N($EXPECT($L110, 'JSMultiLineComment "*/"')), $EXPECT($R43, "JSMultiLineComment /./"))), $EXPECT($L110, 'JSMultiLineComment "*/"'))), function($skip, $loc, $0, $1) {
|
|
10105
10142
|
return { type: "Comment", $loc, token: $1 };
|
|
10106
10143
|
});
|
|
10107
10144
|
function JSMultiLineComment(ctx, state) {
|
|
10108
10145
|
return $EVENT(ctx, state, "JSMultiLineComment", JSMultiLineComment$0);
|
|
10109
10146
|
}
|
|
10110
|
-
var CoffeeSingleLineComment$0 = $TR($EXPECT($
|
|
10147
|
+
var CoffeeSingleLineComment$0 = $TR($EXPECT($R44, "CoffeeSingleLineComment /#(?!##(?!#))([^\\r\\n]*)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
10111
10148
|
return { type: "Comment", $loc, token: `//${$1}` };
|
|
10112
10149
|
});
|
|
10113
10150
|
function CoffeeSingleLineComment(ctx, state) {
|
|
10114
10151
|
return $EVENT(ctx, state, "CoffeeSingleLineComment", CoffeeSingleLineComment$0);
|
|
10115
10152
|
}
|
|
10116
|
-
var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($
|
|
10153
|
+
var CoffeeMultiLineComment$0 = $TS($S(CoffeeHereCommentStart, $TEXT($EXPECT($R45, "CoffeeMultiLineComment /[^]*?###/"))), function($skip, $loc, $0, $1, $2) {
|
|
10117
10154
|
$2 = $2.slice(0, $2.length - 3).replace(/\*\//g, "* /");
|
|
10118
10155
|
return { type: "Comment", $loc, token: `/*${$2}*/` };
|
|
10119
10156
|
});
|
|
10120
10157
|
function CoffeeMultiLineComment(ctx, state) {
|
|
10121
10158
|
return $EVENT(ctx, state, "CoffeeMultiLineComment", CoffeeMultiLineComment$0);
|
|
10122
10159
|
}
|
|
10123
|
-
var CoffeeHereCommentStart$0 = $R$0($EXPECT($
|
|
10160
|
+
var CoffeeHereCommentStart$0 = $R$0($EXPECT($R46, "CoffeeHereCommentStart /###(?!#)/"));
|
|
10124
10161
|
function CoffeeHereCommentStart(ctx, state) {
|
|
10125
10162
|
return $EVENT(ctx, state, "CoffeeHereCommentStart", CoffeeHereCommentStart$0);
|
|
10126
10163
|
}
|
|
10127
|
-
var InlineComment$0 = $TR($EXPECT($
|
|
10164
|
+
var InlineComment$0 = $TR($EXPECT($R47, "InlineComment /\\/\\*(?:(?!\\*\\/)[^\\r\\n])*\\*\\//"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
10128
10165
|
return { $loc, token: $0 };
|
|
10129
10166
|
});
|
|
10130
10167
|
function InlineComment(ctx, state) {
|
|
@@ -10138,11 +10175,13 @@ ${input.slice(result.pos)}
|
|
|
10138
10175
|
function TrailingComment(ctx, state) {
|
|
10139
10176
|
return $EVENT(ctx, state, "TrailingComment", TrailingComment$0);
|
|
10140
10177
|
}
|
|
10141
|
-
var _$0 = $P($C(NonNewlineWhitespace, InlineComment))
|
|
10178
|
+
var _$0 = $T($S($EXPECT($R48, "_ /(?=[ \\t\\/])/"), $P($C(NonNewlineWhitespace, InlineComment))), function(value) {
|
|
10179
|
+
return value[1];
|
|
10180
|
+
});
|
|
10142
10181
|
function _(ctx, state) {
|
|
10143
10182
|
return $EVENT(ctx, state, "_", _$0);
|
|
10144
10183
|
}
|
|
10145
|
-
var NonNewlineWhitespace$0 = $TR($EXPECT($
|
|
10184
|
+
var NonNewlineWhitespace$0 = $TR($EXPECT($R49, "NonNewlineWhitespace /[ \\t]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
10146
10185
|
return { $loc, token: $0 };
|
|
10147
10186
|
});
|
|
10148
10187
|
var NonNewlineWhitespace$1 = $T($S(CoffeeLineContinuationEnabled, $EXPECT($L111, 'NonNewlineWhitespace "\\\\\\\\"'), EOL), function(value) {
|
|
@@ -10202,7 +10241,7 @@ ${input.slice(result.pos)}
|
|
|
10202
10241
|
function SemicolonDelimiter(ctx, state) {
|
|
10203
10242
|
return $EVENT(ctx, state, "SemicolonDelimiter", SemicolonDelimiter$0);
|
|
10204
10243
|
}
|
|
10205
|
-
var NonIdContinue$0 = $R$0($EXPECT($
|
|
10244
|
+
var NonIdContinue$0 = $R$0($EXPECT($R50, "NonIdContinue /(?!\\p{ID_Continue})/"));
|
|
10206
10245
|
function NonIdContinue(ctx, state) {
|
|
10207
10246
|
return $EVENT(ctx, state, "NonIdContinue", NonIdContinue$0);
|
|
10208
10247
|
}
|
|
@@ -10353,7 +10392,7 @@ ${input.slice(result.pos)}
|
|
|
10353
10392
|
var Dot$0 = $TV($EXPECT($L6, 'Dot "."'), function($skip, $loc, $0, $1) {
|
|
10354
10393
|
return { $loc, token: $1 };
|
|
10355
10394
|
});
|
|
10356
|
-
var Dot$1 = $TS($S($EXPECT($
|
|
10395
|
+
var Dot$1 = $TS($S($EXPECT($R51, "Dot /['\u2019]s/"), _), function($skip, $loc, $0, $1, $2) {
|
|
10357
10396
|
var ws = $2;
|
|
10358
10397
|
return [
|
|
10359
10398
|
{ $loc, token: "." },
|
|
@@ -10468,7 +10507,7 @@ ${input.slice(result.pos)}
|
|
|
10468
10507
|
function If(ctx, state) {
|
|
10469
10508
|
return $EVENT(ctx, state, "If", If$0);
|
|
10470
10509
|
}
|
|
10471
|
-
var Import$0 = $TS($S($EXPECT($L15, 'Import "import"'), $Y($EXPECT($
|
|
10510
|
+
var Import$0 = $TS($S($EXPECT($L15, 'Import "import"'), $Y($EXPECT($R52, "Import /\\s/"))), function($skip, $loc, $0, $1, $2) {
|
|
10472
10511
|
return { $loc, token: $1 };
|
|
10473
10512
|
});
|
|
10474
10513
|
function Import(ctx, state) {
|
|
@@ -10937,7 +10976,7 @@ ${input.slice(result.pos)}
|
|
|
10937
10976
|
function JSXElementName(ctx, state) {
|
|
10938
10977
|
return $EVENT_C(ctx, state, "JSXElementName", JSXElementName$$);
|
|
10939
10978
|
}
|
|
10940
|
-
var JSXIdentifierName$0 = $R$0($EXPECT($
|
|
10979
|
+
var JSXIdentifierName$0 = $R$0($EXPECT($R53, "JSXIdentifierName /(?:\\p{ID_Start}|[_$])(?:\\p{ID_Continue}|[\\u200C\\u200D$-])*/"));
|
|
10941
10980
|
function JSXIdentifierName(ctx, state) {
|
|
10942
10981
|
return $EVENT(ctx, state, "JSXIdentifierName", JSXIdentifierName$0);
|
|
10943
10982
|
}
|
|
@@ -11120,11 +11159,11 @@ ${input.slice(result.pos)}
|
|
|
11120
11159
|
function JSXAttribute(ctx, state) {
|
|
11121
11160
|
return $EVENT_C(ctx, state, "JSXAttribute", JSXAttribute$$);
|
|
11122
11161
|
}
|
|
11123
|
-
var JSXAttributeSpace$0 = $R$0($EXPECT($
|
|
11162
|
+
var JSXAttributeSpace$0 = $R$0($EXPECT($R54, "JSXAttributeSpace /[\\s>]|\\/>/"));
|
|
11124
11163
|
function JSXAttributeSpace(ctx, state) {
|
|
11125
11164
|
return $EVENT(ctx, state, "JSXAttributeSpace", JSXAttributeSpace$0);
|
|
11126
11165
|
}
|
|
11127
|
-
var JSXShorthandString$0 = $TR($EXPECT($
|
|
11166
|
+
var JSXShorthandString$0 = $TR($EXPECT($R55, "JSXShorthandString /(?:[\\w\\-:]+|\\([^()]*\\)|\\[[^\\[\\]]*\\])+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
11128
11167
|
return quoteString($0);
|
|
11129
11168
|
});
|
|
11130
11169
|
var JSXShorthandString$1 = $TS($S(TemplateLiteral), function($skip, $loc, $0, $1) {
|
|
@@ -11158,7 +11197,7 @@ ${input.slice(result.pos)}
|
|
|
11158
11197
|
}
|
|
11159
11198
|
return [open, value, close];
|
|
11160
11199
|
});
|
|
11161
|
-
var JSXAttributeValue$4 = $R$0($EXPECT($
|
|
11200
|
+
var JSXAttributeValue$4 = $R$0($EXPECT($R56, `JSXAttributeValue /"[^"]*"|'[^']*'/`));
|
|
11162
11201
|
var JSXAttributeValue$$ = [JSXAttributeValue$0, JSXAttributeValue$1, JSXAttributeValue$2, JSXAttributeValue$3, JSXAttributeValue$4];
|
|
11163
11202
|
function JSXAttributeValue(ctx, state) {
|
|
11164
11203
|
return $EVENT_C(ctx, state, "JSXAttributeValue", JSXAttributeValue$$);
|
|
@@ -11171,7 +11210,7 @@ ${input.slice(result.pos)}
|
|
|
11171
11210
|
function InlineJSXAttributeValue(ctx, state) {
|
|
11172
11211
|
return $EVENT(ctx, state, "InlineJSXAttributeValue", InlineJSXAttributeValue$0);
|
|
11173
11212
|
}
|
|
11174
|
-
var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($
|
|
11213
|
+
var InlineJSXBinaryOpRHS$0 = $TS($S($N($EXPECT($R57, "InlineJSXBinaryOpRHS /[<>]/")), BinaryOp, InlineJSXUnaryExpression), function($skip, $loc, $0, $1, $2, $3) {
|
|
11175
11214
|
var op = $2;
|
|
11176
11215
|
var rhs = $3;
|
|
11177
11216
|
return [[], op, [], rhs];
|
|
@@ -11188,7 +11227,7 @@ ${input.slice(result.pos)}
|
|
|
11188
11227
|
function InlineJSXUnaryExpression(ctx, state) {
|
|
11189
11228
|
return $EVENT(ctx, state, "InlineJSXUnaryExpression", InlineJSXUnaryExpression$0);
|
|
11190
11229
|
}
|
|
11191
|
-
var InlineJSXUnaryOp$0 = $TR($EXPECT($
|
|
11230
|
+
var InlineJSXUnaryOp$0 = $TR($EXPECT($R58, "InlineJSXUnaryOp /[!~+-](?!\\s|[!~+-]*&)/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
11192
11231
|
return { $loc, token: $0 };
|
|
11193
11232
|
});
|
|
11194
11233
|
function InlineJSXUnaryOp(ctx, state) {
|
|
@@ -11400,13 +11439,13 @@ ${input.slice(result.pos)}
|
|
|
11400
11439
|
function JSXComment(ctx, state) {
|
|
11401
11440
|
return $EVENT(ctx, state, "JSXComment", JSXComment$0);
|
|
11402
11441
|
}
|
|
11403
|
-
var JSXCommentContent$0 = $TR($EXPECT($
|
|
11442
|
+
var JSXCommentContent$0 = $TR($EXPECT($R59, "JSXCommentContent /(?:-[^-]|[^-]*)*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
11404
11443
|
return { $loc, token: $0.replace(/\*\//g, "* /") };
|
|
11405
11444
|
});
|
|
11406
11445
|
function JSXCommentContent(ctx, state) {
|
|
11407
11446
|
return $EVENT(ctx, state, "JSXCommentContent", JSXCommentContent$0);
|
|
11408
11447
|
}
|
|
11409
|
-
var JSXText$0 = $TR($EXPECT($
|
|
11448
|
+
var JSXText$0 = $TR($EXPECT($R60, "JSXText /[^{}<>\\r\\n]+/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
11410
11449
|
return {
|
|
11411
11450
|
type: "JSXText",
|
|
11412
11451
|
token: $0,
|
|
@@ -11771,7 +11810,7 @@ ${input.slice(result.pos)}
|
|
|
11771
11810
|
function TypeProperty(ctx, state) {
|
|
11772
11811
|
return $EVENT(ctx, state, "TypeProperty", TypeProperty$0);
|
|
11773
11812
|
}
|
|
11774
|
-
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($
|
|
11813
|
+
var TypeIndexSignature$0 = $S($E($S($R$0($EXPECT($R61, "TypeIndexSignature /[+-]?/")), Readonly, NotDedented)), OpenBracket, TypeIndex, CloseBracket, $E($S(__, $R$0($EXPECT($R62, "TypeIndexSignature /[+-]/")), $Y($S($E(_), QuestionMark)))));
|
|
11775
11814
|
function TypeIndexSignature(ctx, state) {
|
|
11776
11815
|
return $EVENT(ctx, state, "TypeIndexSignature", TypeIndexSignature$0);
|
|
11777
11816
|
}
|
|
@@ -12130,15 +12169,15 @@ ${input.slice(result.pos)}
|
|
|
12130
12169
|
function ThisType(ctx, state) {
|
|
12131
12170
|
return $EVENT(ctx, state, "ThisType", ThisType$0);
|
|
12132
12171
|
}
|
|
12133
|
-
var Shebang$0 = $S($R$0($EXPECT($
|
|
12172
|
+
var Shebang$0 = $S($R$0($EXPECT($R63, "Shebang /#![^\\r\\n]*/")), EOL);
|
|
12134
12173
|
function Shebang(ctx, state) {
|
|
12135
12174
|
return $EVENT(ctx, state, "Shebang", Shebang$0);
|
|
12136
12175
|
}
|
|
12137
|
-
var CivetPrologue$0 = $T($S($EXPECT($
|
|
12176
|
+
var CivetPrologue$0 = $T($S($EXPECT($R64, "CivetPrologue /[\\t ]*/"), DoubleQuote, CivetPrologueContent, DoubleQuote, SimpleStatementDelimiter, $E(EOS)), function(value) {
|
|
12138
12177
|
var content = value[2];
|
|
12139
12178
|
return content;
|
|
12140
12179
|
});
|
|
12141
|
-
var CivetPrologue$1 = $T($S($EXPECT($
|
|
12180
|
+
var CivetPrologue$1 = $T($S($EXPECT($R64, "CivetPrologue /[\\t ]*/"), SingleQuote, CivetPrologueContent, SingleQuote, SimpleStatementDelimiter, $E(EOS)), function(value) {
|
|
12142
12181
|
var content = value[2];
|
|
12143
12182
|
return content;
|
|
12144
12183
|
});
|
|
@@ -12146,7 +12185,7 @@ ${input.slice(result.pos)}
|
|
|
12146
12185
|
function CivetPrologue(ctx, state) {
|
|
12147
12186
|
return $EVENT_C(ctx, state, "CivetPrologue", CivetPrologue$$);
|
|
12148
12187
|
}
|
|
12149
|
-
var CivetPrologueContent$0 = $TS($S($EXPECT($L210, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($
|
|
12188
|
+
var CivetPrologueContent$0 = $TS($S($EXPECT($L210, 'CivetPrologueContent "civet"'), NonIdContinue, $Q(CivetOption), $EXPECT($R65, "CivetPrologueContent /[\\s]*/")), function($skip, $loc, $0, $1, $2, $3, $4) {
|
|
12150
12189
|
var options = $3;
|
|
12151
12190
|
return {
|
|
12152
12191
|
type: "CivetPrologue",
|
|
@@ -12157,7 +12196,7 @@ ${input.slice(result.pos)}
|
|
|
12157
12196
|
function CivetPrologueContent(ctx, state) {
|
|
12158
12197
|
return $EVENT(ctx, state, "CivetPrologueContent", CivetPrologueContent$0);
|
|
12159
12198
|
}
|
|
12160
|
-
var CivetOption$0 = $TR($EXPECT($
|
|
12199
|
+
var CivetOption$0 = $TR($EXPECT($R66, "CivetOption /\\s+([+-]?)([a-zA-Z0-9-]+)(\\s*=\\s*([a-zA-Z0-9.+-]*))?/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
12161
12200
|
const optionName = $2.replace(/-+([a-z]?)/g, (_2, l) => {
|
|
12162
12201
|
if (l)
|
|
12163
12202
|
return l.toUpperCase();
|
|
@@ -12174,11 +12213,11 @@ ${input.slice(result.pos)}
|
|
|
12174
12213
|
function CivetOption(ctx, state) {
|
|
12175
12214
|
return $EVENT(ctx, state, "CivetOption", CivetOption$0);
|
|
12176
12215
|
}
|
|
12177
|
-
var UnknownPrologue$0 = $S($R$0($EXPECT($
|
|
12216
|
+
var UnknownPrologue$0 = $S($R$0($EXPECT($R64, "UnknownPrologue /[\\t ]*/")), StringLiteral, $TEXT(SimpleStatementDelimiter), EOS);
|
|
12178
12217
|
function UnknownPrologue(ctx, state) {
|
|
12179
12218
|
return $EVENT(ctx, state, "UnknownPrologue", UnknownPrologue$0);
|
|
12180
12219
|
}
|
|
12181
|
-
var TripleSlashDirective$0 = $S($R$0($EXPECT($
|
|
12220
|
+
var TripleSlashDirective$0 = $S($R$0($EXPECT($R67, "TripleSlashDirective /\\/\\/\\/[^\\r\\n]*/")), $E(EOS));
|
|
12182
12221
|
function TripleSlashDirective(ctx, state) {
|
|
12183
12222
|
return $EVENT(ctx, state, "TripleSlashDirective", TripleSlashDirective$0);
|
|
12184
12223
|
}
|
|
@@ -12192,11 +12231,13 @@ ${input.slice(result.pos)}
|
|
|
12192
12231
|
function PrologueString(ctx, state) {
|
|
12193
12232
|
return $EVENT_C(ctx, state, "PrologueString", PrologueString$$);
|
|
12194
12233
|
}
|
|
12195
|
-
var EOS$0 = $P(RestOfLine)
|
|
12234
|
+
var EOS$0 = $T($S($EXPECT($R68, "EOS /(?=[ \\t\\r\\n\\/#]|$)/"), $P(RestOfLine)), function(value) {
|
|
12235
|
+
return value[1];
|
|
12236
|
+
});
|
|
12196
12237
|
function EOS(ctx, state) {
|
|
12197
12238
|
return $EVENT(ctx, state, "EOS", EOS$0);
|
|
12198
12239
|
}
|
|
12199
|
-
var EOL$0 = $TR($EXPECT($
|
|
12240
|
+
var EOL$0 = $TR($EXPECT($R69, "EOL /\\r\\n|\\n|\\r|$/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
12200
12241
|
return { $loc, token: $0 };
|
|
12201
12242
|
});
|
|
12202
12243
|
function EOL(ctx, state) {
|
|
@@ -12690,7 +12731,7 @@ ${input.slice(result.pos)}
|
|
|
12690
12731
|
function Init(ctx, state) {
|
|
12691
12732
|
return $EVENT(ctx, state, "Init", Init$0);
|
|
12692
12733
|
}
|
|
12693
|
-
var Indent$0 = $TR($EXPECT($
|
|
12734
|
+
var Indent$0 = $TR($EXPECT($R70, "Indent /[ \\t]*/"), function($skip, $loc, $0, $1, $2, $3, $4, $5, $6, $7, $8, $9) {
|
|
12694
12735
|
const level = getIndentLevel($0, module.config.tab);
|
|
12695
12736
|
return {
|
|
12696
12737
|
$loc,
|
|
@@ -13190,6 +13231,7 @@ ${input.slice(result.pos)}
|
|
|
13190
13231
|
exports.TemplateBlockCharacters = TemplateBlockCharacters;
|
|
13191
13232
|
exports.ReservedWord = ReservedWord;
|
|
13192
13233
|
exports.Comment = Comment;
|
|
13234
|
+
exports._Comment = _Comment;
|
|
13193
13235
|
exports.SingleLineComment = SingleLineComment;
|
|
13194
13236
|
exports.JSSingleLineComment = JSSingleLineComment;
|
|
13195
13237
|
exports.MultiLineComment = MultiLineComment;
|
|
@@ -13504,6 +13546,7 @@ ${input.slice(result.pos)}
|
|
|
13504
13546
|
makeRef,
|
|
13505
13547
|
maybeRef,
|
|
13506
13548
|
modifyString,
|
|
13549
|
+
negateCondition,
|
|
13507
13550
|
processAssignmentDeclaration,
|
|
13508
13551
|
processBinaryOpExpression,
|
|
13509
13552
|
processCallMemberExpression,
|
package/dist/civet
CHANGED
|
@@ -42,39 +42,39 @@ if (process.argv.includes("--version")) {
|
|
|
42
42
|
process.exit(0);
|
|
43
43
|
}
|
|
44
44
|
if (process.argv.includes("--help")) {
|
|
45
|
-
process.stderr.write(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
process.stderr.write(` \u2584\u2584\xB7 \u25AA \u258C \u2590\xB7\u2584\u2584\u2584 .\u2584\u2584\u2584\u2584\u2584
|
|
46
|
+
\u2590\u2588 \u258C\u25AA\u2588\u2588 \u25AA\u2588\xB7\u2588\u258C\u2580\u2584.\u2580\xB7\u2022\u2588\u2588 _._ _,-'""\`-._
|
|
47
|
+
\u2588\u2588 \u2584\u2584\u2590\u2588\xB7\u2590\u2588\u2590\u2588\u2022\u2590\u2580\u2580\u25AA\u2584 \u2590\u2588.\u25AA (,-.\`._,'( |\\\`-/|
|
|
48
|
+
\u2590\u2588\u2588\u2588\u258C\u2590\u2588\u258C \u2588\u2588\u2588 \u2590\u2588\u2584\u2584\u258C \u2590\u2588\u258C\xB7 \`-.-' \\ )-\`( , o o)
|
|
49
|
+
\xB7\u2580\u2580\u2580 \u2580\u2580\u2580. \u2580 \u2580\u2580\u2580 \u2580\u2580\u2580 \`- \\\`_\`"'-
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
Usage:
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
civet # REPL for executing code
|
|
55
|
+
civet -c # REPL for transpiling code
|
|
56
|
+
civet --ast # REPL for parsing code
|
|
57
|
+
civet [options] input.civet # run input.civet
|
|
58
|
+
civet [options] -c input.civet # -> input.civet.tsx
|
|
59
|
+
civet [options] -c input.civet -o .ts # -> input.ts
|
|
60
|
+
civet [options] -c input.civet -o dir # -> dir/input.civet.tsx
|
|
61
|
+
civet [options] -c input.civet -o dir/.ts # -> dir/input.ts
|
|
62
|
+
civet [options] -c input.civet -o output.ts # -> output.ts
|
|
63
|
+
civet [options] < input.civet > output.ts # pipe form
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
Options:
|
|
66
|
+
--help Show this help message
|
|
67
|
+
--version Show the version number
|
|
68
|
+
-o / --output XX Specify output directory and/or extension, or filename
|
|
69
|
+
-c / --compile Compile input files to TypeScript (or JavaScript)
|
|
70
|
+
--config XX Specify a config file (default scans for a config.civet, civet.json, civetconfig.civet or civetconfig.json file, optionally in a .config directory, or starting with a .)
|
|
71
|
+
--no-config Don't scan for a config file
|
|
72
|
+
--js Strip out all type annotations; default to .jsx extension
|
|
73
|
+
--ast Print the AST instead of the compiled code
|
|
74
|
+
--inline-map Generate a sourcemap
|
|
75
|
+
--no-cache Disable compiler caching (slow, for debugging)
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
You can use - to read from stdin or (prefixed by -o) write to stdout.
|
|
78
78
|
|
|
79
79
|
`);
|
|
80
80
|
process.exit(0);
|