@mojir/lits 2.0.21 → 2.0.23
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 +9 -7
- package/dist/cli/src/tokenizer/minifyTokenStream.d.ts +3 -1
- package/dist/index.esm.js +8 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/lits.iife.js +8 -6
- package/dist/lits.iife.js.map +1 -1
- package/dist/src/tokenizer/minifyTokenStream.d.ts +3 -1
- package/dist/testFramework.esm.js +8 -6
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +8 -6
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import type { TokenStream } from './interface';
|
|
2
|
-
export declare function minifyTokenStream(tokenStream: TokenStream
|
|
2
|
+
export declare function minifyTokenStream(tokenStream: TokenStream, { removeWhiteSpace }: {
|
|
3
|
+
removeWhiteSpace: boolean;
|
|
4
|
+
}): TokenStream;
|
|
@@ -6103,13 +6103,15 @@ function analyze(ast, params) {
|
|
|
6103
6103
|
};
|
|
6104
6104
|
}
|
|
6105
6105
|
|
|
6106
|
-
function minifyTokenStream(tokenStream) {
|
|
6107
|
-
var
|
|
6106
|
+
function minifyTokenStream(tokenStream, _a) {
|
|
6107
|
+
var removeWhiteSpace = _a.removeWhiteSpace;
|
|
6108
|
+
var tokens = tokenStream.tokens
|
|
6109
|
+
.filter(function (token) {
|
|
6108
6110
|
if (isP_CommentToken(token)
|
|
6109
6111
|
|| isA_CommentToken(token)
|
|
6110
6112
|
|| isA_MultiLineCommentToken(token)
|
|
6111
|
-
|| isA_WhitespaceToken(token)
|
|
6112
|
-
|| isP_WhitespaceToken(token)) {
|
|
6113
|
+
|| (removeWhiteSpace && isA_WhitespaceToken(token))
|
|
6114
|
+
|| (removeWhiteSpace && isP_WhitespaceToken(token))) {
|
|
6113
6115
|
return false;
|
|
6114
6116
|
}
|
|
6115
6117
|
return true;
|
|
@@ -7635,7 +7637,7 @@ function parsePolishToken(tokenStream, parseState) {
|
|
|
7635
7637
|
}
|
|
7636
7638
|
|
|
7637
7639
|
function parse(tokenStream) {
|
|
7638
|
-
tokenStream = minifyTokenStream(tokenStream);
|
|
7640
|
+
tokenStream = minifyTokenStream(tokenStream, { removeWhiteSpace: true });
|
|
7639
7641
|
var algebraic = tokenStream.algebraic;
|
|
7640
7642
|
var ast = {
|
|
7641
7643
|
b: [],
|
|
@@ -8483,7 +8485,7 @@ var Lits = /** @class */ (function () {
|
|
|
8483
8485
|
var debug = this.debug;
|
|
8484
8486
|
var algebraic = this.algebraic;
|
|
8485
8487
|
var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
|
|
8486
|
-
return tokenizeParams.minify ? minifyTokenStream(tokenStream) : tokenStream;
|
|
8488
|
+
return tokenizeParams.minify ? minifyTokenStream(tokenStream, { removeWhiteSpace: false }) : tokenStream;
|
|
8487
8489
|
};
|
|
8488
8490
|
Lits.prototype.parse = function (tokenStream) {
|
|
8489
8491
|
return parse(tokenStream);
|