@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
85 lines (84 loc) • 6.11 kB
TypeScript
import type { BaseQueryFormat, BaseQueryResult } from '../../base-query-format';
import type { PipelineOutput } from '../../../core/steps/pipeline/pipeline';
import type { DEFAULT_DATAFLOW_PIPELINE, DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE, DEFAULT_SLICING_PIPELINE } from '../../../core/steps/pipeline/default-pipelines';
import type { SlicingCriteria } from '../../../slicing/criterion/parse';
import Joi from 'joi';
import { executeStaticSliceQuery } from './static-slice-query-executor';
/** Calculates and returns all clusters encountered in the dataflow graph. */
export interface StaticSliceQuery extends BaseQueryFormat {
readonly type: 'static-slice';
/** The slicing criteria to use */
readonly criteria: SlicingCriteria;
/** do not reconstruct the slice into readable code */
readonly noReconstruction?: boolean;
/** Should the magic comments (force-including lines within the slice) be ignored? */
readonly noMagicComments?: boolean;
}
export interface StaticSliceQueryResult extends BaseQueryResult {
/**
* only contains the results of the slice steps to not repeat ourselves, this does not contain the reconstruction
* if you set the {@link SliceQuery#noReconstruction|noReconstruction} flag.
*
* The keys are serialized versions of the used queries (i.e., the result of `JSON.stringify`).
* This implies that multiple slice queries with the same query configuration will _not_ be re-executed.
*/
results: Record<string, Omit<PipelineOutput<typeof DEFAULT_SLICING_PIPELINE>, keyof PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>> | Omit<PipelineOutput<typeof DEFAULT_SLICE_WITHOUT_RECONSTRUCT_PIPELINE>, keyof PipelineOutput<typeof DEFAULT_DATAFLOW_PIPELINE>>>;
}
export declare const StaticSliceQueryDefinition: {
readonly executor: typeof executeStaticSliceQuery;
readonly asciiSummarizer: (formatter: import("../../../util/ansi").OutputFormatter, _processed: PipelineOutput<import("../../../core/steps/pipeline/pipeline").Pipeline<{
readonly name: "parse";
readonly humanReadableName: "parse with R shell";
readonly description: "Parse the given R code into an AST";
readonly processor: (_results: unknown, input: Partial<import("../../../r-bridge/parser").ParseRequiredInput<string>>) => Promise<import("../../../r-bridge/parser").ParseStepOutput<string>>;
readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
readonly printer: {
readonly 0: typeof import("../../../core/print/print").internalPrinter;
readonly 2: {
(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;
(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
};
readonly 5: ({ parsed }: import("../../../r-bridge/parser").ParseStepOutput<string>, config: import("../../../util/quads").QuadSerializationConfiguration) => string;
};
readonly dependencies: readonly [];
readonly requiredInput: import("../../../r-bridge/parser").ParseRequiredInput<string>;
} | {
readonly name: "normalize";
readonly humanReadableName: "normalize";
readonly description: "Normalize the AST to flowR's AST";
readonly processor: (results: {
parse?: import("../../../r-bridge/parser").ParseStepOutput<string>;
}, input: Partial<import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput>) => import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../../../r-bridge/lang-4.x/ast/model/model").RNode<import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>>;
readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
readonly printer: {
readonly 0: typeof import("../../../core/print/print").internalPrinter;
readonly 2: typeof import("../../../core/print/normalize-printer").normalizedAstToJson;
readonly 5: typeof import("../../../core/print/normalize-printer").normalizedAstToQuads;
readonly 3: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaid;
readonly 4: typeof import("../../../core/print/normalize-printer").printNormalizedAstToMermaidUrl;
};
readonly dependencies: readonly ["parse"];
readonly requiredInput: import("../../../core/steps/all/core/10-normalize").NormalizeRequiredInput;
} | {
readonly humanReadableName: "dataflow";
readonly processor: (results: {
normalize?: import("../../../r-bridge/lang-4.x/ast/model/processing/decorate").NormalizedAst;
}, input: {
request?: import("../../../r-bridge/retriever").RParseRequests;
parser?: import("../../../r-bridge/parser").Parser<import("../../../r-bridge/parser").KnownParserType>;
}) => import("../../../dataflow/info").DataflowInformation;
readonly requiredInput: {};
readonly name: "dataflow";
readonly description: "Construct the dataflow graph";
readonly executed: import("../../../core/steps/pipeline-step").PipelineStepStage.OncePerFile;
readonly printer: {
readonly 0: typeof import("../../../core/print/print").internalPrinter;
readonly 2: typeof import("../../../core/print/dataflow-printer").dataflowGraphToJson;
readonly 5: typeof import("../../../core/print/dataflow-printer").dataflowGraphToQuads;
readonly 3: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaid;
readonly 4: typeof import("../../../core/print/dataflow-printer").dataflowGraphToMermaidUrl;
};
readonly dependencies: readonly ["normalize"];
}>>, queryResults: BaseQueryResult, result: string[]) => true;
readonly schema: Joi.ObjectSchema<any>;
};