@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/testFramework.js
CHANGED
|
@@ -6105,6 +6105,28 @@ function analyze(ast, params) {
|
|
|
6105
6105
|
};
|
|
6106
6106
|
}
|
|
6107
6107
|
|
|
6108
|
+
function minifyTokenStream(tokenStream, _a) {
|
|
6109
|
+
var removeWhiteSpace = _a.removeWhiteSpace;
|
|
6110
|
+
var tokens = tokenStream.tokens
|
|
6111
|
+
.filter(function (token) {
|
|
6112
|
+
if (isP_CommentToken(token)
|
|
6113
|
+
|| isA_CommentToken(token)
|
|
6114
|
+
|| isA_MultiLineCommentToken(token)
|
|
6115
|
+
|| (removeWhiteSpace && isA_WhitespaceToken(token))
|
|
6116
|
+
|| (removeWhiteSpace && isP_WhitespaceToken(token))) {
|
|
6117
|
+
return false;
|
|
6118
|
+
}
|
|
6119
|
+
return true;
|
|
6120
|
+
})
|
|
6121
|
+
.map(function (token) {
|
|
6122
|
+
if (isA_WhitespaceToken(token) || isP_WhitespaceToken(token)) {
|
|
6123
|
+
return __assign(__assign({}, token), { value: ' ' });
|
|
6124
|
+
}
|
|
6125
|
+
return token;
|
|
6126
|
+
});
|
|
6127
|
+
return __assign(__assign({}, tokenStream), { tokens: tokens });
|
|
6128
|
+
}
|
|
6129
|
+
|
|
6108
6130
|
function parseSymbol(tokenStream, parseState) {
|
|
6109
6131
|
var _a;
|
|
6110
6132
|
var tkn = asToken(tokenStream.tokens[parseState.position++]);
|
|
@@ -7623,7 +7645,7 @@ function parsePolishToken(tokenStream, parseState) {
|
|
|
7623
7645
|
}
|
|
7624
7646
|
|
|
7625
7647
|
function parse(tokenStream) {
|
|
7626
|
-
tokenStream =
|
|
7648
|
+
tokenStream = minifyTokenStream(tokenStream, { removeWhiteSpace: true });
|
|
7627
7649
|
var algebraic = tokenStream.algebraic;
|
|
7628
7650
|
var ast = {
|
|
7629
7651
|
b: [],
|
|
@@ -7644,19 +7666,6 @@ function parse(tokenStream) {
|
|
|
7644
7666
|
}
|
|
7645
7667
|
return ast;
|
|
7646
7668
|
}
|
|
7647
|
-
function removeUnnecessaryTokens(tokenStream) {
|
|
7648
|
-
var tokens = tokenStream.tokens.filter(function (token) {
|
|
7649
|
-
if (isP_CommentToken(token)
|
|
7650
|
-
|| isA_CommentToken(token)
|
|
7651
|
-
|| isA_MultiLineCommentToken(token)
|
|
7652
|
-
|| isA_WhitespaceToken(token)
|
|
7653
|
-
|| isP_WhitespaceToken(token)) {
|
|
7654
|
-
return false;
|
|
7655
|
-
}
|
|
7656
|
-
return true;
|
|
7657
|
-
});
|
|
7658
|
-
return __assign(__assign({}, tokenStream), { tokens: tokens });
|
|
7659
|
-
}
|
|
7660
7669
|
function parseToken(tokenStream, parseState) {
|
|
7661
7670
|
return parsePolishToken(tokenStream, parseState);
|
|
7662
7671
|
}
|
|
@@ -8483,7 +8492,8 @@ var Lits = /** @class */ (function () {
|
|
|
8483
8492
|
if (tokenizeParams === void 0) { tokenizeParams = {}; }
|
|
8484
8493
|
var debug = this.debug;
|
|
8485
8494
|
var algebraic = this.algebraic;
|
|
8486
|
-
|
|
8495
|
+
var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
|
|
8496
|
+
return tokenizeParams.minify ? minifyTokenStream(tokenStream, { removeWhiteSpace: false }) : tokenStream;
|
|
8487
8497
|
};
|
|
8488
8498
|
Lits.prototype.parse = function (tokenStream) {
|
|
8489
8499
|
return parse(tokenStream);
|