@mojir/lits 2.0.20 → 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/cli/cli.js +26 -16
- package/dist/cli/src/Lits/Lits.d.ts +3 -1
- package/dist/cli/src/tokenizer/minifyTokenStream.d.ts +4 -0
- package/dist/index.esm.js +25 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +25 -15
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +25 -15
- package/dist/lits.iife.js.map +1 -1
- package/dist/src/Lits/Lits.d.ts +3 -1
- package/dist/src/tokenizer/minifyTokenStream.d.ts +4 -0
- package/dist/testFramework.esm.js +25 -15
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +25 -15
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
package/dist/lits.iife.js
CHANGED
|
@@ -6144,6 +6144,28 @@ var Lits = (function (exports) {
|
|
|
6144
6144
|
};
|
|
6145
6145
|
}
|
|
6146
6146
|
|
|
6147
|
+
function minifyTokenStream(tokenStream, _a) {
|
|
6148
|
+
var removeWhiteSpace = _a.removeWhiteSpace;
|
|
6149
|
+
var tokens = tokenStream.tokens
|
|
6150
|
+
.filter(function (token) {
|
|
6151
|
+
if (isP_CommentToken(token)
|
|
6152
|
+
|| isA_CommentToken(token)
|
|
6153
|
+
|| isA_MultiLineCommentToken(token)
|
|
6154
|
+
|| (removeWhiteSpace && isA_WhitespaceToken(token))
|
|
6155
|
+
|| (removeWhiteSpace && isP_WhitespaceToken(token))) {
|
|
6156
|
+
return false;
|
|
6157
|
+
}
|
|
6158
|
+
return true;
|
|
6159
|
+
})
|
|
6160
|
+
.map(function (token) {
|
|
6161
|
+
if (isA_WhitespaceToken(token) || isP_WhitespaceToken(token)) {
|
|
6162
|
+
return __assign(__assign({}, token), { value: ' ' });
|
|
6163
|
+
}
|
|
6164
|
+
return token;
|
|
6165
|
+
});
|
|
6166
|
+
return __assign(__assign({}, tokenStream), { tokens: tokens });
|
|
6167
|
+
}
|
|
6168
|
+
|
|
6147
6169
|
function parseSymbol(tokenStream, parseState) {
|
|
6148
6170
|
var _a;
|
|
6149
6171
|
var tkn = asToken(tokenStream.tokens[parseState.position++]);
|
|
@@ -7662,7 +7684,7 @@ var Lits = (function (exports) {
|
|
|
7662
7684
|
}
|
|
7663
7685
|
|
|
7664
7686
|
function parse(tokenStream) {
|
|
7665
|
-
tokenStream =
|
|
7687
|
+
tokenStream = minifyTokenStream(tokenStream, { removeWhiteSpace: true });
|
|
7666
7688
|
var algebraic = tokenStream.algebraic;
|
|
7667
7689
|
var ast = {
|
|
7668
7690
|
b: [],
|
|
@@ -7683,19 +7705,6 @@ var Lits = (function (exports) {
|
|
|
7683
7705
|
}
|
|
7684
7706
|
return ast;
|
|
7685
7707
|
}
|
|
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
7708
|
function parseToken(tokenStream, parseState) {
|
|
7700
7709
|
return parsePolishToken(tokenStream, parseState);
|
|
7701
7710
|
}
|
|
@@ -8523,7 +8532,8 @@ var Lits = (function (exports) {
|
|
|
8523
8532
|
if (tokenizeParams === void 0) { tokenizeParams = {}; }
|
|
8524
8533
|
var debug = this.debug;
|
|
8525
8534
|
var algebraic = this.algebraic;
|
|
8526
|
-
|
|
8535
|
+
var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
|
|
8536
|
+
return tokenizeParams.minify ? minifyTokenStream(tokenStream, { removeWhiteSpace: false }) : tokenStream;
|
|
8527
8537
|
};
|
|
8528
8538
|
Lits.prototype.parse = function (tokenStream) {
|
|
8529
8539
|
return parse(tokenStream);
|