type VariableKind = "dimension" | "segment" | "aggregation" | "expression";
type Type = VariableKind | "string" | "number" | "boolean";
type VariableId = number;
export interface Token {
    type: NodeType;
    text: string;
    length: number;
    pos: number;
}
export interface Node {
    type: NodeType;
    children: Node[];
    complete: boolean;
    resolvedType: Type | VariableId;
    parent: Node | null;
    token: Token | null;
    isRoot?: boolean;
}
export interface NodeType {
    name?: string;
    skip: boolean;
    leftOperands: number;
    rightOperands: number;
    expectedChildCount: number;
    checkChildConstraints: (node: Node) => {
        position?: number;
        child?: Node;
    } | null;
    requiresTerminator: NodeType | null;
    ignoresTerminator: NodeType[];
    isTerminator: boolean;
    precedence: number;
    resolvesAs: Type | null;
    expectedTypes: Type[] | null;
}
type HookFn = (token: Token, node: Node) => void;
type HookErrFn = (token: Token, node: Node, err: CompileError) => void;
type NodeErrFn = (node: Node, err: CompileError) => void;
export interface Hooks {
    onIteration?: HookFn;
    onCreateNode?: HookFn;
    onPlaceNode?: (node: Node, parent: Node) => void;
    onSkipToken?: HookFn;
    onReparentNode?: HookFn;
    onCompleteNode?: HookFn;
    onTerminatorToken?: HookFn;
    onBadToken?: HookErrFn;
    onUnexpectedTerminator?: HookErrFn;
    onMissinChildren?: HookErrFn;
    onChildConstraintViolation?: NodeErrFn;
}
declare abstract class ExpressionError extends Error {
    abstract get pos(): number | null;
    abstract get len(): number | null;
}
export declare class CompileError extends ExpressionError {
    private data;
    constructor(message: string, data: any);
    get pos(): number | null;
    get len(): number | null;
}
export declare class ResolverError extends ExpressionError {
    private node?;
    constructor(message: string, node?: Node | undefined);
    get pos(): number | null;
    get len(): number | null;
}
export declare function assert(condition: any, msg: string, data?: any): asserts condition;
export {};
