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