@bilig/formula 0.1.83 → 0.1.84
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/addressing.d.ts +6 -6
- package/dist/addressing.js +16 -16
- package/dist/addressing.js.map +1 -1
- package/dist/ast.d.ts +18 -18
- package/dist/binder-wasm-rules.d.ts +2 -2
- package/dist/binder-wasm-rules.js +677 -724
- package/dist/binder-wasm-rules.js.map +1 -1
- package/dist/binder.d.ts +2 -2
- package/dist/binder.js +133 -137
- package/dist/binder.js.map +1 -1
- package/dist/builtin-capabilities.d.ts +4 -4
- package/dist/builtin-capabilities.js +777 -816
- package/dist/builtin-capabilities.js.map +1 -1
- package/dist/builtins/complex.d.ts +3 -3
- package/dist/builtins/complex.js +20 -48
- package/dist/builtins/complex.js.map +1 -1
- package/dist/builtins/convert.d.ts +1 -1
- package/dist/builtins/convert.js +180 -181
- package/dist/builtins/convert.js.map +1 -1
- package/dist/builtins/datetime.d.ts +1 -1
- package/dist/builtins/datetime.js +60 -72
- package/dist/builtins/datetime.js.map +1 -1
- package/dist/builtins/distribution-builtins.d.ts +2 -2
- package/dist/builtins/distribution-builtins.js +62 -112
- package/dist/builtins/distribution-builtins.js.map +1 -1
- package/dist/builtins/distributions.js +17 -54
- package/dist/builtins/distributions.js.map +1 -1
- package/dist/builtins/financial-builtins.d.ts +2 -2
- package/dist/builtins/financial-builtins.js +9 -42
- package/dist/builtins/financial-builtins.js.map +1 -1
- package/dist/builtins/financial.js +4 -18
- package/dist/builtins/financial.js.map +1 -1
- package/dist/builtins/fixed-income-builtins.d.ts +2 -2
- package/dist/builtins/fixed-income-builtins.js +18 -60
- package/dist/builtins/fixed-income-builtins.js.map +1 -1
- package/dist/builtins/fixed-income.js +25 -96
- package/dist/builtins/fixed-income.js.map +1 -1
- package/dist/builtins/formatting.js +9 -9
- package/dist/builtins/formatting.js.map +1 -1
- package/dist/builtins/logical.d.ts +1 -1
- package/dist/builtins/logical.js +5 -5
- package/dist/builtins/logical.js.map +1 -1
- package/dist/builtins/lookup-array-shape-builtins.d.ts +3 -3
- package/dist/builtins/lookup-array-shape-builtins.js +8 -15
- package/dist/builtins/lookup-array-shape-builtins.js.map +1 -1
- package/dist/builtins/lookup-criteria-builtins.d.ts +2 -2
- package/dist/builtins/lookup-criteria-builtins.js +1 -1
- package/dist/builtins/lookup-criteria-builtins.js.map +1 -1
- package/dist/builtins/lookup-database-builtins.d.ts +2 -2
- package/dist/builtins/lookup-database-builtins.js +20 -24
- package/dist/builtins/lookup-database-builtins.js.map +1 -1
- package/dist/builtins/lookup-financial-builtins.d.ts +3 -3
- package/dist/builtins/lookup-financial-builtins.js +14 -30
- package/dist/builtins/lookup-financial-builtins.js.map +1 -1
- package/dist/builtins/lookup-hypothesis-builtins.d.ts +2 -2
- package/dist/builtins/lookup-hypothesis-builtins.js +23 -58
- package/dist/builtins/lookup-hypothesis-builtins.js.map +1 -1
- package/dist/builtins/lookup-matrix-builtins.d.ts +3 -3
- package/dist/builtins/lookup-matrix-builtins.js +5 -3
- package/dist/builtins/lookup-matrix-builtins.js.map +1 -1
- package/dist/builtins/lookup-order-statistics-builtins.d.ts +3 -3
- package/dist/builtins/lookup-order-statistics-builtins.js +18 -30
- package/dist/builtins/lookup-order-statistics-builtins.js.map +1 -1
- package/dist/builtins/lookup-reference-builtins.d.ts +2 -2
- package/dist/builtins/lookup-reference-builtins.js +10 -26
- package/dist/builtins/lookup-reference-builtins.js.map +1 -1
- package/dist/builtins/lookup-regression-builtins.d.ts +2 -2
- package/dist/builtins/lookup-regression-builtins.js +52 -69
- package/dist/builtins/lookup-regression-builtins.js.map +1 -1
- package/dist/builtins/lookup-sort-filter-builtins.d.ts +3 -3
- package/dist/builtins/lookup-sort-filter-builtins.js +5 -13
- package/dist/builtins/lookup-sort-filter-builtins.js.map +1 -1
- package/dist/builtins/lookup.d.ts +5 -5
- package/dist/builtins/lookup.js +61 -73
- package/dist/builtins/lookup.js.map +1 -1
- package/dist/builtins/math-builtins.d.ts +2 -2
- package/dist/builtins/math-builtins.js +11 -17
- package/dist/builtins/math-builtins.js.map +1 -1
- package/dist/builtins/numeric.d.ts +2 -2
- package/dist/builtins/numeric.js +2 -2
- package/dist/builtins/numeric.js.map +1 -1
- package/dist/builtins/placeholder.d.ts +1 -1
- package/dist/builtins/placeholder.js +505 -505
- package/dist/builtins/placeholder.js.map +1 -1
- package/dist/builtins/radix.d.ts +2 -2
- package/dist/builtins/radix.js +33 -39
- package/dist/builtins/radix.js.map +1 -1
- package/dist/builtins/statistical-builtins.d.ts +2 -2
- package/dist/builtins/statistical-builtins.js +29 -56
- package/dist/builtins/statistical-builtins.js.map +1 -1
- package/dist/builtins/statistics.d.ts +1 -1
- package/dist/builtins/statistics.js +3 -7
- package/dist/builtins/statistics.js.map +1 -1
- package/dist/builtins/text-core-builtins.d.ts +2 -2
- package/dist/builtins/text-core-builtins.js +110 -110
- package/dist/builtins/text-core-builtins.js.map +1 -1
- package/dist/builtins/text-format-builtins.d.ts +2 -2
- package/dist/builtins/text-format-builtins.js +109 -141
- package/dist/builtins/text-format-builtins.js.map +1 -1
- package/dist/builtins/text-search-builtins.d.ts +2 -2
- package/dist/builtins/text-search-builtins.js +37 -44
- package/dist/builtins/text-search-builtins.js.map +1 -1
- package/dist/builtins/text.d.ts +2 -2
- package/dist/builtins/text.js +19 -29
- package/dist/builtins/text.js.map +1 -1
- package/dist/builtins.d.ts +3 -3
- package/dist/builtins.js +55 -75
- package/dist/builtins.js.map +1 -1
- package/dist/compatibility.js +425 -430
- package/dist/compatibility.js.map +1 -1
- package/dist/compiler.d.ts +7 -7
- package/dist/compiler.js +212 -228
- package/dist/compiler.js.map +1 -1
- package/dist/external-function-adapter.d.ts +6 -6
- package/dist/external-function-adapter.js +3 -3
- package/dist/external-function-adapter.js.map +1 -1
- package/dist/formula-template-key.js +25 -26
- package/dist/formula-template-key.js.map +1 -1
- package/dist/generated/formula-inventory.js +3567 -3567
- package/dist/generated/formula-inventory.js.map +1 -1
- package/dist/group-pivot-evaluator.d.ts +2 -2
- package/dist/group-pivot-evaluator.js +27 -32
- package/dist/group-pivot-evaluator.js.map +1 -1
- package/dist/index.d.ts +20 -20
- package/dist/index.js +20 -20
- package/dist/index.js.map +1 -1
- package/dist/js-evaluator-array-special-calls.d.ts +3 -3
- package/dist/js-evaluator-array-special-calls.js +25 -34
- package/dist/js-evaluator-array-special-calls.js.map +1 -1
- package/dist/js-evaluator-context-special-calls.d.ts +2 -2
- package/dist/js-evaluator-context-special-calls.js +23 -27
- package/dist/js-evaluator-context-special-calls.js.map +1 -1
- package/dist/js-evaluator-reference-context.d.ts +2 -2
- package/dist/js-evaluator-reference-context.js +22 -24
- package/dist/js-evaluator-reference-context.js.map +1 -1
- package/dist/js-evaluator-workbook-special-calls.d.ts +2 -2
- package/dist/js-evaluator-workbook-special-calls.js +18 -24
- package/dist/js-evaluator-workbook-special-calls.js.map +1 -1
- package/dist/js-evaluator.d.ts +40 -40
- package/dist/js-evaluator.js +135 -147
- package/dist/js-evaluator.js.map +1 -1
- package/dist/js-plan-lowering.d.ts +2 -2
- package/dist/js-plan-lowering.js +103 -108
- package/dist/js-plan-lowering.js.map +1 -1
- package/dist/lexer.d.ts +1 -1
- package/dist/lexer.js +34 -43
- package/dist/lexer.js.map +1 -1
- package/dist/optimizer.d.ts +1 -1
- package/dist/optimizer.js +99 -108
- package/dist/optimizer.js.map +1 -1
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +129 -136
- package/dist/parser.js.map +1 -1
- package/dist/program-arena.js.map +1 -1
- package/dist/runtime-inventory.d.ts +2 -2
- package/dist/runtime-inventory.js +14 -20
- package/dist/runtime-inventory.js.map +1 -1
- package/dist/runtime-values.d.ts +4 -4
- package/dist/runtime-values.js +2 -2
- package/dist/runtime-values.js.map +1 -1
- package/dist/special-call-rewrites.d.ts +1 -1
- package/dist/special-call-rewrites.js +14 -18
- package/dist/special-call-rewrites.js.map +1 -1
- package/dist/translation.d.ts +7 -7
- package/dist/translation.js +323 -366
- package/dist/translation.js.map +1 -1
- package/package.json +2 -2
package/dist/js-evaluator.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ErrorCode, type CellValue } from
|
|
2
|
-
import type { FormulaNode } from
|
|
3
|
-
import { type LookupBuiltin } from
|
|
4
|
-
import { type ArrayValue, type EvaluationResult } from
|
|
1
|
+
import { ErrorCode, type CellValue } from '@bilig/protocol';
|
|
2
|
+
import type { FormulaNode } from './ast.js';
|
|
3
|
+
import { type LookupBuiltin } from './builtins/lookup.js';
|
|
4
|
+
import { type ArrayValue, type EvaluationResult } from './runtime-values.js';
|
|
5
5
|
export interface EvaluationContext {
|
|
6
6
|
sheetName: string;
|
|
7
7
|
currentAddress?: string;
|
|
8
8
|
resolveCell: (sheetName: string, address: string) => CellValue;
|
|
9
|
-
resolveRange: (sheetName: string, start: string, end: string, refKind:
|
|
9
|
+
resolveRange: (sheetName: string, start: string, end: string, refKind: 'cells' | 'rows' | 'cols') => CellValue[];
|
|
10
10
|
resolveName?: (name: string) => CellValue;
|
|
11
11
|
resolveFormula?: (sheetName: string, address: string) => string | undefined;
|
|
12
12
|
resolvePivotData?: (request: {
|
|
@@ -67,41 +67,41 @@ export type ExactVectorMatchResult = {
|
|
|
67
67
|
};
|
|
68
68
|
export type ApproximateVectorMatchResult = ExactVectorMatchResult;
|
|
69
69
|
export interface ReferenceOperand {
|
|
70
|
-
kind:
|
|
70
|
+
kind: 'cell' | 'range' | 'row' | 'col';
|
|
71
71
|
sheetName?: string;
|
|
72
72
|
address?: string;
|
|
73
73
|
start?: string;
|
|
74
74
|
end?: string;
|
|
75
|
-
refKind?:
|
|
75
|
+
refKind?: 'cells' | 'rows' | 'cols';
|
|
76
76
|
}
|
|
77
77
|
export type JsPlanInstruction = {
|
|
78
|
-
opcode:
|
|
78
|
+
opcode: 'push-number';
|
|
79
79
|
value: number;
|
|
80
80
|
} | {
|
|
81
|
-
opcode:
|
|
81
|
+
opcode: 'push-boolean';
|
|
82
82
|
value: boolean;
|
|
83
83
|
} | {
|
|
84
|
-
opcode:
|
|
84
|
+
opcode: 'push-string';
|
|
85
85
|
value: string;
|
|
86
86
|
} | {
|
|
87
|
-
opcode:
|
|
87
|
+
opcode: 'push-error';
|
|
88
88
|
code: ErrorCode;
|
|
89
89
|
} | {
|
|
90
|
-
opcode:
|
|
90
|
+
opcode: 'push-name';
|
|
91
91
|
name: string;
|
|
92
92
|
} | {
|
|
93
|
-
opcode:
|
|
93
|
+
opcode: 'push-cell';
|
|
94
94
|
sheetName?: string;
|
|
95
95
|
address: string;
|
|
96
96
|
} | {
|
|
97
|
-
opcode:
|
|
97
|
+
opcode: 'push-range';
|
|
98
98
|
sheetName?: string;
|
|
99
99
|
start: string;
|
|
100
100
|
end: string;
|
|
101
|
-
refKind:
|
|
101
|
+
refKind: 'cells' | 'rows' | 'cols';
|
|
102
102
|
} | {
|
|
103
|
-
opcode:
|
|
104
|
-
callee:
|
|
103
|
+
opcode: 'lookup-exact-match';
|
|
104
|
+
callee: 'MATCH' | 'XMATCH';
|
|
105
105
|
sheetName?: string;
|
|
106
106
|
start: string;
|
|
107
107
|
end: string;
|
|
@@ -109,11 +109,11 @@ export type JsPlanInstruction = {
|
|
|
109
109
|
endRow: number;
|
|
110
110
|
startCol: number;
|
|
111
111
|
endCol: number;
|
|
112
|
-
refKind:
|
|
112
|
+
refKind: 'cells';
|
|
113
113
|
searchMode: 1 | -1;
|
|
114
114
|
} | {
|
|
115
|
-
opcode:
|
|
116
|
-
callee:
|
|
115
|
+
opcode: 'lookup-approximate-match';
|
|
116
|
+
callee: 'MATCH' | 'XMATCH';
|
|
117
117
|
sheetName?: string;
|
|
118
118
|
start: string;
|
|
119
119
|
end: string;
|
|
@@ -121,63 +121,63 @@ export type JsPlanInstruction = {
|
|
|
121
121
|
endRow: number;
|
|
122
122
|
startCol: number;
|
|
123
123
|
endCol: number;
|
|
124
|
-
refKind:
|
|
124
|
+
refKind: 'cells';
|
|
125
125
|
matchMode: 1 | -1;
|
|
126
126
|
} | {
|
|
127
|
-
opcode:
|
|
127
|
+
opcode: 'push-lambda';
|
|
128
128
|
params: string[];
|
|
129
129
|
body: JsPlanInstruction[];
|
|
130
130
|
} | {
|
|
131
|
-
opcode:
|
|
132
|
-
operator:
|
|
131
|
+
opcode: 'unary';
|
|
132
|
+
operator: '+' | '-';
|
|
133
133
|
} | {
|
|
134
|
-
opcode:
|
|
135
|
-
operator:
|
|
134
|
+
opcode: 'binary';
|
|
135
|
+
operator: '+' | '-' | '*' | '/' | '^' | '&' | '=' | '<>' | '>' | '>=' | '<' | '<=';
|
|
136
136
|
} | {
|
|
137
|
-
opcode:
|
|
137
|
+
opcode: 'call';
|
|
138
138
|
callee: string;
|
|
139
139
|
argc: number;
|
|
140
140
|
argRefs?: Array<ReferenceOperand | undefined>;
|
|
141
141
|
} | {
|
|
142
|
-
opcode:
|
|
142
|
+
opcode: 'invoke';
|
|
143
143
|
argc: number;
|
|
144
144
|
} | {
|
|
145
|
-
opcode:
|
|
145
|
+
opcode: 'begin-scope';
|
|
146
146
|
} | {
|
|
147
|
-
opcode:
|
|
147
|
+
opcode: 'bind-name';
|
|
148
148
|
name: string;
|
|
149
149
|
} | {
|
|
150
|
-
opcode:
|
|
150
|
+
opcode: 'end-scope';
|
|
151
151
|
} | {
|
|
152
|
-
opcode:
|
|
152
|
+
opcode: 'jump-if-false';
|
|
153
153
|
target: number;
|
|
154
154
|
} | {
|
|
155
|
-
opcode:
|
|
155
|
+
opcode: 'jump';
|
|
156
156
|
target: number;
|
|
157
157
|
} | {
|
|
158
|
-
opcode:
|
|
158
|
+
opcode: 'return';
|
|
159
159
|
};
|
|
160
160
|
export type StackValue = {
|
|
161
|
-
kind:
|
|
161
|
+
kind: 'scalar';
|
|
162
162
|
value: CellValue;
|
|
163
163
|
} | {
|
|
164
|
-
kind:
|
|
164
|
+
kind: 'omitted';
|
|
165
165
|
} | {
|
|
166
|
-
kind:
|
|
166
|
+
kind: 'range';
|
|
167
167
|
values: CellValue[];
|
|
168
|
-
refKind:
|
|
168
|
+
refKind: 'cells' | 'rows' | 'cols';
|
|
169
169
|
rows: number;
|
|
170
170
|
cols: number;
|
|
171
171
|
sheetName?: string;
|
|
172
172
|
start?: string;
|
|
173
173
|
end?: string;
|
|
174
174
|
} | {
|
|
175
|
-
kind:
|
|
175
|
+
kind: 'lambda';
|
|
176
176
|
params: string[];
|
|
177
177
|
body: JsPlanInstruction[];
|
|
178
178
|
scopes: Array<Map<string, StackValue>>;
|
|
179
179
|
} | ArrayValue;
|
|
180
|
-
export { lowerToPlan } from
|
|
180
|
+
export { lowerToPlan } from './js-plan-lowering.js';
|
|
181
181
|
export declare function evaluatePlanResult(plan: readonly JsPlanInstruction[], context: EvaluationContext): EvaluationResult;
|
|
182
182
|
export declare function evaluatePlan(plan: readonly JsPlanInstruction[], context: EvaluationContext): CellValue;
|
|
183
183
|
export declare function evaluateAst(node: FormulaNode, context: EvaluationContext): CellValue;
|