@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/cli/cli.js +15 -7
- package/dist/cli/src/tokenizer/minifyTokenStream.d.ts +3 -1
- package/dist/index.esm.js +14 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +14 -6
- package/dist/lits.iife.js.map +1 -1
- package/dist/src/tokenizer/minifyTokenStream.d.ts +3 -1
- package/dist/testFramework.esm.js +14 -6
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +14 -6
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
package/dist/lits.iife.js
CHANGED
|
@@ -6144,16 +6144,24 @@ var Lits = (function (exports) {
|
|
|
6144
6144
|
};
|
|
6145
6145
|
}
|
|
6146
6146
|
|
|
6147
|
-
function minifyTokenStream(tokenStream) {
|
|
6148
|
-
var
|
|
6147
|
+
function minifyTokenStream(tokenStream, _a) {
|
|
6148
|
+
var removeWhiteSpace = _a.removeWhiteSpace;
|
|
6149
|
+
var tokens = tokenStream.tokens
|
|
6150
|
+
.filter(function (token) {
|
|
6149
6151
|
if (isP_CommentToken(token)
|
|
6150
6152
|
|| isA_CommentToken(token)
|
|
6151
6153
|
|| isA_MultiLineCommentToken(token)
|
|
6152
|
-
|| isA_WhitespaceToken(token)
|
|
6153
|
-
|| isP_WhitespaceToken(token)) {
|
|
6154
|
+
|| (removeWhiteSpace && isA_WhitespaceToken(token))
|
|
6155
|
+
|| (removeWhiteSpace && isP_WhitespaceToken(token))) {
|
|
6154
6156
|
return false;
|
|
6155
6157
|
}
|
|
6156
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;
|
|
6157
6165
|
});
|
|
6158
6166
|
return __assign(__assign({}, tokenStream), { tokens: tokens });
|
|
6159
6167
|
}
|
|
@@ -7676,7 +7684,7 @@ var Lits = (function (exports) {
|
|
|
7676
7684
|
}
|
|
7677
7685
|
|
|
7678
7686
|
function parse(tokenStream) {
|
|
7679
|
-
tokenStream = minifyTokenStream(tokenStream);
|
|
7687
|
+
tokenStream = minifyTokenStream(tokenStream, { removeWhiteSpace: true });
|
|
7680
7688
|
var algebraic = tokenStream.algebraic;
|
|
7681
7689
|
var ast = {
|
|
7682
7690
|
b: [],
|
|
@@ -8525,7 +8533,7 @@ var Lits = (function (exports) {
|
|
|
8525
8533
|
var debug = this.debug;
|
|
8526
8534
|
var algebraic = this.algebraic;
|
|
8527
8535
|
var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
|
|
8528
|
-
return tokenizeParams.minify ? minifyTokenStream(tokenStream) : tokenStream;
|
|
8536
|
+
return tokenizeParams.minify ? minifyTokenStream(tokenStream, { removeWhiteSpace: false }) : tokenStream;
|
|
8529
8537
|
};
|
|
8530
8538
|
Lits.prototype.parse = function (tokenStream) {
|
|
8531
8539
|
return parse(tokenStream);
|