@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/index.js
CHANGED
|
@@ -5612,6 +5612,7 @@ var ContextStackImpl = /** @class */ (function () {
|
|
|
5612
5612
|
if (normalExpressionKeys.includes(name)) {
|
|
5613
5613
|
throw new Error("Cannot shadow builtin function \"".concat(name, "\""));
|
|
5614
5614
|
}
|
|
5615
|
+
this.addValue(name, value);
|
|
5615
5616
|
this.globalContext[name] = { value: value };
|
|
5616
5617
|
};
|
|
5617
5618
|
ContextStackImpl.prototype.addValue = function (name, value) {
|
|
@@ -7396,27 +7397,49 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7396
7397
|
AlgebraicParser.prototype.parseExport = function (token) {
|
|
7397
7398
|
var _a;
|
|
7398
7399
|
this.advance();
|
|
7399
|
-
|
|
7400
|
-
|
|
7400
|
+
if (isA_SymbolToken(this.peek(), 'let')) {
|
|
7401
|
+
this.advance();
|
|
7402
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7403
|
+
assertA_OperatorToken(this.peek(), '=');
|
|
7404
|
+
this.advance();
|
|
7405
|
+
var value = this.parseExpression();
|
|
7406
|
+
assertA_OperatorToken(this.peek(), ';');
|
|
7401
7407
|
return {
|
|
7402
7408
|
t: exports.AstNodeType.SpecialExpression,
|
|
7403
7409
|
n: 'def',
|
|
7404
|
-
p: [symbol,
|
|
7410
|
+
p: [symbol, value],
|
|
7411
|
+
token: getTokenDebugData(symbol.token) && symbol.token,
|
|
7412
|
+
};
|
|
7413
|
+
}
|
|
7414
|
+
else if (isA_ReservedSymbolToken(this.peek(), 'function')) {
|
|
7415
|
+
this.advance();
|
|
7416
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7417
|
+
var _b = this.parseFunctionArguments(), functionArguments = _b.functionArguments, arity = _b.arity;
|
|
7418
|
+
var body = [];
|
|
7419
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7420
|
+
body.push(this.parseExpression());
|
|
7421
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7422
|
+
this.advance();
|
|
7423
|
+
}
|
|
7424
|
+
}
|
|
7425
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7426
|
+
this.advance();
|
|
7427
|
+
return {
|
|
7428
|
+
t: exports.AstNodeType.SpecialExpression,
|
|
7429
|
+
n: 'defn',
|
|
7430
|
+
f: symbol,
|
|
7431
|
+
p: [],
|
|
7432
|
+
o: [{
|
|
7433
|
+
as: functionArguments,
|
|
7434
|
+
b: body,
|
|
7435
|
+
a: arity,
|
|
7436
|
+
}],
|
|
7405
7437
|
token: getTokenDebugData(token) && token,
|
|
7406
7438
|
};
|
|
7407
7439
|
}
|
|
7408
|
-
|
|
7409
|
-
throw new LitsError('Expected
|
|
7440
|
+
else {
|
|
7441
|
+
throw new LitsError('Expected let or function', (_a = getTokenDebugData(this.peek())) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
7410
7442
|
}
|
|
7411
|
-
this.advance();
|
|
7412
|
-
var value = this.parseExpression();
|
|
7413
|
-
assertA_OperatorToken(this.peek(), ';');
|
|
7414
|
-
return {
|
|
7415
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
7416
|
-
n: 'def',
|
|
7417
|
-
p: [symbol, value],
|
|
7418
|
-
token: getTokenDebugData(token) && token,
|
|
7419
|
-
};
|
|
7420
7443
|
};
|
|
7421
7444
|
return AlgebraicParser;
|
|
7422
7445
|
}());
|