UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

70 lines (69 loc) 5.37 kB
import type { FlowrSearchElement, FlowrSearchElements, FlowrSearchInput, FlowrSearchTransformerNodeBase } from '../flowr-search'; import type { Pipeline } from '../../core/steps/pipeline/pipeline'; import type { LastOfArray, Tail2TypesOrUndefined, TailOfArray } from '../../util/collections/arrays'; import type { FlowrFilterExpression } from '../flowr-search-filters'; import type { FlowrSearchGeneratorNode } from './search-generators'; import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate'; import type { EnrichedFlowrSearchElement, Enrichment, EnrichmentArguments } from './search-enrichers'; import type { Mapper, MapperArguments } from './search-mappers'; /** * This is a union of all possible transformer node types */ export type FlowrSearchTransformerNode = { [K in TransformerNames]: FlowrSearchTransformerNodeBase<K, Tail2TypesOrUndefined<Parameters<typeof transformers[K]>>>; }[TransformerNames]; export type TransformerNames = keyof typeof transformers; export type GetTransformer<Name extends TransformerNames> = FlowrSearchTransformerNode & { name: Name; }; export type GetOutputOfTransformer<Name extends TransformerNames> = ReturnType<typeof transformers[Name]>; /** * All supported generators! */ export declare const transformers: { readonly first: typeof getFirst; readonly last: typeof getLast; readonly index: typeof getIndex; readonly tail: typeof getTail; readonly take: typeof getTake; readonly skip: typeof getSkip; readonly filter: typeof getFilter; readonly merge: typeof getMerge; readonly select: typeof getSelect; readonly with: typeof getWith; readonly map: typeof getMap; }; export declare function getTransformer<Name extends TransformerNames>(name: Name): typeof transformers[Name]; /** If we already have no more elements, cascade will not add any but keep the empty elements, otherwise it will now be NewElements */ type CascadeEmpty<Elements extends FlowrSearchElement<ParentInformation>[], NewElements extends FlowrSearchElement<ParentInformation>[]> = Elements extends [] ? FlowrSearchElements<ParentInformation, []> : FlowrSearchElements<ParentInformation, NewElements>; declare function getFirst<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE): CascadeEmpty<Elements, [Elements[0]]>; declare function getLast<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE): CascadeEmpty<Elements, [LastOfArray<Elements>]>; declare function getIndex<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { index }: { index: number; }): CascadeEmpty<Elements, [Elements[number]]>; declare function getSelect<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { select }: { select: number[]; }): CascadeEmpty<Elements, Elements>; declare function getTail<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE): CascadeEmpty<Elements, TailOfArray<Elements>>; declare function getTake<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { count }: { count: number; }): CascadeEmpty<Elements, TailOfArray<Elements>>; declare function getSkip<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { count }: { count: number; }): CascadeEmpty<Elements, TailOfArray<Elements>>; declare function getFilter<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { filter }: { filter: FlowrFilterExpression; }): CascadeEmpty<Elements, Elements | []>; declare function getWith<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { info, args }: { info: Enrichment; args?: EnrichmentArguments<Enrichment>; }): FlowrSearchElements<ParentInformation, EnrichedFlowrSearchElement<ParentInformation>[]>; declare function getMap<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, { mapper, args }: { mapper: Mapper; args: MapperArguments<Mapper>; }): FlowrSearchElements<ParentInformation, Elements>; declare function getMerge<Elements extends FlowrSearchElement<ParentInformation>[], FSE extends FlowrSearchElements<ParentInformation, Elements>>(data: FlowrSearchInput<Pipeline>, elements: FSE, other: { search: unknown[]; generator: FlowrSearchGeneratorNode; }): FlowrSearchElements<ParentInformation, FlowrSearchElement<ParentInformation>[]>; export {};