@fw-components/formula-editor 2.0.7-formula-editor-enhancements.2 → 2.0.7-formula-editor-enhancements.4
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.
|
@@ -91,13 +91,17 @@ export class Parser {
|
|
|
91
91
|
token = recommendation;
|
|
92
92
|
recommendation = null;
|
|
93
93
|
}
|
|
94
|
-
parseOutput.recommendations = this.
|
|
94
|
+
parseOutput.recommendations = this._recommender.getRecommendation(token);
|
|
95
95
|
}
|
|
96
96
|
let tokenClassName = "";
|
|
97
97
|
// Don't check for errors if an error has already been encountered.
|
|
98
98
|
if (expectation != Expectation.UNDEFINED) {
|
|
99
|
+
if (this.mathematicalOperators.has(previousToken) && isOperator) {
|
|
100
|
+
parseOutput.errorString = `Unexpected same operator at position ${currentPosition}`;
|
|
101
|
+
expectation = Expectation.UNDEFINED;
|
|
102
|
+
}
|
|
99
103
|
// Unnecessary closing parenthesis
|
|
100
|
-
if (parentheses.isEmpty() && token == ")") {
|
|
104
|
+
else if (parentheses.isEmpty() && token == ")") {
|
|
101
105
|
parseOutput.errorString = `Unexpected ')' at position ${currentPosition}`;
|
|
102
106
|
tokenClassName += " error";
|
|
103
107
|
expectation = Expectation.UNDEFINED;
|
|
@@ -329,7 +333,10 @@ export class Parser {
|
|
|
329
333
|
while (!rpn.isEmpty()) {
|
|
330
334
|
const frontItem = rpn.dequeue();
|
|
331
335
|
if (!this.mathematicalOperators.has(frontItem)) {
|
|
332
|
-
|
|
336
|
+
const sign = frontItem[0] === "+" || frontItem[0] === "-" ? frontItem[0] : "";
|
|
337
|
+
const key = sign ? frontItem.substring(1) : frontItem;
|
|
338
|
+
const number = sign + (this.variables.get(key)?.toString() ?? key);
|
|
339
|
+
calcStack.push(Big(Number.parseFloat(number)));
|
|
333
340
|
}
|
|
334
341
|
else {
|
|
335
342
|
let operator = frontItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fw-components/formula-editor",
|
|
3
|
-
"version": "2.0.7-formula-editor-enhancements.
|
|
3
|
+
"version": "2.0.7-formula-editor-enhancements.4",
|
|
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": "0cd3939b50f778354aa7b89072c09c1c55aeaee8"
|
|
29
29
|
}
|