@trebco/treb 30.6.3 → 30.8.2
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/treb-export-worker.mjs +2 -2
- package/dist/treb-spreadsheet.mjs +9 -9
- package/dist/treb.d.ts +1 -1
- package/package.json +1 -1
- package/treb-calculator/src/calculator.ts +29 -6
- package/treb-calculator/src/expression-calculator.ts +107 -3
- package/treb-calculator/src/functions/base-functions.ts +78 -1
- package/treb-calculator/src/functions/sparkline.ts +20 -0
- package/treb-calculator/src/functions/statistics-functions.ts +2 -0
- package/treb-data-model/src/conditional_format.ts +4 -1
- package/treb-data-model/src/sheet.ts +4 -3
- package/treb-embed/src/embedded-spreadsheet.ts +56 -0
- package/treb-export/src/import2.ts +75 -6
- package/treb-export/src/workbook2.ts +5 -0
- package/treb-grid/src/editors/editor.ts +1 -1
- package/treb-parser/src/parser.ts +14 -4
|
@@ -136,9 +136,10 @@ const binary_operators_precendence: PrecedenceList = {
|
|
|
136
136
|
':': 13, // range operator
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
/* *
|
|
140
140
|
* binary ops are sorted by length so we can compare long ops first
|
|
141
|
-
|
|
141
|
+
switching to a composite w/ unary operators
|
|
142
|
+
* /
|
|
142
143
|
const binary_operators = Object.keys(binary_operators_precendence).sort(
|
|
143
144
|
(a, b) => b.length - a.length,
|
|
144
145
|
);
|
|
@@ -147,8 +148,17 @@ const binary_operators = Object.keys(binary_operators_precendence).sort(
|
|
|
147
148
|
* unary operators. atm we have no precedence issues, unary operators
|
|
148
149
|
* always have absolute precedence. (for numbers, these are properly part
|
|
149
150
|
* of the number, but consider `=-SUM(1,2)` -- this is an operator).
|
|
151
|
+
*
|
|
152
|
+
* implicit intersection operator should now have precedence over +/-.
|
|
153
|
+
*/
|
|
154
|
+
const unary_operators: PrecedenceList = { '@': 50, '-': 100, '+': 100 };
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* to avoid the double - and +, we're just adding our one extra unary
|
|
158
|
+
* operator. doing this dynamically would be silly, although this does
|
|
159
|
+
* make this code more fragile.
|
|
150
160
|
*/
|
|
151
|
-
const
|
|
161
|
+
const composite_operators: string[] = [...Object.keys(binary_operators_precendence), '@'].sort((a, b) => b.length - a.length);
|
|
152
162
|
|
|
153
163
|
/**
|
|
154
164
|
* parser for spreadsheet language.
|
|
@@ -2092,7 +2102,7 @@ export class Parser {
|
|
|
2092
2102
|
}
|
|
2093
2103
|
|
|
2094
2104
|
protected ConsumeOperator(): ExpressionUnit | null {
|
|
2095
|
-
for (const operator of
|
|
2105
|
+
for (const operator of composite_operators) {
|
|
2096
2106
|
if (this.expression.substr(this.index, operator.length) === operator) {
|
|
2097
2107
|
const position = this.index;
|
|
2098
2108
|
this.index += operator.length;
|