import { CoreGetters } from "../types/core_getters";
import { ApplyRangeChange, ApplyRenameNamedRange, FormulaToExecute, LiteralValues, NamedRange, UID } from "../types/misc";
import { Range, RangeStringOptions } from "../types/range";
import { AST } from "./parser";
import { Token } from "./tokenizer";
export declare const OPERATOR_MAP: {
    "=": string;
    "+": string;
    "-": string;
    "*": string;
    "/": string;
    ">=": string;
    "<>": string;
    ">": string;
    "<=": string;
    "<": string;
    "^": string;
    "&": string;
};
export declare const UNARY_OPERATOR_MAP: {
    "-": string;
    "+": string;
    "%": string;
    "#": string;
};
interface ICompiledFormula {
    execute: FormulaToExecute;
    tokens: Token[];
    dependencies: string[];
    isBadExpression: boolean;
    normalizedFormula: string;
    literalValues: LiteralValues;
    symbols: string[];
}
export declare const functionCache: {
    [key: string]: FormulaToExecute;
};
/**
 * A compiled formula is the result of the compilation of a formula string.
 * It contains all the information needed to execute the formula, as well as some metadata
 * about the formula (dependencies, literal values, symbols...) that can be used to rebuild a slightly different formula
 * without recompiling it (for example when the formula is copied to another cell, or when we want to replace literal values but keep the same structure).
 * */
export declare class CompiledFormula implements Omit<ICompiledFormula, "tokens" | "dependencies"> {
    readonly sheetId: UID;
    private readonly tokens;
    readonly literalValues: LiteralValues;
    readonly symbols: string[];
    readonly isBadExpression: boolean;
    readonly normalizedFormula: string;
    readonly execute: FormulaToExecute;
    readonly rangeDependencies: Range[];
    hasDependencies: boolean;
    private constructor();
    private getTokens;
    getAst(getters: CoreGetters): AST;
    /**
     * Return the string representation of the formula, with the current dependencies and literal values.
     * This is a heavy operation as it converts the rangeDependencies to string on each call.
     * */
    toFormulaString(getters: CoreGetters, referenceOption?: RangeStringOptions): string;
    getNamedRangesInFormula(getters: CoreGetters): NamedRange[];
    usesSymbol(symbol: string): boolean;
    areAllFunctionsExportableToExcel(): boolean;
    getFunctionsFromTokens(functionNames: string[], getters: CoreGetters): {
        functionName: string;
        args: AST[];
    }[];
    isFirstNonWhitespaceSymbol(tokenValue: string): boolean;
    adaptCompiledFormula(applyChange: ApplyRangeChange, applyUpdateNamedRange: ApplyRenameNamedRange): CompiledFormula;
    /** Change the symbols and tokens on a named range change. Return undefined if nothing has changed. */
    private renameNamedRangeTokens;
    static IsBadExpression(formula: string): boolean;
    /**
     * Recreates a CompiledFormula based on `base` with adapted dependencies.
     * */
    static CopyWithDependencies(base: CompiledFormula, sheetId: UID, dependencies: Range[]): CompiledFormula;
    /**
     * Recreates a CompiledFormula based on `base` with adapted dependencies and/or different literal values.
     * */
    static CopyWithDependenciesAndLiteral(base: CompiledFormula, sheetId: UID, dependencies: Range[], literalNumbers: {
        value: number;
    }[], literalStrings: {
        value: string;
    }[]): CompiledFormula;
    /**
     * When copy/pasting a formula across sheets, the formula is serialized (all it's serializable properties are kept) and deserialized on the new sheet.
     * This function allows to recompile the formula based on the serializable properties.
     * */
    static CompileForSerializedFormula(sheetId: UID, base: SerializedCompiledFormula): CompiledFormula;
    /**
     * Make a new instance of CompiledFormula by compiling the formula string as input by the user.
     * */
    static Compile(formula: string, sheetId: UID, getters: CoreGetters): CompiledFormula;
}
/**
 * A compiled formula serialized
 * */
export type SerializedCompiledFormula = {
    sheetId: UID;
    tokens: Token[];
    literalValues: LiteralValues;
    symbols: string[];
    rangeDependencies: Range[];
    isBadExpression: boolean;
    normalizedFormula: string;
};
export {};
