import { RType } from '../r-bridge/lang-4.x/ast/model/type';
import type { VertexType } from '../dataflow/graph/vertex';
import type { NormalizedAst, ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { DataflowInformation } from '../dataflow/info';
import type { FlowrSearchElement } from './flowr-search';
import type { MergeableRecord } from '../util/objects';
import type { Enrichment } from './search-executor/search-enrichers';
export type FlowrFilterName = keyof typeof FlowrFilters;
interface FlowrFilterWithArgs<Filter extends FlowrFilterName, Args extends FlowrFilterArgs<Filter>> {
    name: Filter;
    args: Args;
}
export declare enum FlowrFilter {
    /**
     * Drops search elements that represent empty arguments. Specifically, all nodes that are arguments and have an undefined name are skipped.
     * This filter does not accept any arguments.
     */
    DropEmptyArguments = "drop-empty-arguments",
    /**
     * Only returns search elements whose enrichments' JSON representations match a given test regular expression.
     * This filter accepts {@link MatchesEnrichmentArgs}, which includes the enrichment to match for, as well as the regular expression to test the enrichment's (non-pretty-printed) JSON representation for.
     * To test for included function names in an enrichment like {@link Enrichment.CallTargets}, the helper function {@link testFunctionsIgnoringPackage} can be used.
     */
    MatchesEnrichment = "matches-enrichment"
}
export type FlowrFilterFunction<T extends MergeableRecord> = (e: FlowrSearchElement<ParentInformation>, args: T) => boolean;
export declare const ValidFlowrFilters: Set<string>;
export declare const ValidFlowrFiltersReverse: {
    [k: string]: string;
};
export declare const FlowrFilters: {
    readonly "drop-empty-arguments": (e: FlowrSearchElement<ParentInformation>, _args: never) => boolean;
    readonly "matches-enrichment": (e: FlowrSearchElement<ParentInformation>, args: MatchesEnrichmentArgs<Enrichment>) => boolean;
};
export type FlowrFilterArgs<F extends FlowrFilter> = typeof FlowrFilters[F] extends FlowrFilterFunction<infer Args> ? Args : never;
export interface MatchesEnrichmentArgs<E extends Enrichment> extends MergeableRecord {
    enrichment: E;
    test: RegExp;
}
export declare function testFunctionsIgnoringPackage(functions: string[]): RegExp;
type ValidFilterTypes<F extends FlowrFilter = FlowrFilter> = FlowrFilterName | FlowrFilterWithArgs<F, FlowrFilterArgs<F>> | RType | VertexType;
/**
 * By default, we provide filter for every {@link RType} and {@link VertexType}.
 */
export type FlowrFilterExpression<F extends FlowrFilter = FlowrFilter> = FlowrFilterCombinator | ValidFilterTypes<F>;
interface BooleanBinaryNode<Composite> {
    readonly type: 'and' | 'or' | 'xor';
    readonly left: Composite;
    readonly right: Composite;
}
interface BooleanUnaryNode<Composite> {
    readonly type: 'not';
    readonly operand: Composite;
}
type LeafRType = {
    readonly type: 'r-type';
    readonly value: RType;
};
type LeafVertexType = {
    readonly type: 'vertex-type';
    readonly value: VertexType;
};
type LeafSpecial = {
    readonly type: 'special';
    readonly value: FlowrFilterName | FlowrFilterWithArgs<FlowrFilter, FlowrFilterArgs<FlowrFilter>>;
};
type Leaf = LeafRType | LeafVertexType | LeafSpecial;
type BooleanNode = BooleanBinaryNode<BooleanNode> | BooleanUnaryNode<BooleanNode> | Leaf;
type BooleanNodeOrCombinator = BooleanNode | FlowrFilterCombinator;
/**
 * @see {@link FlowrFilterCombinator.is}
 * @see {@link evalFilter}
 * @see {@link binaryTreeToString}
 */
export declare class FlowrFilterCombinator {
    private tree;
    protected constructor(init: BooleanNodeOrCombinator);
    static is(value: BooleanNodeOrCombinator | ValidFilterTypes): FlowrFilterCombinator;
    and(right: BooleanNodeOrCombinator | ValidFilterTypes): this;
    or(right: BooleanNodeOrCombinator | ValidFilterTypes): this;
    xor(right: BooleanNodeOrCombinator | ValidFilterTypes): this;
    private binaryRight;
    not(): this;
    private unary;
    private unpack;
    get(): BooleanNode;
}
export declare function binaryTreeToString(tree: BooleanNode): string;
export declare function isBinaryTree(tree: unknown): tree is {
    tree: BooleanNode;
};
interface FilterData {
    readonly element: FlowrSearchElement<ParentInformation>;
    readonly normalize: NormalizedAst;
    readonly dataflow: DataflowInformation;
}
export declare function evalFilter<Filter extends FlowrFilter>(filter: FlowrFilterExpression<Filter>, data: FilterData): boolean;
export {};
