@fw-components/formula-editor 2.0.7-formula-editor.17 → 2.0.7-formula-editor.19
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.
|
@@ -15,7 +15,7 @@ export class Parser {
|
|
|
15
15
|
this._recommender = new Recommender(this.variables, minSuggestionLen);
|
|
16
16
|
}
|
|
17
17
|
parseInput(formula, prevCurPos = null, recommendation = null) {
|
|
18
|
-
let tokens = formula.
|
|
18
|
+
let tokens = formula.match(/'[^']*'|\d+|[A-Za-z_][A-Za-z0-9_]*|[-+(),*^/:?\s]/g);
|
|
19
19
|
// Stores the positions of opening parentheses. This allows us to
|
|
20
20
|
// show "Unclosed parenthesis error" for positions which are far behind
|
|
21
21
|
// our current token
|
|
@@ -49,7 +49,7 @@ export class Parser {
|
|
|
49
49
|
return parseOutput;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
tokens
|
|
52
|
+
tokens?.forEach((token) => {
|
|
53
53
|
// It is a number is either it's in the defined variables, or
|
|
54
54
|
// it's a valid number literal.
|
|
55
55
|
let isNumber = this.variables.has(token) || !Number.isNaN(Number(token)), isOperator = this.mathematicalOperators.has(token), isSpace = token.trim() == "", isBracket = token == "(" || token == ")";
|
|
@@ -201,8 +201,8 @@ export class Parser {
|
|
|
201
201
|
return null;
|
|
202
202
|
}
|
|
203
203
|
const tokens = formula
|
|
204
|
-
.
|
|
205
|
-
|
|
204
|
+
.match(/'[^']*'|\d+|[A-Za-z_][A-Za-z0-9_]*|[-+(),*^/:?\s]/g)
|
|
205
|
+
?.filter((el) => !/\s+/.test(el) && el !== "");
|
|
206
206
|
// Handling the special case of unary `-` and `+`.
|
|
207
207
|
let previousToken = "";
|
|
208
208
|
let carriedToken = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fw-components/formula-editor",
|
|
3
|
-
"version": "2.0.7-formula-editor.
|
|
3
|
+
"version": "2.0.7-formula-editor.19",
|
|
4
4
|
"description": "A WYSIWYG type formula editor",
|
|
5
5
|
"main": "dist/formula-editor/src/formula-builder.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@types/big.js": "^6.1.6",
|
|
26
26
|
"es-dev-server": "^2.1.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "b0b4c9a7ae848527291eb32a834bbaadc8153a21"
|
|
29
29
|
}
|