@mojir/lits 2.0.21 → 2.0.22

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,16 +6105,24 @@ function analyze(ast, params) {
6105
6105
  };
6106
6106
  }
6107
6107
 
6108
- function minifyTokenStream(tokenStream) {
6109
- var tokens = tokenStream.tokens.filter(function (token) {
6108
+ function minifyTokenStream(tokenStream, _a) {
6109
+ var removeWhiteSpace = _a.removeWhiteSpace;
6110
+ var tokens = tokenStream.tokens
6111
+ .filter(function (token) {
6110
6112
  if (isP_CommentToken(token)
6111
6113
  || isA_CommentToken(token)
6112
6114
  || isA_MultiLineCommentToken(token)
6113
- || isA_WhitespaceToken(token)
6114
- || isP_WhitespaceToken(token)) {
6115
+ || (removeWhiteSpace && isA_WhitespaceToken(token))
6116
+ || (removeWhiteSpace && isP_WhitespaceToken(token))) {
6115
6117
  return false;
6116
6118
  }
6117
6119
  return true;
6120
+ })
6121
+ .map(function (token) {
6122
+ if (isA_WhitespaceToken(token) || isP_WhitespaceToken(token)) {
6123
+ return __assign(__assign({}, token), { value: ' ' });
6124
+ }
6125
+ return token;
6118
6126
  });
6119
6127
  return __assign(__assign({}, tokenStream), { tokens: tokens });
6120
6128
  }
@@ -7637,7 +7645,7 @@ function parsePolishToken(tokenStream, parseState) {
7637
7645
  }
7638
7646
 
7639
7647
  function parse(tokenStream) {
7640
- tokenStream = minifyTokenStream(tokenStream);
7648
+ tokenStream = minifyTokenStream(tokenStream, { removeWhiteSpace: true });
7641
7649
  var algebraic = tokenStream.algebraic;
7642
7650
  var ast = {
7643
7651
  b: [],
@@ -8485,7 +8493,7 @@ var Lits = /** @class */ (function () {
8485
8493
  var debug = this.debug;
8486
8494
  var algebraic = this.algebraic;
8487
8495
  var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
8488
- return tokenizeParams.minify ? minifyTokenStream(tokenStream) : tokenStream;
8496
+ return tokenizeParams.minify ? minifyTokenStream(tokenStream, { removeWhiteSpace: false }) : tokenStream;
8489
8497
  };
8490
8498
  Lits.prototype.parse = function (tokenStream) {
8491
8499
  return parse(tokenStream);