@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.
package/dist/index.js CHANGED
@@ -6143,16 +6143,24 @@ function analyze(ast, params) {
6143
6143
  };
6144
6144
  }
6145
6145
 
6146
- function minifyTokenStream(tokenStream) {
6147
- var tokens = tokenStream.tokens.filter(function (token) {
6146
+ function minifyTokenStream(tokenStream, _a) {
6147
+ var removeWhiteSpace = _a.removeWhiteSpace;
6148
+ var tokens = tokenStream.tokens
6149
+ .filter(function (token) {
6148
6150
  if (isP_CommentToken(token)
6149
6151
  || isA_CommentToken(token)
6150
6152
  || isA_MultiLineCommentToken(token)
6151
- || isA_WhitespaceToken(token)
6152
- || isP_WhitespaceToken(token)) {
6153
+ || (removeWhiteSpace && isA_WhitespaceToken(token))
6154
+ || (removeWhiteSpace && isP_WhitespaceToken(token))) {
6153
6155
  return false;
6154
6156
  }
6155
6157
  return true;
6158
+ })
6159
+ .map(function (token) {
6160
+ if (isA_WhitespaceToken(token) || isP_WhitespaceToken(token)) {
6161
+ return __assign(__assign({}, token), { value: ' ' });
6162
+ }
6163
+ return token;
6156
6164
  });
6157
6165
  return __assign(__assign({}, tokenStream), { tokens: tokens });
6158
6166
  }
@@ -7675,7 +7683,7 @@ function parsePolishToken(tokenStream, parseState) {
7675
7683
  }
7676
7684
 
7677
7685
  function parse(tokenStream) {
7678
- tokenStream = minifyTokenStream(tokenStream);
7686
+ tokenStream = minifyTokenStream(tokenStream, { removeWhiteSpace: true });
7679
7687
  var algebraic = tokenStream.algebraic;
7680
7688
  var ast = {
7681
7689
  b: [],
@@ -8524,7 +8532,7 @@ var Lits = /** @class */ (function () {
8524
8532
  var debug = this.debug;
8525
8533
  var algebraic = this.algebraic;
8526
8534
  var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
8527
- return tokenizeParams.minify ? minifyTokenStream(tokenStream) : tokenStream;
8535
+ return tokenizeParams.minify ? minifyTokenStream(tokenStream, { removeWhiteSpace: false }) : tokenStream;
8528
8536
  };
8529
8537
  Lits.prototype.parse = function (tokenStream) {
8530
8538
  return parse(tokenStream);