@syncfusion/ej2-calculate 35.1.37
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/.eslintrc.json +263 -0
- package/README.md +132 -0
- package/base.d.ts +4 -0
- package/base.js +4 -0
- package/common.d.ts +4 -0
- package/common.js +4 -0
- package/dist/ej2-calculate.umd.min.js +11 -0
- package/dist/ej2-calculate.umd.min.js.map +1 -0
- package/dist/es6/ej2-calculate.es2015.js +24801 -0
- package/dist/es6/ej2-calculate.es2015.js.map +1 -0
- package/dist/es6/ej2-calculate.es5.js +27229 -0
- package/dist/es6/ej2-calculate.es5.js.map +1 -0
- package/dist/global/ej2-calculate.min.js +11 -0
- package/dist/global/ej2-calculate.min.js.map +1 -0
- package/dist/global/index.d.ts +14 -0
- package/formulas.d.ts +4 -0
- package/formulas.js +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/package.json +30 -0
- package/src/base/calculate-model.d.ts +4 -0
- package/src/base/calculate-model.js +0 -0
- package/src/base/calculate.d.ts +1105 -0
- package/src/base/calculate.js +4720 -0
- package/src/base/index.d.ts +8 -0
- package/src/base/index.js +7 -0
- package/src/base/parser.d.ts +208 -0
- package/src/base/parser.js +1512 -0
- package/src/common/address.d.ts +59 -0
- package/src/common/address.js +96 -0
- package/src/common/cell-ref.d.ts +32 -0
- package/src/common/cell-ref.js +112 -0
- package/src/common/common.d.ts +44 -0
- package/src/common/common.js +134 -0
- package/src/common/enum.d.ts +94 -0
- package/src/common/enum.js +97 -0
- package/src/common/index.d.ts +9 -0
- package/src/common/index.js +8 -0
- package/src/common/interface.d.ts +122 -0
- package/src/common/interface.js +0 -0
- package/src/common/l10n.d.ts +24 -0
- package/src/common/l10n.js +54 -0
- package/src/common/number-date.d.ts +26 -0
- package/src/common/number-date.js +38 -0
- package/src/common/sheet-info.d.ts +10 -0
- package/src/common/sheet-info.js +17 -0
- package/src/common/sort.d.ts +17 -0
- package/src/common/sort.js +44 -0
- package/src/formulas/array.d.ts +47 -0
- package/src/formulas/array.js +718 -0
- package/src/formulas/basic.d.ts +47 -0
- package/src/formulas/basic.js +181 -0
- package/src/formulas/complex-numbers.d.ts +207 -0
- package/src/formulas/complex-numbers.js +549 -0
- package/src/formulas/database.d.ts +152 -0
- package/src/formulas/database.js +579 -0
- package/src/formulas/date-time-extra.d.ts +97 -0
- package/src/formulas/date-time-extra.js +415 -0
- package/src/formulas/date-time-intl.d.ts +57 -0
- package/src/formulas/date-time-intl.js +309 -0
- package/src/formulas/date-time.d.ts +164 -0
- package/src/formulas/date-time.js +1021 -0
- package/src/formulas/engineering-base.d.ts +150 -0
- package/src/formulas/engineering-base.js +404 -0
- package/src/formulas/engineering-bessel.d.ts +65 -0
- package/src/formulas/engineering-bessel.js +167 -0
- package/src/formulas/engineering-convert.d.ts +35 -0
- package/src/formulas/engineering-convert.js +120 -0
- package/src/formulas/engineering-misc.d.ts +64 -0
- package/src/formulas/engineering-misc.js +168 -0
- package/src/formulas/financial-amortization-ecma.d.ts +87 -0
- package/src/formulas/financial-amortization-ecma.js +288 -0
- package/src/formulas/financial-annuity.d.ts +104 -0
- package/src/formulas/financial-annuity.js +419 -0
- package/src/formulas/financial-bond-helpers.d.ts +106 -0
- package/src/formulas/financial-bond-helpers.js +190 -0
- package/src/formulas/financial-cashflow.d.ts +47 -0
- package/src/formulas/financial-cashflow.js +203 -0
- package/src/formulas/financial-coupons.d.ts +227 -0
- package/src/formulas/financial-coupons.js +810 -0
- package/src/formulas/financial-depreciation.d.ts +64 -0
- package/src/formulas/financial-depreciation.js +247 -0
- package/src/formulas/financial-rates.d.ts +54 -0
- package/src/formulas/financial-rates.js +140 -0
- package/src/formulas/financial-securities.d.ts +126 -0
- package/src/formulas/financial-securities.js +488 -0
- package/src/formulas/formula-math-helpers.d.ts +212 -0
- package/src/formulas/formula-math-helpers.js +599 -0
- package/src/formulas/formula-module-base.d.ts +54 -0
- package/src/formulas/formula-module-base.js +125 -0
- package/src/formulas/formula-owner.d.ts +17 -0
- package/src/formulas/formula-owner.js +0 -0
- package/src/formulas/index.d.ts +68 -0
- package/src/formulas/index.js +67 -0
- package/src/formulas/information-advanced.d.ts +44 -0
- package/src/formulas/information-advanced.js +157 -0
- package/src/formulas/information-ecma.d.ts +33 -0
- package/src/formulas/information-ecma.js +88 -0
- package/src/formulas/information-extra.d.ts +146 -0
- package/src/formulas/information-extra.js +351 -0
- package/src/formulas/information.d.ts +34 -0
- package/src/formulas/information.js +78 -0
- package/src/formulas/logical-extra.d.ts +75 -0
- package/src/formulas/logical-extra.js +217 -0
- package/src/formulas/logical.d.ts +83 -0
- package/src/formulas/logical.js +296 -0
- package/src/formulas/lookup-array.d.ts +98 -0
- package/src/formulas/lookup-array.js +364 -0
- package/src/formulas/lookup-ref-extra.d.ts +64 -0
- package/src/formulas/lookup-ref-extra.js +180 -0
- package/src/formulas/lookup-ref.d.ts +84 -0
- package/src/formulas/lookup-ref.js +263 -0
- package/src/formulas/lookup.d.ts +114 -0
- package/src/formulas/lookup.js +881 -0
- package/src/formulas/math-aggregate.d.ts +74 -0
- package/src/formulas/math-aggregate.js +376 -0
- package/src/formulas/math-ceiling-ecma.d.ts +42 -0
- package/src/formulas/math-ceiling-ecma.js +123 -0
- package/src/formulas/math-combinatorics.d.ts +75 -0
- package/src/formulas/math-combinatorics.js +290 -0
- package/src/formulas/math-misc.d.ts +164 -0
- package/src/formulas/math-misc.js +889 -0
- package/src/formulas/math-number.d.ts +76 -0
- package/src/formulas/math-number.js +261 -0
- package/src/formulas/math-rounding.d.ts +115 -0
- package/src/formulas/math-rounding.js +728 -0
- package/src/formulas/math-trig-hyperbolic.d.ts +55 -0
- package/src/formulas/math-trig-hyperbolic.js +113 -0
- package/src/formulas/math-trig.d.ts +165 -0
- package/src/formulas/math-trig.js +334 -0
- package/src/formulas/matrix-base.d.ts +13 -0
- package/src/formulas/matrix-base.js +169 -0
- package/src/formulas/matrix.d.ts +64 -0
- package/src/formulas/matrix.js +161 -0
- package/src/formulas/regression-ecma.d.ts +66 -0
- package/src/formulas/regression-ecma.js +234 -0
- package/src/formulas/statistical-advanced.d.ts +125 -0
- package/src/formulas/statistical-advanced.js +756 -0
- package/src/formulas/statistical-correlation.d.ts +75 -0
- package/src/formulas/statistical-correlation.js +198 -0
- package/src/formulas/statistical-dispersion.d.ts +108 -0
- package/src/formulas/statistical-dispersion.js +337 -0
- package/src/formulas/statistical-distribution-extended.d.ts +176 -0
- package/src/formulas/statistical-distribution-extended.js +668 -0
- package/src/formulas/statistical-distribution.d.ts +104 -0
- package/src/formulas/statistical-distribution.js +368 -0
- package/src/formulas/statistical-ecma.d.ts +95 -0
- package/src/formulas/statistical-ecma.js +392 -0
- package/src/formulas/statistical-extended.d.ts +136 -0
- package/src/formulas/statistical-extended.js +340 -0
- package/src/formulas/statistical-ifs.d.ts +46 -0
- package/src/formulas/statistical-ifs.js +180 -0
- package/src/formulas/statistical-moments.d.ts +84 -0
- package/src/formulas/statistical-moments.js +269 -0
- package/src/formulas/statistical-percentile.d.ts +56 -0
- package/src/formulas/statistical-percentile.js +195 -0
- package/src/formulas/statistical-sample-base.d.ts +14 -0
- package/src/formulas/statistical-sample-base.js +124 -0
- package/src/formulas/statistical.d.ts +135 -0
- package/src/formulas/statistical.js +542 -0
- package/src/formulas/text-advanced.d.ts +64 -0
- package/src/formulas/text-advanced.js +222 -0
- package/src/formulas/text-ecma.d.ts +54 -0
- package/src/formulas/text-ecma.js +106 -0
- package/src/formulas/text-extra.d.ts +216 -0
- package/src/formulas/text-extra.js +657 -0
- package/src/formulas/text.d.ts +125 -0
- package/src/formulas/text.js +628 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +14 -0
- package/tslint.json +111 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formula tokenizer and parser for the Calculate engine.
|
|
3
|
+
*
|
|
4
|
+
* Converts Excel-style formula text into an internal token string consumed by
|
|
5
|
+
* {@link Calculate.computeFormula}. Handles operators, library function markers,
|
|
6
|
+
* named ranges, and sheet references.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Prefer {@link Calculate.computeFormula} or {@link Calculate.computeExpression}
|
|
10
|
+
* for evaluation. Use {@link Parser.parseFormula} when you need the parsed token
|
|
11
|
+
* form without computing a result.
|
|
12
|
+
*
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
import { Calculate } from './index';
|
|
16
|
+
export declare class Parser {
|
|
17
|
+
private parent;
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object} parent - Owning {@link Calculate} engine instance.
|
|
20
|
+
*/
|
|
21
|
+
constructor(parent?: Calculate);
|
|
22
|
+
private emptyStr;
|
|
23
|
+
private storedStringText;
|
|
24
|
+
private sheetToken;
|
|
25
|
+
/** @hidden */
|
|
26
|
+
tokenAdd: string;
|
|
27
|
+
/** @hidden */
|
|
28
|
+
tokenSubtract: string;
|
|
29
|
+
/** @hidden */
|
|
30
|
+
tokenMultiply: string;
|
|
31
|
+
/** @hidden */
|
|
32
|
+
tokenDivide: string;
|
|
33
|
+
/** @hidden */
|
|
34
|
+
tokenLess: string;
|
|
35
|
+
private charEm;
|
|
36
|
+
private charEp;
|
|
37
|
+
/** @hidden */
|
|
38
|
+
tokenGreater: string;
|
|
39
|
+
/** @hidden */
|
|
40
|
+
tokenEqual: string;
|
|
41
|
+
/** @hidden */
|
|
42
|
+
tokenLessEq: string;
|
|
43
|
+
/** @hidden */
|
|
44
|
+
tokenGreaterEq: string;
|
|
45
|
+
/** @hidden */
|
|
46
|
+
tokenNotEqual: string;
|
|
47
|
+
/** @hidden */
|
|
48
|
+
tokenAnd: string;
|
|
49
|
+
private tokenEm;
|
|
50
|
+
private tokenEp;
|
|
51
|
+
/** @hidden */
|
|
52
|
+
tokenOr: string;
|
|
53
|
+
private charAnd;
|
|
54
|
+
private charLess;
|
|
55
|
+
private charGreater;
|
|
56
|
+
private charEqual;
|
|
57
|
+
private charLessEq;
|
|
58
|
+
private charGreaterEq;
|
|
59
|
+
private charNoEqual;
|
|
60
|
+
private stringGreaterEq;
|
|
61
|
+
private stringLessEq;
|
|
62
|
+
private stringNoEqual;
|
|
63
|
+
private stringAnd;
|
|
64
|
+
private stringOr;
|
|
65
|
+
private charOr;
|
|
66
|
+
private charAdd;
|
|
67
|
+
private charSubtract;
|
|
68
|
+
private charMultiply;
|
|
69
|
+
private charDivide;
|
|
70
|
+
private fixedReference;
|
|
71
|
+
private spaceString;
|
|
72
|
+
private ignoreBracet;
|
|
73
|
+
/**
|
|
74
|
+
* When `true`, the last parse attempt failed.
|
|
75
|
+
*
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
isError: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* When `true`, formula text passed to compute is already a parsed token string.
|
|
81
|
+
*
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
isFormulaParsed: boolean;
|
|
85
|
+
private findNamedRange;
|
|
86
|
+
private stringsColl;
|
|
87
|
+
private tokens;
|
|
88
|
+
private charNOTop;
|
|
89
|
+
private specialSym;
|
|
90
|
+
private isFailureTriggered;
|
|
91
|
+
/**
|
|
92
|
+
* Parses formula text into the engine's internal token representation.
|
|
93
|
+
*
|
|
94
|
+
* Performs named-range substitution, string literal extraction, operator
|
|
95
|
+
* collapsing, and library-formula marking.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} text - Formula text (leading `=` is optional).
|
|
98
|
+
* @param {string} fkey - Optional formula cell key for named-range / failure context.
|
|
99
|
+
* @returns {string} - Parsed token string, or an error token when parsing fails.
|
|
100
|
+
*/
|
|
101
|
+
parse(text: string, fkey?: string): string;
|
|
102
|
+
private exceptionArgs;
|
|
103
|
+
private formulaAutoCorrection;
|
|
104
|
+
private checkScopedRange;
|
|
105
|
+
private storeStrings;
|
|
106
|
+
private setStrings;
|
|
107
|
+
/**
|
|
108
|
+
* Parses a simple (non-library) expression after library formulas are marked.
|
|
109
|
+
*
|
|
110
|
+
* @param {string} formulaText - Partially processed formula text.
|
|
111
|
+
* @returns {string} - Token string with arithmetic markers applied.
|
|
112
|
+
*/
|
|
113
|
+
parseSimple(formulaText: string): string;
|
|
114
|
+
/**
|
|
115
|
+
* Replaces operator characters with single-character tokens for evaluation.
|
|
116
|
+
*
|
|
117
|
+
* @param {string} formulaText - Formula text containing operator markers.
|
|
118
|
+
* @param {string | number | Object} markers - Replacement token characters.
|
|
119
|
+
* @param {string} operators - Operator strings to replace.
|
|
120
|
+
* @returns {string} - Formula text with operators tokenized.
|
|
121
|
+
*/
|
|
122
|
+
parseSimpleOperators(formulaText: string, markers: string[], operators: string[]): string;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the index of the first character in `text` that appears in `operators`.
|
|
125
|
+
*
|
|
126
|
+
* @param {string} text - Text to search.
|
|
127
|
+
* @param {string | number | Object} operators - Characters to find.
|
|
128
|
+
* @returns {string | number} - Index of the first match, or `-1`.
|
|
129
|
+
*/
|
|
130
|
+
indexOfAny(text: string, operators: string[]): number;
|
|
131
|
+
/**
|
|
132
|
+
* Finds the matching left arithmetic marker for a right-marker position.
|
|
133
|
+
*
|
|
134
|
+
* @param {string} text - Tokenized formula text.
|
|
135
|
+
* @returns {string | number} - Index of the left marker.
|
|
136
|
+
*/
|
|
137
|
+
findLeftMarker(text: string): number;
|
|
138
|
+
/**
|
|
139
|
+
* Finds the matching right arithmetic marker for a left-marker position.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} text - Tokenized formula text.
|
|
142
|
+
* @returns {string | number} - Index of the right marker.
|
|
143
|
+
*/
|
|
144
|
+
findRightMarker(text: string): number;
|
|
145
|
+
/**
|
|
146
|
+
* Entry point that resets parser state and returns {@link parse} output.
|
|
147
|
+
*
|
|
148
|
+
* @param {string} formula - Formula text to parse.
|
|
149
|
+
* @param {string} fKey - Optional formula cell key.
|
|
150
|
+
* @returns {string} - Parsed token string.
|
|
151
|
+
*/
|
|
152
|
+
parseFormula(formula: string, fKey?: string): string;
|
|
153
|
+
/**
|
|
154
|
+
* Wraps recognized library function calls with `q` markers and bracket tokens.
|
|
155
|
+
*
|
|
156
|
+
* @param {string} formula - Formula text.
|
|
157
|
+
* @returns {string} - Formula text with library calls marked for evaluation.
|
|
158
|
+
*/
|
|
159
|
+
markLibraryFormulas(formula: string): string;
|
|
160
|
+
/**
|
|
161
|
+
* Swaps nested parentheses inside a library-formula substring for token safety.
|
|
162
|
+
*
|
|
163
|
+
* @hidden
|
|
164
|
+
* @param {string} fSubstr - Library formula substring.
|
|
165
|
+
* @returns {string} - Substring with inner parentheses rewritten.
|
|
166
|
+
*/
|
|
167
|
+
swapInnerParens(fSubstr: string): string;
|
|
168
|
+
/**
|
|
169
|
+
* Ensures library-formula arguments are wrapped for nested parsing.
|
|
170
|
+
*
|
|
171
|
+
* @hidden
|
|
172
|
+
* @param {string} fSubstr - Library formula substring.
|
|
173
|
+
* @returns {string} - Substring with argument parentheses normalized.
|
|
174
|
+
*/
|
|
175
|
+
addParensToArgs(fSubstr: string): string;
|
|
176
|
+
/**
|
|
177
|
+
* @hidden
|
|
178
|
+
* @param {string} text - specify the text
|
|
179
|
+
* @param {string[]} operators - specify the operators
|
|
180
|
+
* @returns {number} - returns last Index Of Any.
|
|
181
|
+
*/
|
|
182
|
+
private lastIndexOfAny;
|
|
183
|
+
/**
|
|
184
|
+
* Substitutes named ranges in formula text with their defined addresses.
|
|
185
|
+
*
|
|
186
|
+
* @param {string} formula - Formula text that may contain named ranges.
|
|
187
|
+
* @returns {string} - Formula text with names expanded.
|
|
188
|
+
*/
|
|
189
|
+
markNamedRanges(formula: string): string;
|
|
190
|
+
/**
|
|
191
|
+
* Resolves named ranges and standalone key values embedded in formula text.
|
|
192
|
+
*
|
|
193
|
+
* @param {string} text - Formula text.
|
|
194
|
+
* @returns {string} - Text with names/keys replaced by their values or addresses.
|
|
195
|
+
*/
|
|
196
|
+
checkForNamedRangeAndKeyValue(text: string): string;
|
|
197
|
+
private getTableRange;
|
|
198
|
+
private findNextEndIndex;
|
|
199
|
+
private processIndexArg;
|
|
200
|
+
private isValidDotFormulaName;
|
|
201
|
+
private isOtherLangChar;
|
|
202
|
+
/**
|
|
203
|
+
* Clears parser scratch state and detaches from the owning Calculate engine.
|
|
204
|
+
* @internal
|
|
205
|
+
* @returns {void}
|
|
206
|
+
*/
|
|
207
|
+
destroy(): void;
|
|
208
|
+
}
|