@mojir/lits 2.0.10 → 2.0.11

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 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.10";
95
+ var version = "2.0.11";
96
96
 
97
97
  var AstNodeType;
98
98
  (function (AstNodeType) {
@@ -420,6 +420,12 @@ function isA_SymbolToken(token) {
420
420
  function isA_ReservedSymbolToken(token) {
421
421
  return (token === null || token === void 0 ? void 0 : token[0]) === 'A_ReservedSymbol';
422
422
  }
423
+ function isA_CommentToken(token) {
424
+ return (token === null || token === void 0 ? void 0 : token[0]) === 'A_SingleLineComment';
425
+ }
426
+ function isA_MultiLineCommentToken(token) {
427
+ return (token === null || token === void 0 ? void 0 : token[0]) === 'A_MultiLineComment';
428
+ }
423
429
  function isA_OperatorToken(token, operatorName) {
424
430
  if ((token === null || token === void 0 ? void 0 : token[0]) !== 'A_Operator') {
425
431
  return false;
@@ -4332,7 +4338,7 @@ var functionalNormalExpression = {
4332
4338
  var normalExpressions = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, bitwiseNormalExpression), collectionNormalExpression), arrayNormalExpression), sequenceNormalExpression), mathNormalExpression), miscNormalExpression), assertNormalExpression), objectNormalExpression), predicatesNormalExpression), regexpNormalExpression), stringNormalExpression), functionalNormalExpression);
4333
4339
 
4334
4340
  var andSpecialExpression = {
4335
- parse: function (tokenStream, parseState, firstToken, _a) {
4341
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
4336
4342
  var parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
4337
4343
  var params = parseTokensUntilClosingBracket(tokenStream, parseState);
4338
4344
  assertRParenToken(tokenStream.tokens[parseState.position++]);
@@ -4372,7 +4378,7 @@ var andSpecialExpression = {
4372
4378
  },
4373
4379
  };
4374
4380
 
4375
- function getCommonParser(name) {
4381
+ function getCommonPolishSpecialExpressionParser(name) {
4376
4382
  return function (tokenStream, parseState, firstToken, _a) {
4377
4383
  var parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
4378
4384
  var params = parseTokensUntilClosingBracket(tokenStream, parseState);
@@ -4387,14 +4393,14 @@ function getCommonParser(name) {
4387
4393
  }
4388
4394
 
4389
4395
  var commentSpecialExpression = {
4390
- parse: getCommonParser('comment'),
4396
+ polishParse: getCommonPolishSpecialExpressionParser('comment'),
4391
4397
  validateParameterCount: function () { return undefined; },
4392
4398
  evaluate: function () { return null; },
4393
4399
  findUnresolvedIdentifiers: function () { return new Set(); },
4394
4400
  };
4395
4401
 
4396
4402
  var condSpecialExpression = {
4397
- parse: getCommonParser('cond'),
4403
+ polishParse: getCommonPolishSpecialExpressionParser('cond'),
4398
4404
  validateParameterCount: function (node) { return assertEvenNumberOfParams(node); },
4399
4405
  evaluate: function (node, contextStack, _a) {
4400
4406
  var e_1, _b;
@@ -4424,7 +4430,7 @@ var condSpecialExpression = {
4424
4430
  };
4425
4431
 
4426
4432
  var declaredSpecialExpression = {
4427
- parse: getCommonParser('declared?'),
4433
+ polishParse: getCommonPolishSpecialExpressionParser('declared?'),
4428
4434
  validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
4429
4435
  evaluate: function (node, contextStack) {
4430
4436
  var lookUpResult = contextStack.lookUp(node.p[0]);
@@ -4459,7 +4465,7 @@ function assertNameNotDefined(name, contextStack, builtin, sourceCodeInfo) {
4459
4465
  }
4460
4466
 
4461
4467
  var defSpecialExpression = {
4462
- parse: function (tokenStream, parseState, firstToken, _a) {
4468
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
4463
4469
  var _b;
4464
4470
  var parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
4465
4471
  var params = parseTokensUntilClosingBracket(tokenStream, parseState);
@@ -4499,7 +4505,7 @@ var defSpecialExpression = {
4499
4505
  };
4500
4506
 
4501
4507
  var defsSpecialExpression = {
4502
- parse: function (tokenStream, parseState, firstToken, _a) {
4508
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
4503
4509
  var parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
4504
4510
  var params = parseTokensUntilClosingBracket(tokenStream, parseState);
4505
4511
  assertRParenToken(tokenStream.tokens[parseState.position++]);
@@ -4539,7 +4545,7 @@ var defsSpecialExpression = {
4539
4545
  };
4540
4546
 
4541
4547
  var doSpecialExpression = {
4542
- parse: getCommonParser('do'),
4548
+ polishParse: getCommonPolishSpecialExpressionParser('do'),
4543
4549
  validateParameterCount: function () { return undefined; },
4544
4550
  evaluate: function (node, contextStack, _a) {
4545
4551
  var e_1, _b;
@@ -4600,7 +4606,7 @@ function combinate(arrays) {
4600
4606
  }
4601
4607
 
4602
4608
  var defnSpecialExpression = {
4603
- parse: function (tokenStream, parseState, firstToken, parsers) {
4609
+ polishParse: function (tokenStream, parseState, firstToken, parsers) {
4604
4610
  var _a;
4605
4611
  var parseToken = parsers.parseToken;
4606
4612
  var functionName = parseToken(tokenStream, parseState);
@@ -4644,7 +4650,7 @@ var defnSpecialExpression = {
4644
4650
  },
4645
4651
  };
4646
4652
  var defnsSpecialExpression = {
4647
- parse: function (tokenStream, parseState, firstToken, parsers) {
4653
+ polishParse: function (tokenStream, parseState, firstToken, parsers) {
4648
4654
  var parseToken = parsers.parseToken;
4649
4655
  var functionName = parseToken(tokenStream, parseState);
4650
4656
  var functionOverloades = parseFunctionOverloades(tokenStream, parseState, parsers);
@@ -4691,7 +4697,7 @@ var defnsSpecialExpression = {
4691
4697
  },
4692
4698
  };
4693
4699
  var fnSpecialExpression = {
4694
- parse: function (tokenStream, parseState, firstToken, parsers) {
4700
+ polishParse: function (tokenStream, parseState, firstToken, parsers) {
4695
4701
  var functionOverloades = parseFunctionOverloades(tokenStream, parseState, parsers);
4696
4702
  assertRParenToken(tokenStream.tokens[parseState.position++]);
4697
4703
  var node = {
@@ -4935,7 +4941,7 @@ function parseFunctionArguments(tokenStream, parseState, parsers) {
4935
4941
  }
4936
4942
 
4937
4943
  var ifSpecialExpression = {
4938
- parse: getCommonParser('if'),
4944
+ polishParse: getCommonPolishSpecialExpressionParser('if'),
4939
4945
  validateParameterCount: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
4940
4946
  evaluate: function (node, contextStack, _a) {
4941
4947
  var _b;
@@ -4959,7 +4965,7 @@ var ifSpecialExpression = {
4959
4965
  };
4960
4966
 
4961
4967
  var ifLetSpecialExpression = {
4962
- parse: function (tokenStream, parseState, firstToken, _a) {
4968
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
4963
4969
  var _b, _c;
4964
4970
  var parseBindings = _a.parseBindings, parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
4965
4971
  var bindings = parseBindings(tokenStream, parseState);
@@ -5007,7 +5013,7 @@ var ifLetSpecialExpression = {
5007
5013
  };
5008
5014
 
5009
5015
  var ifNotSpecialExpression = {
5010
- parse: getCommonParser('if-not'),
5016
+ polishParse: getCommonPolishSpecialExpressionParser('if-not'),
5011
5017
  validateParameterCount: function (node) { return assertNumberOfParams({ min: 2, max: 3 }, node); },
5012
5018
  evaluate: function (node, contextStack, _a) {
5013
5019
  var _b;
@@ -5031,7 +5037,7 @@ var ifNotSpecialExpression = {
5031
5037
  };
5032
5038
 
5033
5039
  var letSpecialExpression = {
5034
- parse: function (tokenStream, parseState, firstToken, _a) {
5040
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
5035
5041
  var parseBindings = _a.parseBindings, parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
5036
5042
  var bindings = parseBindings(tokenStream, parseState);
5037
5043
  var params = parseTokensUntilClosingBracket(tokenStream, parseState);
@@ -5103,7 +5109,7 @@ var letSpecialExpression = {
5103
5109
  };
5104
5110
 
5105
5111
  var loopSpecialExpression = {
5106
- parse: function (tokenStream, parseState, firstToken, _a) {
5112
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
5107
5113
  var parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket, parseBindings = _a.parseBindings;
5108
5114
  var bindings = parseBindings(tokenStream, parseState);
5109
5115
  var params = parseTokensUntilClosingBracket(tokenStream, parseState);
@@ -5369,7 +5375,7 @@ function analyze$1(node, contextStack, findUnresolvedIdentifiers, builtin) {
5369
5375
  return result;
5370
5376
  }
5371
5377
  var forSpecialExpression = {
5372
- parse: function (tokenStream, parseState, firstToken, parsers) {
5378
+ polishParse: function (tokenStream, parseState, firstToken, parsers) {
5373
5379
  var parseTokensUntilClosingBracket = parsers.parseTokensUntilClosingBracket;
5374
5380
  var loopBindings = parseLoopBindings(tokenStream, parseState, parsers);
5375
5381
  var params = parseTokensUntilClosingBracket(tokenStream, parseState);
@@ -5391,7 +5397,7 @@ var forSpecialExpression = {
5391
5397
  },
5392
5398
  };
5393
5399
  var doseqSpecialExpression = {
5394
- parse: function (tokenStream, parseState, firstToken, parsers) {
5400
+ polishParse: function (tokenStream, parseState, firstToken, parsers) {
5395
5401
  var parseTokensUntilClosingBracket = parsers.parseTokensUntilClosingBracket;
5396
5402
  var loopBindings = parseLoopBindings(tokenStream, parseState, parsers);
5397
5403
  var params = parseTokensUntilClosingBracket(tokenStream, parseState);
@@ -5417,7 +5423,7 @@ var doseqSpecialExpression = {
5417
5423
  };
5418
5424
 
5419
5425
  var orSpecialExpression = {
5420
- parse: getCommonParser('or'),
5426
+ polishParse: getCommonPolishSpecialExpressionParser('or'),
5421
5427
  validateParameterCount: function () { return undefined; },
5422
5428
  evaluate: function (node, contextStack, _a) {
5423
5429
  var e_1, _b;
@@ -5447,7 +5453,7 @@ var orSpecialExpression = {
5447
5453
  };
5448
5454
 
5449
5455
  var qqSpecialExpression = {
5450
- parse: getCommonParser('??'),
5456
+ polishParse: getCommonPolishSpecialExpressionParser('??'),
5451
5457
  validateParameterCount: function (node) { return assertNumberOfParams({ min: 1, max: 2 }, node); },
5452
5458
  evaluate: function (node, contextStack, _a) {
5453
5459
  var _b;
@@ -5468,7 +5474,7 @@ var qqSpecialExpression = {
5468
5474
  };
5469
5475
 
5470
5476
  var recurSpecialExpression = {
5471
- parse: function (tokenStream, parseState, firstToken, _a) {
5477
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
5472
5478
  var parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
5473
5479
  var params = parseTokensUntilClosingBracket(tokenStream, parseState);
5474
5480
  assertRParenToken(tokenStream.tokens[parseState.position++]);
@@ -5493,7 +5499,7 @@ var recurSpecialExpression = {
5493
5499
  };
5494
5500
 
5495
5501
  var throwSpecialExpression = {
5496
- parse: getCommonParser('throw'),
5502
+ polishParse: getCommonPolishSpecialExpressionParser('throw'),
5497
5503
  validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
5498
5504
  evaluate: function (node, contextStack, _a) {
5499
5505
  var _b, _c;
@@ -5510,7 +5516,7 @@ var throwSpecialExpression = {
5510
5516
  };
5511
5517
 
5512
5518
  var timeSpecialExpression = {
5513
- parse: getCommonParser('time!'),
5519
+ polishParse: getCommonPolishSpecialExpressionParser('time!'),
5514
5520
  validateParameterCount: function (node) { return assertNumberOfParams(1, node); },
5515
5521
  evaluate: function (node, contextStack, _a) {
5516
5522
  var evaluateAstNode = _a.evaluateAstNode;
@@ -5529,7 +5535,7 @@ var timeSpecialExpression = {
5529
5535
  };
5530
5536
 
5531
5537
  var trySpecialExpression = {
5532
- parse: function (tokenStream, parseState, firstToken, _a) {
5538
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
5533
5539
  var _b, _c, _d;
5534
5540
  var parseToken = _a.parseToken;
5535
5541
  var tryExpression = parseToken(tokenStream, parseState);
@@ -5584,7 +5590,7 @@ var trySpecialExpression = {
5584
5590
  };
5585
5591
 
5586
5592
  var whenSpecialExpression = {
5587
- parse: getCommonParser('when'),
5593
+ polishParse: getCommonPolishSpecialExpressionParser('when'),
5588
5594
  validateParameterCount: function (node) { return assertNumberOfParams({ min: 1 }, node); },
5589
5595
  evaluate: function (node, contextStack, _a) {
5590
5596
  var e_1, _b;
@@ -5617,7 +5623,7 @@ var whenSpecialExpression = {
5617
5623
  };
5618
5624
 
5619
5625
  var whenFirstSpecialExpression = {
5620
- parse: function (tokenStream, parseState, firstToken, _a) {
5626
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
5621
5627
  var _b, _c;
5622
5628
  var parseBindings = _a.parseBindings, parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
5623
5629
  var bindings = parseBindings(tokenStream, parseState);
@@ -5679,7 +5685,7 @@ var whenFirstSpecialExpression = {
5679
5685
  };
5680
5686
 
5681
5687
  var whenLetSpecialExpression = {
5682
- parse: function (tokenStream, parseState, firstToken, _a) {
5688
+ polishParse: function (tokenStream, parseState, firstToken, _a) {
5683
5689
  var _b, _c;
5684
5690
  var parseBindings = _a.parseBindings, parseTokensUntilClosingBracket = _a.parseTokensUntilClosingBracket;
5685
5691
  var bindings = parseBindings(tokenStream, parseState);
@@ -5736,7 +5742,7 @@ var whenLetSpecialExpression = {
5736
5742
  };
5737
5743
 
5738
5744
  var whenNotSpecialExpression = {
5739
- parse: getCommonParser('when-not'),
5745
+ polishParse: getCommonPolishSpecialExpressionParser('when-not'),
5740
5746
  validateParameterCount: function (node) { return assertNumberOfParams({ min: 1 }, node); },
5741
5747
  evaluate: function (node, contextStack, _a) {
5742
5748
  var e_1, _b;
@@ -7380,9 +7386,10 @@ var AlgebraicParser = /** @class */ (function () {
7380
7386
  builtin.specialExpressions[node_1.n].validateParameterCount(node_1);
7381
7387
  return node_1;
7382
7388
  }
7389
+ case 'let':
7390
+ return this.parseLet(symbol, params);
7383
7391
  case 'def':
7384
7392
  case 'defs':
7385
- case 'let':
7386
7393
  case 'if-let':
7387
7394
  case 'when-let':
7388
7395
  case 'when-first':
@@ -7416,31 +7423,40 @@ var AlgebraicParser = /** @class */ (function () {
7416
7423
  }
7417
7424
  };
7418
7425
  AlgebraicParser.prototype.parseLambdaFunction = function () {
7419
- var _a;
7426
+ var _a, _b;
7420
7427
  var firstToken = this.peek();
7421
7428
  this.advance();
7422
- var spread = false;
7429
+ var rest = false;
7430
+ var letBindingObject;
7423
7431
  var args = [];
7424
7432
  var restArg;
7425
7433
  while (!this.isAtEnd() && !isRParenToken(this.peek())) {
7426
- if (isA_OperatorToken(this.peek(), '...')) {
7427
- if (spread) {
7428
- throw new LitsError('Multiple spread operators in lambda function', (_a = getTokenDebugData(this.peek())) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
7429
- }
7430
- this.advance();
7431
- spread = true;
7434
+ if (letBindingObject) {
7435
+ throw new LitsError('Expected right parentheses', (_a = getTokenDebugData(this.peek())) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
7432
7436
  }
7433
- var symbolToken = this.peek();
7434
- if (!isA_SymbolToken(symbolToken)) {
7435
- return null;
7436
- }
7437
- if (spread) {
7438
- restArg = symbolToken[1];
7437
+ if (isLBraceToken(this.peek())) {
7438
+ letBindingObject = this.parseObject();
7439
7439
  }
7440
7440
  else {
7441
- args.push(symbolToken[1]);
7441
+ if (isA_OperatorToken(this.peek(), '...')) {
7442
+ if (rest) {
7443
+ throw new LitsError('Multiple spread operators in lambda function', (_b = getTokenDebugData(this.peek())) === null || _b === void 0 ? void 0 : _b.sourceCodeInfo);
7444
+ }
7445
+ this.advance();
7446
+ rest = true;
7447
+ }
7448
+ var symbolToken = this.peek();
7449
+ if (!isA_SymbolToken(symbolToken)) {
7450
+ return null;
7451
+ }
7452
+ if (rest) {
7453
+ restArg = symbolToken[1];
7454
+ }
7455
+ else {
7456
+ args.push(symbolToken[1]);
7457
+ }
7458
+ this.advance();
7442
7459
  }
7443
- this.advance();
7444
7460
  if (!isA_OperatorToken(this.peek(), ',') && !isRParenToken(this.peek())) {
7445
7461
  return null;
7446
7462
  }
@@ -7456,6 +7472,7 @@ var AlgebraicParser = /** @class */ (function () {
7456
7472
  return null;
7457
7473
  }
7458
7474
  this.advance();
7475
+ var letBindings = letBindingObject ? arrayToPairs(letBindingObject.p) : [];
7459
7476
  var body = this.parseExpression();
7460
7477
  var arity = restArg !== undefined ? { min: args.length } : args.length;
7461
7478
  return {
@@ -7466,7 +7483,17 @@ var AlgebraicParser = /** @class */ (function () {
7466
7483
  as: {
7467
7484
  m: args,
7468
7485
  r: restArg,
7469
- b: [],
7486
+ b: letBindings.map(function (pair) {
7487
+ var key = pair[0];
7488
+ var value = pair[1];
7489
+ return {
7490
+ t: AstNodeType.Binding,
7491
+ n: key.v,
7492
+ v: value,
7493
+ p: [],
7494
+ token: getTokenDebugData(key.token) && key.token,
7495
+ };
7496
+ }),
7470
7497
  },
7471
7498
  b: [body],
7472
7499
  a: arity,
@@ -7530,6 +7557,35 @@ var AlgebraicParser = /** @class */ (function () {
7530
7557
  };
7531
7558
  return node;
7532
7559
  };
7560
+ AlgebraicParser.prototype.parseLet = function (nameSymbol, params) {
7561
+ var _a, _b;
7562
+ if (params.length !== 2) {
7563
+ throw new LitsError('let expects two arguments', (_a = getTokenDebugData(nameSymbol.token)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo);
7564
+ }
7565
+ var letObject = params[0];
7566
+ if (letObject.t !== AstNodeType.NormalExpression || letObject.n !== 'object') {
7567
+ throw new LitsError('let expects an object as first argument', (_b = getTokenDebugData(letObject.token)) === null || _b === void 0 ? void 0 : _b.sourceCodeInfo);
7568
+ }
7569
+ var letBindings = arrayToPairs(letObject.p);
7570
+ var expression = params[1];
7571
+ return {
7572
+ t: AstNodeType.SpecialExpression,
7573
+ n: 'let',
7574
+ p: [expression],
7575
+ token: getTokenDebugData(nameSymbol.token) && nameSymbol.token,
7576
+ bs: letBindings.map(function (pair) {
7577
+ var key = pair[0];
7578
+ var value = pair[1];
7579
+ return {
7580
+ t: AstNodeType.Binding,
7581
+ n: key.v,
7582
+ v: value,
7583
+ p: [],
7584
+ token: getTokenDebugData(key.token) && key.token,
7585
+ };
7586
+ }),
7587
+ };
7588
+ };
7533
7589
  AlgebraicParser.prototype.isAtEnd = function () {
7534
7590
  return this.parseState.position >= this.tokenStream.tokens.length;
7535
7591
  };
@@ -7773,7 +7829,7 @@ function parseSpecialExpression(tokenStream, parseState) {
7773
7829
  var firstToken = asLParenToken(tokenStream.tokens[parseState.position++]);
7774
7830
  var nameToken = asP_SymbolToken(tokenStream.tokens[parseState.position++]);
7775
7831
  var expressionName = nameToken[1];
7776
- var _b = asNonUndefined(builtin.specialExpressions[expressionName], (_a = getTokenDebugData(nameToken)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo), parse = _b.parse, validateParameterCount = _b.validateParameterCount;
7832
+ var _b = asNonUndefined(builtin.specialExpressions[expressionName], (_a = getTokenDebugData(nameToken)) === null || _a === void 0 ? void 0 : _a.sourceCodeInfo), parse = _b.polishParse, validateParameterCount = _b.validateParameterCount;
7777
7833
  var node = parse(tokenStream, parseState, firstToken, {
7778
7834
  parseExpression: parseExpression,
7779
7835
  parseTokensUntilClosingBracket: parseTokensUntilClosingBracket,
@@ -7872,7 +7928,11 @@ function parse(tokenStream) {
7872
7928
  }
7873
7929
  function removeUnnecessaryTokens(tokenStream) {
7874
7930
  var tokens = tokenStream.tokens.filter(function (token) {
7875
- if (isP_CommentToken(token) || isA_WhitespaceToken(token) || isP_WhitespaceToken(token)) {
7931
+ if (isP_CommentToken(token)
7932
+ || isA_CommentToken(token)
7933
+ || isA_MultiLineCommentToken(token)
7934
+ || isA_WhitespaceToken(token)
7935
+ || isP_WhitespaceToken(token)) {
7876
7936
  return false;
7877
7937
  }
7878
7938
  return true;
@@ -8188,7 +8248,6 @@ var algebraicReservedNamesRecord = {
8188
8248
  'null': { value: null },
8189
8249
  'def': { value: null, forbidden: true },
8190
8250
  'defs': { value: null, forbidden: true },
8191
- 'let': { value: null, forbidden: true },
8192
8251
  'if-let': { value: null, forbidden: true },
8193
8252
  'when-let': { value: null, forbidden: true },
8194
8253
  'when-first': { value: null, forbidden: true },
@@ -33,8 +33,8 @@ export type CommonSpecialExpressionName = keyof Pick<typeof specialExpressions,
33
33
  export type BuiltinSpecialExpressions = typeof specialExpressions;
34
34
  export type BuiltinSpecialExpression = typeof specialExpressions[SpecialExpressionName];
35
35
  export type BuiltinCommonSpecialExpression = typeof specialExpressions[CommonSpecialExpressionName];
36
- export type GenericCommonSpecialExpressionNode<T extends CommonSpecialExpressionName> = ReturnType<typeof specialExpressions[T]['parse']>;
37
- export type SpecialExpressionNode = ReturnType<typeof specialExpressions[SpecialExpressionName]['parse']>;
36
+ export type GenericCommonSpecialExpressionNode<T extends CommonSpecialExpressionName> = ReturnType<typeof specialExpressions[T]['polishParse']>;
37
+ export type SpecialExpressionNode = ReturnType<typeof specialExpressions[SpecialExpressionName]['polishParse']>;
38
38
  export declare const builtin: Builtin;
39
39
  export declare const normalExpressionKeys: string[];
40
40
  export declare const specialExpressionKeys: string[];
@@ -29,7 +29,7 @@ interface EvaluateHelpers {
29
29
  builtin: Builtin;
30
30
  }
31
31
  export interface BuiltinSpecialExpression<T, N extends SpecialExpressionNode> {
32
- parse: (tokenStream: TokenStream, parseState: ParseState, firstToken: Token, parsers: ParserHelpers) => N;
32
+ polishParse: (tokenStream: TokenStream, parseState: ParseState, firstToken: Token, parsers: ParserHelpers) => N;
33
33
  evaluate: (node: N, contextStack: ContextStack, helpers: EvaluateHelpers) => T;
34
34
  validateParameterCount: ValidateSpecialExpressionNode;
35
35
  findUnresolvedIdentifiers: (node: N, contextStack: ContextStack, params: {
@@ -1,4 +1,4 @@
1
1
  import type { CommonSpecialExpressionName, GenericCommonSpecialExpressionNode } from '..';
2
2
  import type { Any } from '../../interface';
3
3
  import type { BuiltinSpecialExpression } from '../interface';
4
- export declare function getCommonParser<T extends CommonSpecialExpressionName>(name: T): BuiltinSpecialExpression<Any, GenericCommonSpecialExpressionNode<T>>['parse'];
4
+ export declare function getCommonPolishSpecialExpressionParser<T extends CommonSpecialExpressionName>(name: T): BuiltinSpecialExpression<Any, GenericCommonSpecialExpressionNode<T>>['polishParse'];
@@ -13,6 +13,7 @@ export declare class AlgebraicParser {
13
13
  private parseFunctionCall;
14
14
  parseLambdaFunction(): AstNode | null;
15
15
  private parseShorthandLamdaFunction;
16
+ private parseLet;
16
17
  private isAtEnd;
17
18
  private peek;
18
19
  }