import { Token } from "./tokenizer";
interface RichToken extends Token {
    tokenIndex: number;
}
export declare class TokenList {
    private tokens;
    currentIndex: number;
    current: RichToken | undefined;
    length: number;
    constructor(tokens: RichToken[]);
    shift(): RichToken;
    get next(): RichToken | undefined;
}
interface ASTBase {
    debug?: boolean;
    tokenStartIndex: number;
    tokenEndIndex: number;
}
interface ASTNumber extends ASTBase {
    type: "NUMBER";
    value: number;
}
interface ASTReference extends ASTBase {
    type: "REFERENCE";
    value: string;
}
export interface ASTString extends ASTBase {
    type: "STRING";
    value: string;
}
interface ASTBoolean extends ASTBase {
    type: "BOOLEAN";
    value: boolean;
}
export interface ASTUnaryOperation extends ASTBase {
    type: "UNARY_OPERATION";
    value: any;
    operand: AST;
    postfix?: boolean;
}
export interface ASTOperation extends ASTBase {
    type: "BIN_OPERATION";
    value: any;
    left: AST;
    right: AST;
}
export interface ASTFuncall extends ASTBase {
    type: "FUNCALL";
    value: string;
    args: AST[];
}
export interface ASTSymbol extends ASTBase {
    type: "SYMBOL";
    value: string;
}
export interface ASTArray extends ASTBase {
    type: "ARRAY";
    value: AST[][];
}
interface ASTEmpty extends ASTBase {
    type: "EMPTY";
    value: "";
}
export type AST = ASTOperation | ASTUnaryOperation | ASTFuncall | ASTSymbol | ASTArray | ASTNumber | ASTBoolean | ASTString | ASTReference | ASTEmpty;
export declare const OP_PRIORITY: {
    "#": number;
    "%": number;
    "^": number;
    "*": number;
    "/": number;
    "+": number;
    "-": number;
    "&": number;
    ">": number;
    "<>": number;
    ">=": number;
    "<": number;
    "<=": number;
    "=": number;
};
/**
 * Parse an expression (as a string) into an AST.
 */
export declare function parse(str: string): AST;
export declare function parseTokens(tokens: readonly Token[]): AST;
/**
 * Allows to visit all nodes of an AST and apply a mapping function
 * to nodes of a specific type.
 * Useful if you want to convert some part of a formula.
 *
 * @example
 * convertAstNodes(ast, "FUNCALL", convertFormulaToExcel)
 *
 * function convertFormulaToExcel(ast: ASTFuncall) {
 *   // ...
 *   return modifiedAst
 * }
 */
export declare function convertAstNodes<T extends AST["type"]>(ast: AST, type: T, fn: (ast: Extract<AST, {
    type: T;
}>) => AST): AST;
export declare function iterateAstNodes(ast: AST): AST[];
export declare function mapAst<T extends AST["type"]>(ast: AST, fn: (ast: Extract<AST, {
    type: T;
}>) => AST): AST;
export declare function isFuncallToken(currentToken: Token, nextToken: Token | undefined): boolean;
export {};
