@mojir/lits 2.0.20 → 2.0.21

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.
@@ -6105,6 +6105,20 @@ function analyze(ast, params) {
6105
6105
  };
6106
6106
  }
6107
6107
 
6108
+ function minifyTokenStream(tokenStream) {
6109
+ var tokens = tokenStream.tokens.filter(function (token) {
6110
+ if (isP_CommentToken(token)
6111
+ || isA_CommentToken(token)
6112
+ || isA_MultiLineCommentToken(token)
6113
+ || isA_WhitespaceToken(token)
6114
+ || isP_WhitespaceToken(token)) {
6115
+ return false;
6116
+ }
6117
+ return true;
6118
+ });
6119
+ return __assign(__assign({}, tokenStream), { tokens: tokens });
6120
+ }
6121
+
6108
6122
  function parseSymbol(tokenStream, parseState) {
6109
6123
  var _a;
6110
6124
  var tkn = asToken(tokenStream.tokens[parseState.position++]);
@@ -7623,7 +7637,7 @@ function parsePolishToken(tokenStream, parseState) {
7623
7637
  }
7624
7638
 
7625
7639
  function parse(tokenStream) {
7626
- tokenStream = removeUnnecessaryTokens(tokenStream);
7640
+ tokenStream = minifyTokenStream(tokenStream);
7627
7641
  var algebraic = tokenStream.algebraic;
7628
7642
  var ast = {
7629
7643
  b: [],
@@ -7644,19 +7658,6 @@ function parse(tokenStream) {
7644
7658
  }
7645
7659
  return ast;
7646
7660
  }
7647
- function removeUnnecessaryTokens(tokenStream) {
7648
- var tokens = tokenStream.tokens.filter(function (token) {
7649
- if (isP_CommentToken(token)
7650
- || isA_CommentToken(token)
7651
- || isA_MultiLineCommentToken(token)
7652
- || isA_WhitespaceToken(token)
7653
- || isP_WhitespaceToken(token)) {
7654
- return false;
7655
- }
7656
- return true;
7657
- });
7658
- return __assign(__assign({}, tokenStream), { tokens: tokens });
7659
- }
7660
7661
  function parseToken(tokenStream, parseState) {
7661
7662
  return parsePolishToken(tokenStream, parseState);
7662
7663
  }
@@ -8483,7 +8484,8 @@ var Lits = /** @class */ (function () {
8483
8484
  if (tokenizeParams === void 0) { tokenizeParams = {}; }
8484
8485
  var debug = this.debug;
8485
8486
  var algebraic = this.algebraic;
8486
- return tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
8487
+ var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
8488
+ return tokenizeParams.minify ? minifyTokenStream(tokenStream) : tokenStream;
8487
8489
  };
8488
8490
  Lits.prototype.parse = function (tokenStream) {
8489
8491
  return parse(tokenStream);