@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.
package/dist/lits.iife.js CHANGED
@@ -6144,6 +6144,20 @@ var Lits = (function (exports) {
6144
6144
  };
6145
6145
  }
6146
6146
 
6147
+ function minifyTokenStream(tokenStream) {
6148
+ var tokens = tokenStream.tokens.filter(function (token) {
6149
+ if (isP_CommentToken(token)
6150
+ || isA_CommentToken(token)
6151
+ || isA_MultiLineCommentToken(token)
6152
+ || isA_WhitespaceToken(token)
6153
+ || isP_WhitespaceToken(token)) {
6154
+ return false;
6155
+ }
6156
+ return true;
6157
+ });
6158
+ return __assign(__assign({}, tokenStream), { tokens: tokens });
6159
+ }
6160
+
6147
6161
  function parseSymbol(tokenStream, parseState) {
6148
6162
  var _a;
6149
6163
  var tkn = asToken(tokenStream.tokens[parseState.position++]);
@@ -7662,7 +7676,7 @@ var Lits = (function (exports) {
7662
7676
  }
7663
7677
 
7664
7678
  function parse(tokenStream) {
7665
- tokenStream = removeUnnecessaryTokens(tokenStream);
7679
+ tokenStream = minifyTokenStream(tokenStream);
7666
7680
  var algebraic = tokenStream.algebraic;
7667
7681
  var ast = {
7668
7682
  b: [],
@@ -7683,19 +7697,6 @@ var Lits = (function (exports) {
7683
7697
  }
7684
7698
  return ast;
7685
7699
  }
7686
- function removeUnnecessaryTokens(tokenStream) {
7687
- var tokens = tokenStream.tokens.filter(function (token) {
7688
- if (isP_CommentToken(token)
7689
- || isA_CommentToken(token)
7690
- || isA_MultiLineCommentToken(token)
7691
- || isA_WhitespaceToken(token)
7692
- || isP_WhitespaceToken(token)) {
7693
- return false;
7694
- }
7695
- return true;
7696
- });
7697
- return __assign(__assign({}, tokenStream), { tokens: tokens });
7698
- }
7699
7700
  function parseToken(tokenStream, parseState) {
7700
7701
  return parsePolishToken(tokenStream, parseState);
7701
7702
  }
@@ -8523,7 +8524,8 @@ var Lits = (function (exports) {
8523
8524
  if (tokenizeParams === void 0) { tokenizeParams = {}; }
8524
8525
  var debug = this.debug;
8525
8526
  var algebraic = this.algebraic;
8526
- return tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
8527
+ var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
8528
+ return tokenizeParams.minify ? minifyTokenStream(tokenStream) : tokenStream;
8527
8529
  };
8528
8530
  Lits.prototype.parse = function (tokenStream) {
8529
8531
  return parse(tokenStream);