@mojir/lits 2.0.18 → 2.0.19
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/cli/cli.js +38 -15
- package/dist/index.esm.js +37 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +37 -14
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +37 -14
- package/dist/lits.iife.js.map +1 -1
- package/dist/testFramework.esm.js +37 -14
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +37 -14
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -92,7 +92,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
92
92
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
var version = "2.0.
|
|
95
|
+
var version = "2.0.19";
|
|
96
96
|
|
|
97
97
|
var AstNodeType;
|
|
98
98
|
(function (AstNodeType) {
|
|
@@ -5580,6 +5580,7 @@ var ContextStackImpl = /** @class */ (function () {
|
|
|
5580
5580
|
if (normalExpressionKeys.includes(name)) {
|
|
5581
5581
|
throw new Error("Cannot shadow builtin function \"".concat(name, "\""));
|
|
5582
5582
|
}
|
|
5583
|
+
this.addValue(name, value);
|
|
5583
5584
|
this.globalContext[name] = { value: value };
|
|
5584
5585
|
};
|
|
5585
5586
|
ContextStackImpl.prototype.addValue = function (name, value) {
|
|
@@ -7364,27 +7365,49 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7364
7365
|
AlgebraicParser.prototype.parseExport = function (token) {
|
|
7365
7366
|
var _a;
|
|
7366
7367
|
this.advance();
|
|
7367
|
-
|
|
7368
|
-
|
|
7368
|
+
if (isA_SymbolToken(this.peek(), 'let')) {
|
|
7369
|
+
this.advance();
|
|
7370
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7371
|
+
assertA_OperatorToken(this.peek(), '=');
|
|
7372
|
+
this.advance();
|
|
7373
|
+
var value = this.parseExpression();
|
|
7374
|
+
assertA_OperatorToken(this.peek(), ';');
|
|
7369
7375
|
return {
|
|
7370
7376
|
t: AstNodeType.SpecialExpression,
|
|
7371
7377
|
n: 'def',
|
|
7372
|
-
p: [symbol,
|
|
7378
|
+
p: [symbol, value],
|
|
7379
|
+
token: getTokenDebugData(symbol.token) && symbol.token,
|
|
7380
|
+
};
|
|
7381
|
+
}
|
|
7382
|
+
else if (isA_ReservedSymbolToken(this.peek(), 'function')) {
|
|
7383
|
+
this.advance();
|
|
7384
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7385
|
+
var _b = this.parseFunctionArguments(), functionArguments = _b.functionArguments, arity = _b.arity;
|
|
7386
|
+
var body = [];
|
|
7387
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7388
|
+
body.push(this.parseExpression());
|
|
7389
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7390
|
+
this.advance();
|
|
7391
|
+
}
|
|
7392
|
+
}
|
|
7393
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7394
|
+
this.advance();
|
|
7395
|
+
return {
|
|
7396
|
+
t: AstNodeType.SpecialExpression,
|
|
7397
|
+
n: 'defn',
|
|
7398
|
+
f: symbol,
|
|
7399
|
+
p: [],
|
|
7400
|
+
o: [{
|
|
7401
|
+
as: functionArguments,
|
|
7402
|
+
b: body,
|
|
7403
|
+
a: arity,
|
|
7404
|
+
}],
|
|
7373
7405
|
token: getTokenDebugData(token) && token,
|
|
7374
7406
|
};
|
|
7375
7407
|
}
|
|
7376
|
-
|
|
7377
|
-
throw new LitsError('Expected
|
|
7408
|
+
else {
|
|
7409
|
+
throw new LitsError('Expected let or function', (_a = getTokenDebugData(this.peek())) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
7378
7410
|
}
|
|
7379
|
-
this.advance();
|
|
7380
|
-
var value = this.parseExpression();
|
|
7381
|
-
assertA_OperatorToken(this.peek(), ';');
|
|
7382
|
-
return {
|
|
7383
|
-
t: AstNodeType.SpecialExpression,
|
|
7384
|
-
n: 'def',
|
|
7385
|
-
p: [symbol, value],
|
|
7386
|
-
token: getTokenDebugData(token) && token,
|
|
7387
|
-
};
|
|
7388
7411
|
};
|
|
7389
7412
|
return AlgebraicParser;
|
|
7390
7413
|
}());
|
package/dist/index.esm.js
CHANGED
|
@@ -5610,6 +5610,7 @@ var ContextStackImpl = /** @class */ (function () {
|
|
|
5610
5610
|
if (normalExpressionKeys.includes(name)) {
|
|
5611
5611
|
throw new Error("Cannot shadow builtin function \"".concat(name, "\""));
|
|
5612
5612
|
}
|
|
5613
|
+
this.addValue(name, value);
|
|
5613
5614
|
this.globalContext[name] = { value: value };
|
|
5614
5615
|
};
|
|
5615
5616
|
ContextStackImpl.prototype.addValue = function (name, value) {
|
|
@@ -7394,27 +7395,49 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7394
7395
|
AlgebraicParser.prototype.parseExport = function (token) {
|
|
7395
7396
|
var _a;
|
|
7396
7397
|
this.advance();
|
|
7397
|
-
|
|
7398
|
-
|
|
7398
|
+
if (isA_SymbolToken(this.peek(), 'let')) {
|
|
7399
|
+
this.advance();
|
|
7400
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7401
|
+
assertA_OperatorToken(this.peek(), '=');
|
|
7402
|
+
this.advance();
|
|
7403
|
+
var value = this.parseExpression();
|
|
7404
|
+
assertA_OperatorToken(this.peek(), ';');
|
|
7399
7405
|
return {
|
|
7400
7406
|
t: AstNodeType.SpecialExpression,
|
|
7401
7407
|
n: 'def',
|
|
7402
|
-
p: [symbol,
|
|
7408
|
+
p: [symbol, value],
|
|
7409
|
+
token: getTokenDebugData(symbol.token) && symbol.token,
|
|
7410
|
+
};
|
|
7411
|
+
}
|
|
7412
|
+
else if (isA_ReservedSymbolToken(this.peek(), 'function')) {
|
|
7413
|
+
this.advance();
|
|
7414
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7415
|
+
var _b = this.parseFunctionArguments(), functionArguments = _b.functionArguments, arity = _b.arity;
|
|
7416
|
+
var body = [];
|
|
7417
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7418
|
+
body.push(this.parseExpression());
|
|
7419
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7420
|
+
this.advance();
|
|
7421
|
+
}
|
|
7422
|
+
}
|
|
7423
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7424
|
+
this.advance();
|
|
7425
|
+
return {
|
|
7426
|
+
t: AstNodeType.SpecialExpression,
|
|
7427
|
+
n: 'defn',
|
|
7428
|
+
f: symbol,
|
|
7429
|
+
p: [],
|
|
7430
|
+
o: [{
|
|
7431
|
+
as: functionArguments,
|
|
7432
|
+
b: body,
|
|
7433
|
+
a: arity,
|
|
7434
|
+
}],
|
|
7403
7435
|
token: getTokenDebugData(token) && token,
|
|
7404
7436
|
};
|
|
7405
7437
|
}
|
|
7406
|
-
|
|
7407
|
-
throw new LitsError('Expected
|
|
7438
|
+
else {
|
|
7439
|
+
throw new LitsError('Expected let or function', (_a = getTokenDebugData(this.peek())) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
7408
7440
|
}
|
|
7409
|
-
this.advance();
|
|
7410
|
-
var value = this.parseExpression();
|
|
7411
|
-
assertA_OperatorToken(this.peek(), ';');
|
|
7412
|
-
return {
|
|
7413
|
-
t: AstNodeType.SpecialExpression,
|
|
7414
|
-
n: 'def',
|
|
7415
|
-
p: [symbol, value],
|
|
7416
|
-
token: getTokenDebugData(token) && token,
|
|
7417
|
-
};
|
|
7418
7441
|
};
|
|
7419
7442
|
return AlgebraicParser;
|
|
7420
7443
|
}());
|