import type Decimal from 'decimal.js'; declare enum TokenType { /** none */ ttNone = 0, /** + */ ttAdd = 1, /** - */ ttMinus = 2, /** * */ ttMul = 3, /** / */ ttDiv = 4, /** // */ ttDivInt = 5, /** % */ ttMod = 6, /** ^ */ ttPow = 7, /** % */ ttPercent = 8, /** & */ ttAnd = 9, /** | */ ttOr = 10, /** ! */ ttNot = 11, /** > */ ttGT = 12, /** >= */ ttGE = 13, /** < */ ttLT = 14, /** <= */ ttLE = 15, /** = */ ttEQ = 16, /** != */ ttNE = 17, /** ( */ ttParenL = 18, /** ) */ ttParenR = 19, /** , */ ttListSeparator = 20, /** \n */ ttLine = 21, /** null */ ttNull = 22, /** NaN */ ttNaN = 23, /** true */ ttBool = 24, /** function */ ttFunc = 25, /** ref */ ttRef = 26, /** name */ ttName = 27, /** number */ ttNumber = 28, /** string */ ttString = 29, /** space */ ttSpace = 30, /** if */ ttIf = 31, /** else */ ttIfElse = 32 } interface Token { token: string; tokenType: TokenType; quoteChar: string; index: number; column: number; line: number; length: number; } declare enum FormulaOperatorType { fotBinary = 0, fotUnaryLeft = 1, fotUnaryRight = 2, fotQuote = 3, fotTernary = 4 } declare enum FormulaExecuteState { fesNone = 0, fesExecuting = 1, fesExecuted = 2 } declare const TokenUnaryLefts: TokenType[]; declare const TokenUnaryRights: TokenType[]; declare const TokenBinaries: TokenType[]; declare const TokenOperators: TokenType[]; declare const TokenNegatives: TokenType[]; declare const TokenPercents: TokenType[]; declare const TokenValues: TokenType[]; declare const OperatorWithRightParams: FormulaOperatorType[]; declare const OperatorWithLeftParams: FormulaOperatorType[]; interface IFormulaDataSource { getParam(name: string, options: FormulaValueOptions, forArithmetic?: boolean): any; } type RoundingType = 'UP' | 'DOWN' | 'CEIL' | 'FLOOR' | 'HALF_UP' | 'HALF_DOWN' | 'HALF_EVEN' | 'HALF_CEIL' | 'HALF_FLOOR' | 'EUCLID'; type FormulaValueOptions = { Decimal?: typeof Decimal; precision?: number; rounding?: RoundingType; stepPrecision?: boolean | number | ((item: IFormulaValue, value: any) => boolean | number); stepPrecisionIgnorePercent?: boolean; tryStringToNumber?: boolean; ignoreRoundingOriginalValue?: boolean; ignoreRoundingParams?: boolean | ((name: string) => boolean); returnDecimal?: boolean; nullAsZero?: boolean; nullIfParamNotFound?: boolean; eval?: null | ((expr: string, dataSource: IFormulaDataSource, options: FormulaValueOptions, forArithmetic?: boolean) => any); onTrace?: (item: IFormulaValue, value: any) => void; }; type FormulaCustomFunctionItem = { preExecute?: true; arithmetic?: boolean; mayChange?: boolean; argMin: number; argMax: number; execute: (params: any[], dataSource: IFormulaDataSource, options: FormulaValueOptions, forArithmetic?: boolean) => any; } | { preExecute: false; arithmetic?: boolean; mayChange?: boolean; argMin: number; argMax: number; execute: (params: FormulaValues, dataSource: IFormulaDataSource, options: FormulaValueOptions, forArithmetic?: boolean) => any; }; interface IFormulaValue { token: Token; readonly origText: string; readonly line: number; readonly column: number; value: any; name: string; state: FormulaExecuteState; readonly arithmetic: boolean; readonly tokenType: TokenType; readonly mayChange: boolean; execute(dataSource?: IFormulaDataSource, options?: FormulaValueOptions, forArithmetic?: boolean): any; } type FormulaValues = Array; interface IFormulaParam extends IFormulaValue { name: string; } interface IFormulaBase extends IFormulaValue { params: FormulaValues; } interface IFormulaFunction extends IFormulaBase { origText: string; argMin: number; argMax: number; owner: IFormulaValue | null; } interface IFormulaOperator extends IFormulaBase { priority: number; operatorType: FormulaOperatorType; readonly paramsCount: number | null; } export { TokenType, FormulaOperatorType, FormulaExecuteState, TokenValues, TokenUnaryLefts, TokenUnaryRights, TokenBinaries, TokenOperators, TokenNegatives, TokenPercents, OperatorWithRightParams, OperatorWithLeftParams, FormulaValues, }; export type { Token, IFormulaFunction, IFormulaOperator, IFormulaValue, IFormulaBase, IFormulaParam, IFormulaDataSource, FormulaValueOptions, FormulaCustomFunctionItem, RoundingType, };