@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
|
@@ -5572,6 +5572,7 @@ var ContextStackImpl = /** @class */ (function () {
|
|
|
5572
5572
|
if (normalExpressionKeys.includes(name)) {
|
|
5573
5573
|
throw new Error("Cannot shadow builtin function \"".concat(name, "\""));
|
|
5574
5574
|
}
|
|
5575
|
+
this.addValue(name, value);
|
|
5575
5576
|
this.globalContext[name] = { value: value };
|
|
5576
5577
|
};
|
|
5577
5578
|
ContextStackImpl.prototype.addValue = function (name, value) {
|
|
@@ -7356,27 +7357,49 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7356
7357
|
AlgebraicParser.prototype.parseExport = function (token) {
|
|
7357
7358
|
var _a;
|
|
7358
7359
|
this.advance();
|
|
7359
|
-
|
|
7360
|
-
|
|
7360
|
+
if (isA_SymbolToken(this.peek(), 'let')) {
|
|
7361
|
+
this.advance();
|
|
7362
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7363
|
+
assertA_OperatorToken(this.peek(), '=');
|
|
7364
|
+
this.advance();
|
|
7365
|
+
var value = this.parseExpression();
|
|
7366
|
+
assertA_OperatorToken(this.peek(), ';');
|
|
7361
7367
|
return {
|
|
7362
7368
|
t: AstNodeType.SpecialExpression,
|
|
7363
7369
|
n: 'def',
|
|
7364
|
-
p: [symbol,
|
|
7370
|
+
p: [symbol, value],
|
|
7371
|
+
token: getTokenDebugData(symbol.token) && symbol.token,
|
|
7372
|
+
};
|
|
7373
|
+
}
|
|
7374
|
+
else if (isA_ReservedSymbolToken(this.peek(), 'function')) {
|
|
7375
|
+
this.advance();
|
|
7376
|
+
var symbol = parseSymbol(this.tokenStream, this.parseState);
|
|
7377
|
+
var _b = this.parseFunctionArguments(), functionArguments = _b.functionArguments, arity = _b.arity;
|
|
7378
|
+
var body = [];
|
|
7379
|
+
while (!this.isAtEnd() && !isA_ReservedSymbolToken(this.peek(), 'end')) {
|
|
7380
|
+
body.push(this.parseExpression());
|
|
7381
|
+
if (isA_OperatorToken(this.peek(), ';')) {
|
|
7382
|
+
this.advance();
|
|
7383
|
+
}
|
|
7384
|
+
}
|
|
7385
|
+
assertA_ReservedSymbolToken(this.peek(), 'end');
|
|
7386
|
+
this.advance();
|
|
7387
|
+
return {
|
|
7388
|
+
t: AstNodeType.SpecialExpression,
|
|
7389
|
+
n: 'defn',
|
|
7390
|
+
f: symbol,
|
|
7391
|
+
p: [],
|
|
7392
|
+
o: [{
|
|
7393
|
+
as: functionArguments,
|
|
7394
|
+
b: body,
|
|
7395
|
+
a: arity,
|
|
7396
|
+
}],
|
|
7365
7397
|
token: getTokenDebugData(token) && token,
|
|
7366
7398
|
};
|
|
7367
7399
|
}
|
|
7368
|
-
|
|
7369
|
-
throw new LitsError('Expected
|
|
7400
|
+
else {
|
|
7401
|
+
throw new LitsError('Expected let or function', (_a = getTokenDebugData(this.peek())) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
|
|
7370
7402
|
}
|
|
7371
|
-
this.advance();
|
|
7372
|
-
var value = this.parseExpression();
|
|
7373
|
-
assertA_OperatorToken(this.peek(), ';');
|
|
7374
|
-
return {
|
|
7375
|
-
t: AstNodeType.SpecialExpression,
|
|
7376
|
-
n: 'def',
|
|
7377
|
-
p: [symbol, value],
|
|
7378
|
-
token: getTokenDebugData(token) && token,
|
|
7379
|
-
};
|
|
7380
7403
|
};
|
|
7381
7404
|
return AlgebraicParser;
|
|
7382
7405
|
}());
|