@mojir/lits 2.0.9 → 2.0.10
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 +68 -175
- package/dist/cli/src/builtin/index.d.ts +3 -0
- package/dist/cli/src/builtin/interface.d.ts +4 -2
- package/dist/cli/src/builtin/specialExpressions/commonParser.d.ts +4 -0
- package/dist/index.esm.js +68 -175
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +68 -175
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +68 -175
- package/dist/lits.iife.js.map +1 -1
- package/dist/src/builtin/index.d.ts +3 -0
- package/dist/src/builtin/interface.d.ts +4 -2
- package/dist/src/builtin/specialExpressions/commonParser.d.ts +4 -0
- package/dist/testFramework.esm.js +68 -175
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +68 -175
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3163,7 +3163,7 @@ var mathNormalExpression = {
|
|
|
3163
3163
|
},
|
|
3164
3164
|
};
|
|
3165
3165
|
|
|
3166
|
-
var version = "2.0.
|
|
3166
|
+
var version = "2.0.10";
|
|
3167
3167
|
|
|
3168
3168
|
var uuidTemplate = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
|
|
3169
3169
|
var xyRegexp = /[xy]/g;
|
|
@@ -4378,6 +4378,7 @@ var andSpecialExpression = {
|
|
|
4378
4378
|
};
|
|
4379
4379
|
return node;
|
|
4380
4380
|
},
|
|
4381
|
+
validateParameterCount: function () { return undefined; },
|
|
4381
4382
|
evaluate: function (node, contextStack, _a) {
|
|
4382
4383
|
var e_1, _b;
|
|
4383
4384
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -4405,42 +4406,30 @@ var andSpecialExpression = {
|
|
|
4405
4406
|
},
|
|
4406
4407
|
};
|
|
4407
4408
|
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
var parseToken = _a.parseToken;
|
|
4411
|
-
var node = {
|
|
4412
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
4413
|
-
n: 'comment',
|
|
4414
|
-
p: [],
|
|
4415
|
-
token: undefined,
|
|
4416
|
-
};
|
|
4417
|
-
var tkn = asToken(tokenStream.tokens[parseState.position]);
|
|
4418
|
-
while (!isRParenToken(tkn)) {
|
|
4419
|
-
node.p.push(parseToken(tokenStream, parseState));
|
|
4420
|
-
tkn = asToken(tokenStream.tokens[parseState.position]);
|
|
4421
|
-
}
|
|
4422
|
-
parseState.position += 1;
|
|
4423
|
-
node.token = getTokenDebugData(firstToken) && firstToken;
|
|
4424
|
-
return node;
|
|
4425
|
-
},
|
|
4426
|
-
evaluate: function () { return null; },
|
|
4427
|
-
findUnresolvedIdentifiers: function () { return new Set(); },
|
|
4428
|
-
};
|
|
4429
|
-
|
|
4430
|
-
var condSpecialExpression = {
|
|
4431
|
-
parse: function (tokenStream, parseState, firstToken, _a) {
|
|
4409
|
+
function getCommonParser(name) {
|
|
4410
|
+
return function (tokenStream, parseState, firstToken, _a) {
|
|
4432
4411
|
var parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
|
|
4433
4412
|
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
4434
4413
|
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
4435
|
-
|
|
4414
|
+
return {
|
|
4436
4415
|
t: exports.AstNodeType.SpecialExpression,
|
|
4437
|
-
n:
|
|
4416
|
+
n: name,
|
|
4438
4417
|
p: params,
|
|
4439
4418
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
4440
4419
|
};
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4420
|
+
};
|
|
4421
|
+
}
|
|
4422
|
+
|
|
4423
|
+
var commentSpecialExpression = {
|
|
4424
|
+
parse: getCommonParser('comment'),
|
|
4425
|
+
validateParameterCount: function () { return undefined; },
|
|
4426
|
+
evaluate: function () { return null; },
|
|
4427
|
+
findUnresolvedIdentifiers: function () { return new Set(); },
|
|
4428
|
+
};
|
|
4429
|
+
|
|
4430
|
+
var condSpecialExpression = {
|
|
4431
|
+
parse: getCommonParser('cond'),
|
|
4432
|
+
validateParameterCount: function (node) { return assertEvenNumberOfParams(node); },
|
|
4444
4433
|
evaluate: function (node, contextStack, _a) {
|
|
4445
4434
|
var e_1, _b;
|
|
4446
4435
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -4469,19 +4458,8 @@ var condSpecialExpression = {
|
|
|
4469
4458
|
};
|
|
4470
4459
|
|
|
4471
4460
|
var declaredSpecialExpression = {
|
|
4472
|
-
parse:
|
|
4473
|
-
|
|
4474
|
-
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
4475
|
-
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
4476
|
-
var node = {
|
|
4477
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
4478
|
-
n: 'declared?',
|
|
4479
|
-
p: params,
|
|
4480
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
4481
|
-
};
|
|
4482
|
-
assertNumberOfParams(1, node);
|
|
4483
|
-
return node;
|
|
4484
|
-
},
|
|
4461
|
+
parse: getCommonParser('declared?'),
|
|
4462
|
+
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
4485
4463
|
evaluate: function (node, contextStack) {
|
|
4486
4464
|
var lookUpResult = contextStack.lookUp(node.p[0]);
|
|
4487
4465
|
return lookUpResult !== null;
|
|
@@ -4527,9 +4505,9 @@ var defSpecialExpression = {
|
|
|
4527
4505
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
4528
4506
|
};
|
|
4529
4507
|
assertSymbolNode(node.p[0], (_b = getTokenDebugData(node.token)) === null || _b === void 0 ? void 0 : _b.sourceCodeInfo);
|
|
4530
|
-
assertNumberOfParams(2, node);
|
|
4531
4508
|
return node;
|
|
4532
4509
|
},
|
|
4510
|
+
validateParameterCount: function (node) { return assertNumberOfParams(2, node); },
|
|
4533
4511
|
evaluate: function (node, contextStack, _a) {
|
|
4534
4512
|
var _b;
|
|
4535
4513
|
var evaluateAstNode = _a.evaluateAstNode, builtin = _a.builtin;
|
|
@@ -4565,9 +4543,9 @@ var defsSpecialExpression = {
|
|
|
4565
4543
|
p: params,
|
|
4566
4544
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
4567
4545
|
};
|
|
4568
|
-
assertNumberOfParams(2, node);
|
|
4569
4546
|
return node;
|
|
4570
4547
|
},
|
|
4548
|
+
validateParameterCount: function (node) { return assertNumberOfParams(2, node); },
|
|
4571
4549
|
evaluate: function (node, contextStack, _a) {
|
|
4572
4550
|
var _b, _c;
|
|
4573
4551
|
var evaluateAstNode = _a.evaluateAstNode, builtin = _a.builtin;
|
|
@@ -4595,23 +4573,8 @@ var defsSpecialExpression = {
|
|
|
4595
4573
|
};
|
|
4596
4574
|
|
|
4597
4575
|
var doSpecialExpression = {
|
|
4598
|
-
parse:
|
|
4599
|
-
|
|
4600
|
-
var node = {
|
|
4601
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
4602
|
-
n: 'do',
|
|
4603
|
-
p: [],
|
|
4604
|
-
token: undefined,
|
|
4605
|
-
};
|
|
4606
|
-
var tkn = asToken(tokenStream.tokens[parseState.position]);
|
|
4607
|
-
while (!isRParenToken(tkn)) {
|
|
4608
|
-
node.p.push(parseToken(tokenStream, parseState));
|
|
4609
|
-
tkn = asToken(tokenStream.tokens[parseState.position]);
|
|
4610
|
-
}
|
|
4611
|
-
parseState.position += 1;
|
|
4612
|
-
node.token = getTokenDebugData(firstToken) && firstToken;
|
|
4613
|
-
return node;
|
|
4614
|
-
},
|
|
4576
|
+
parse: getCommonParser('do'),
|
|
4577
|
+
validateParameterCount: function () { return undefined; },
|
|
4615
4578
|
evaluate: function (node, contextStack, _a) {
|
|
4616
4579
|
var e_1, _b;
|
|
4617
4580
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -4688,6 +4651,7 @@ var defnSpecialExpression = {
|
|
|
4688
4651
|
};
|
|
4689
4652
|
return node;
|
|
4690
4653
|
},
|
|
4654
|
+
validateParameterCount: function () { return undefined; },
|
|
4691
4655
|
evaluate: function (node, contextStack, _a) {
|
|
4692
4656
|
var _b;
|
|
4693
4657
|
var _c, _d;
|
|
@@ -4729,6 +4693,7 @@ var defnsSpecialExpression = {
|
|
|
4729
4693
|
};
|
|
4730
4694
|
return node;
|
|
4731
4695
|
},
|
|
4696
|
+
validateParameterCount: function () { return undefined; },
|
|
4732
4697
|
evaluate: function (node, contextStack, _a) {
|
|
4733
4698
|
var _b;
|
|
4734
4699
|
var _c, _d;
|
|
@@ -4772,6 +4737,7 @@ var fnSpecialExpression = {
|
|
|
4772
4737
|
};
|
|
4773
4738
|
return node;
|
|
4774
4739
|
},
|
|
4740
|
+
validateParameterCount: function () { return undefined; },
|
|
4775
4741
|
evaluate: function (node, contextStack, _a) {
|
|
4776
4742
|
var _b;
|
|
4777
4743
|
var _c;
|
|
@@ -5003,19 +4969,8 @@ function parseFunctionArguments(tokenStream, parseState, parsers) {
|
|
|
5003
4969
|
}
|
|
5004
4970
|
|
|
5005
4971
|
var ifSpecialExpression = {
|
|
5006
|
-
parse:
|
|
5007
|
-
|
|
5008
|
-
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
5009
|
-
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5010
|
-
var node = {
|
|
5011
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
5012
|
-
n: 'if',
|
|
5013
|
-
p: params,
|
|
5014
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
5015
|
-
};
|
|
5016
|
-
assertNumberOfParams({ min: 2, max: 3 }, node);
|
|
5017
|
-
return node;
|
|
5018
|
-
},
|
|
4972
|
+
parse: getCommonParser('if'),
|
|
4973
|
+
validateParameterCount: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
5019
4974
|
evaluate: function (node, contextStack, _a) {
|
|
5020
4975
|
var _b;
|
|
5021
4976
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -5054,9 +5009,9 @@ var ifLetSpecialExpression = {
|
|
|
5054
5009
|
p: params,
|
|
5055
5010
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
5056
5011
|
};
|
|
5057
|
-
assertNumberOfParams({ min: 1, max: 2 }, node);
|
|
5058
5012
|
return node;
|
|
5059
5013
|
},
|
|
5014
|
+
validateParameterCount: function (node) { return assertNumberOfParams({ min: 1, max: 2 }, node); },
|
|
5060
5015
|
evaluate: function (node, contextStack, _a) {
|
|
5061
5016
|
var _b;
|
|
5062
5017
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -5086,19 +5041,8 @@ var ifLetSpecialExpression = {
|
|
|
5086
5041
|
};
|
|
5087
5042
|
|
|
5088
5043
|
var ifNotSpecialExpression = {
|
|
5089
|
-
parse:
|
|
5090
|
-
|
|
5091
|
-
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
5092
|
-
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5093
|
-
var node = {
|
|
5094
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
5095
|
-
n: 'if-not',
|
|
5096
|
-
p: params,
|
|
5097
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
5098
|
-
};
|
|
5099
|
-
assertNumberOfParams({ min: 2, max: 3 }, node);
|
|
5100
|
-
return node;
|
|
5101
|
-
},
|
|
5044
|
+
parse: getCommonParser('if-not'),
|
|
5045
|
+
validateParameterCount: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
|
|
5102
5046
|
evaluate: function (node, contextStack, _a) {
|
|
5103
5047
|
var _b;
|
|
5104
5048
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -5135,6 +5079,7 @@ var letSpecialExpression = {
|
|
|
5135
5079
|
};
|
|
5136
5080
|
return node;
|
|
5137
5081
|
},
|
|
5082
|
+
validateParameterCount: function () { return undefined; },
|
|
5138
5083
|
evaluate: function (node, contextStack, _a) {
|
|
5139
5084
|
var e_1, _b, e_2, _c;
|
|
5140
5085
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -5206,6 +5151,7 @@ var loopSpecialExpression = {
|
|
|
5206
5151
|
};
|
|
5207
5152
|
return node;
|
|
5208
5153
|
},
|
|
5154
|
+
validateParameterCount: function () { return undefined; },
|
|
5209
5155
|
evaluate: function (node, contextStack, _a) {
|
|
5210
5156
|
var _b;
|
|
5211
5157
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -5469,9 +5415,9 @@ var forSpecialExpression = {
|
|
|
5469
5415
|
p: params,
|
|
5470
5416
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
5471
5417
|
};
|
|
5472
|
-
assertNumberOfParams(1, node);
|
|
5473
5418
|
return node;
|
|
5474
5419
|
},
|
|
5420
|
+
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
5475
5421
|
evaluate: function (node, contextStack, helpers) { return evaluateLoop(true, node, contextStack, helpers.evaluateAstNode); },
|
|
5476
5422
|
findUnresolvedIdentifiers: function (node, contextStack, _a) {
|
|
5477
5423
|
var findUnresolvedIdentifiers = _a.findUnresolvedIdentifiers, builtin = _a.builtin;
|
|
@@ -5491,9 +5437,9 @@ var doseqSpecialExpression = {
|
|
|
5491
5437
|
p: params,
|
|
5492
5438
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
5493
5439
|
};
|
|
5494
|
-
assertNumberOfParams(1, node);
|
|
5495
5440
|
return node;
|
|
5496
5441
|
},
|
|
5442
|
+
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
5497
5443
|
evaluate: function (node, contextStack, helpers) {
|
|
5498
5444
|
evaluateLoop(false, node, contextStack, helpers.evaluateAstNode);
|
|
5499
5445
|
return null;
|
|
@@ -5505,18 +5451,8 @@ var doseqSpecialExpression = {
|
|
|
5505
5451
|
};
|
|
5506
5452
|
|
|
5507
5453
|
var orSpecialExpression = {
|
|
5508
|
-
parse:
|
|
5509
|
-
|
|
5510
|
-
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
5511
|
-
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5512
|
-
var node = {
|
|
5513
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
5514
|
-
n: 'or',
|
|
5515
|
-
p: params,
|
|
5516
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
5517
|
-
};
|
|
5518
|
-
return node;
|
|
5519
|
-
},
|
|
5454
|
+
parse: getCommonParser('or'),
|
|
5455
|
+
validateParameterCount: function () { return undefined; },
|
|
5520
5456
|
evaluate: function (node, contextStack, _a) {
|
|
5521
5457
|
var e_1, _b;
|
|
5522
5458
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -5545,19 +5481,8 @@ var orSpecialExpression = {
|
|
|
5545
5481
|
};
|
|
5546
5482
|
|
|
5547
5483
|
var qqSpecialExpression = {
|
|
5548
|
-
parse:
|
|
5549
|
-
|
|
5550
|
-
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
5551
|
-
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5552
|
-
var node = {
|
|
5553
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
5554
|
-
n: '??',
|
|
5555
|
-
p: params,
|
|
5556
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
5557
|
-
};
|
|
5558
|
-
assertNumberOfParams({ min: 1, max: 2 }, node);
|
|
5559
|
-
return node;
|
|
5560
|
-
},
|
|
5484
|
+
parse: getCommonParser('??'),
|
|
5485
|
+
validateParameterCount: function (node) { return assertNumberOfParams({ min: 1, max: 2 }, node); },
|
|
5561
5486
|
evaluate: function (node, contextStack, _a) {
|
|
5562
5487
|
var _b;
|
|
5563
5488
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -5589,6 +5514,7 @@ var recurSpecialExpression = {
|
|
|
5589
5514
|
};
|
|
5590
5515
|
return node;
|
|
5591
5516
|
},
|
|
5517
|
+
validateParameterCount: function () { return undefined; },
|
|
5592
5518
|
evaluate: function (node, contextStack, _a) {
|
|
5593
5519
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
5594
5520
|
var params = node.p.map(function (paramNode) { return evaluateAstNode(paramNode, contextStack); });
|
|
@@ -5601,19 +5527,8 @@ var recurSpecialExpression = {
|
|
|
5601
5527
|
};
|
|
5602
5528
|
|
|
5603
5529
|
var throwSpecialExpression = {
|
|
5604
|
-
parse:
|
|
5605
|
-
|
|
5606
|
-
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
5607
|
-
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5608
|
-
var node = {
|
|
5609
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
5610
|
-
n: 'throw',
|
|
5611
|
-
p: params,
|
|
5612
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
5613
|
-
};
|
|
5614
|
-
assertNumberOfParams(1, node);
|
|
5615
|
-
return node;
|
|
5616
|
-
},
|
|
5530
|
+
parse: getCommonParser('throw'),
|
|
5531
|
+
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
5617
5532
|
evaluate: function (node, contextStack, _a) {
|
|
5618
5533
|
var _b, _c;
|
|
5619
5534
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -5629,19 +5544,8 @@ var throwSpecialExpression = {
|
|
|
5629
5544
|
};
|
|
5630
5545
|
|
|
5631
5546
|
var timeSpecialExpression = {
|
|
5632
|
-
parse:
|
|
5633
|
-
|
|
5634
|
-
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
5635
|
-
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5636
|
-
var node = {
|
|
5637
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
5638
|
-
n: 'time!',
|
|
5639
|
-
p: params,
|
|
5640
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
5641
|
-
};
|
|
5642
|
-
assertNumberOfParams(1, node);
|
|
5643
|
-
return node;
|
|
5644
|
-
},
|
|
5547
|
+
parse: getCommonParser('time!'),
|
|
5548
|
+
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
5645
5549
|
evaluate: function (node, contextStack, _a) {
|
|
5646
5550
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
5647
5551
|
var param = node.p[0];
|
|
@@ -5682,9 +5586,9 @@ var trySpecialExpression = {
|
|
|
5682
5586
|
e: error,
|
|
5683
5587
|
token: getTokenDebugData(firstToken) && firstToken,
|
|
5684
5588
|
};
|
|
5685
|
-
assertNumberOfParams(1, node);
|
|
5686
5589
|
return node;
|
|
5687
5590
|
},
|
|
5591
|
+
validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
|
|
5688
5592
|
evaluate: function (node, contextStack, _a) {
|
|
5689
5593
|
var _b;
|
|
5690
5594
|
var _c;
|
|
@@ -5714,19 +5618,8 @@ var trySpecialExpression = {
|
|
|
5714
5618
|
};
|
|
5715
5619
|
|
|
5716
5620
|
var whenSpecialExpression = {
|
|
5717
|
-
parse:
|
|
5718
|
-
|
|
5719
|
-
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
5720
|
-
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5721
|
-
var node = {
|
|
5722
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
5723
|
-
n: 'when',
|
|
5724
|
-
p: params,
|
|
5725
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
5726
|
-
};
|
|
5727
|
-
assertNumberOfParams({ min: 1 }, node);
|
|
5728
|
-
return node;
|
|
5729
|
-
},
|
|
5621
|
+
parse: getCommonParser('when'),
|
|
5622
|
+
validateParameterCount: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
5730
5623
|
evaluate: function (node, contextStack, _a) {
|
|
5731
5624
|
var e_1, _b;
|
|
5732
5625
|
var _c;
|
|
@@ -5776,6 +5669,7 @@ var whenFirstSpecialExpression = {
|
|
|
5776
5669
|
};
|
|
5777
5670
|
return node;
|
|
5778
5671
|
},
|
|
5672
|
+
validateParameterCount: function () { return undefined; },
|
|
5779
5673
|
evaluate: function (node, contextStack, _a) {
|
|
5780
5674
|
var e_1, _b;
|
|
5781
5675
|
var _c;
|
|
@@ -5837,6 +5731,7 @@ var whenLetSpecialExpression = {
|
|
|
5837
5731
|
};
|
|
5838
5732
|
return node;
|
|
5839
5733
|
},
|
|
5734
|
+
validateParameterCount: function () { return undefined; },
|
|
5840
5735
|
evaluate: function (node, contextStack, _a) {
|
|
5841
5736
|
var e_1, _b;
|
|
5842
5737
|
var evaluateAstNode = _a.evaluateAstNode;
|
|
@@ -5875,19 +5770,8 @@ var whenLetSpecialExpression = {
|
|
|
5875
5770
|
};
|
|
5876
5771
|
|
|
5877
5772
|
var whenNotSpecialExpression = {
|
|
5878
|
-
parse:
|
|
5879
|
-
|
|
5880
|
-
var params = parseTokensUntilClosingBracket(tokenStream, parseState);
|
|
5881
|
-
assertRParenToken(tokenStream.tokens[parseState.position++]);
|
|
5882
|
-
var node = {
|
|
5883
|
-
t: exports.AstNodeType.SpecialExpression,
|
|
5884
|
-
n: 'when-not',
|
|
5885
|
-
p: params,
|
|
5886
|
-
token: getTokenDebugData(firstToken) && firstToken,
|
|
5887
|
-
};
|
|
5888
|
-
assertNumberOfParams({ min: 1 }, node);
|
|
5889
|
-
return node;
|
|
5890
|
-
},
|
|
5773
|
+
parse: getCommonParser('when-not'),
|
|
5774
|
+
validateParameterCount: function (node) { return assertNumberOfParams({ min: 1 }, node); },
|
|
5891
5775
|
evaluate: function (node, contextStack, _a) {
|
|
5892
5776
|
var e_1, _b;
|
|
5893
5777
|
var _c;
|
|
@@ -7487,7 +7371,7 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7487
7371
|
};
|
|
7488
7372
|
};
|
|
7489
7373
|
AlgebraicParser.prototype.parseFunctionCall = function (symbol) {
|
|
7490
|
-
var _a, _b;
|
|
7374
|
+
var _a, _b, _c;
|
|
7491
7375
|
var params = [];
|
|
7492
7376
|
this.advance();
|
|
7493
7377
|
while (!this.isAtEnd() && !isRParenToken(this.peek())) {
|
|
@@ -7519,13 +7403,17 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7519
7403
|
case 'when':
|
|
7520
7404
|
case 'when-not':
|
|
7521
7405
|
case 'do':
|
|
7522
|
-
case '
|
|
7523
|
-
|
|
7406
|
+
case 'time!':
|
|
7407
|
+
case 'throw': {
|
|
7408
|
+
var node_1 = {
|
|
7524
7409
|
t: exports.AstNodeType.SpecialExpression,
|
|
7525
7410
|
n: name_1,
|
|
7526
7411
|
p: params,
|
|
7527
7412
|
token: getTokenDebugData(symbol.token) && symbol.token,
|
|
7528
7413
|
};
|
|
7414
|
+
builtin.specialExpressions[node_1.n].validateParameterCount(node_1);
|
|
7415
|
+
return node_1;
|
|
7416
|
+
}
|
|
7529
7417
|
case 'def':
|
|
7530
7418
|
case 'defs':
|
|
7531
7419
|
case 'let':
|
|
@@ -7538,7 +7426,6 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7538
7426
|
case 'try':
|
|
7539
7427
|
case 'recur':
|
|
7540
7428
|
case 'loop':
|
|
7541
|
-
case 'time!':
|
|
7542
7429
|
case 'doseq':
|
|
7543
7430
|
case 'for':
|
|
7544
7431
|
throw new Error("Special expression ".concat(name_1, " is not available in algebraic notation"));
|
|
@@ -7546,7 +7433,12 @@ var AlgebraicParser = /** @class */ (function () {
|
|
|
7546
7433
|
throw new Error("Unknown special expression: ".concat(name_1));
|
|
7547
7434
|
}
|
|
7548
7435
|
}
|
|
7549
|
-
|
|
7436
|
+
var node = createNamedNormalExpressionNode(symbol.v, params, symbol.token);
|
|
7437
|
+
var builtinExpression = builtin.normalExpressions[node.n];
|
|
7438
|
+
if (builtinExpression) {
|
|
7439
|
+
(_c = builtinExpression.validate) === null || _c === void 0 ? void 0 : _c.call(builtinExpression, __assign(__assign({}, node), { p: withoutCommentNodes(node.p) }));
|
|
7440
|
+
}
|
|
7441
|
+
return node;
|
|
7550
7442
|
}
|
|
7551
7443
|
else {
|
|
7552
7444
|
return {
|
|
@@ -7915,7 +7807,7 @@ function parseSpecialExpression(tokenStream, parseState) {
|
|
|
7915
7807
|
var firstToken = asLParenToken(tokenStream.tokens[parseState.position++]);
|
|
7916
7808
|
var nameToken = asP_SymbolToken(tokenStream.tokens[parseState.position++]);
|
|
7917
7809
|
var expressionName = nameToken[1];
|
|
7918
|
-
var
|
|
7810
|
+
var _b = asNonUndefined(builtin.specialExpressions[expressionName], (_a = getTokenDebugData(nameToken)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo), parse = _b.parse, validateParameterCount = _b.validateParameterCount;
|
|
7919
7811
|
var node = parse(tokenStream, parseState, firstToken, {
|
|
7920
7812
|
parseExpression: parseExpression,
|
|
7921
7813
|
parseTokensUntilClosingBracket: parseTokensUntilClosingBracket,
|
|
@@ -7924,6 +7816,7 @@ function parseSpecialExpression(tokenStream, parseState) {
|
|
|
7924
7816
|
parseBindings: parseBindings,
|
|
7925
7817
|
parseArgument: parseArgument,
|
|
7926
7818
|
});
|
|
7819
|
+
validateParameterCount(node);
|
|
7927
7820
|
return node;
|
|
7928
7821
|
}
|
|
7929
7822
|
function parsePolishToken(tokenStream, parseState) {
|