@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
42 lines (41 loc) • 1.82 kB
TypeScript
import type { DataflowProcessorInformation } from '../../../../../processor';
import type { DataflowInformation } from '../../../../../info';
import type { PotentiallyEmptyRArgument } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
import type { ParentInformation } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { RSymbol } from '../../../../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
import type { NodeId } from '../../../../../../r-bridge/lang-4.x/ast/model/processing/node-id';
interface BuiltInPurrrFormulaConfiguration {
/**
* Maps the created variable/variable to bind in the formula, to the argument that produces it.
* For example:
* ```ts
* {
* '.x': { index: 0, name: '.x' },
* '.y': { index: 1, name: '.y' }
* }
* ```
*/
args: Record<string, {
index: number;
name: string;
}>;
/**
* This represents the special argument that represents the formula.
* We map all additional arguments that are not in `ignore` to this list.
*/
'.f': {
index: number;
name: string;
};
/** arguments to additionally ignore when mapping the formulae */
ignore?: string[];
/**
* if given, this is a name that indexes into the 'args' map and indicates whatever this function is to return
*/
returnArg?: string;
}
/**
* Support for R's purr formula: `map(df, ~ .x + 1)`.
*/
export declare function processPurrrFormula<OtherInfo>(name: RSymbol<OtherInfo & ParentInformation>, args: readonly PotentiallyEmptyRArgument<OtherInfo & ParentInformation>[], rootId: NodeId, data: DataflowProcessorInformation<OtherInfo & ParentInformation>, config: BuiltInPurrrFormulaConfiguration): DataflowInformation;
export {};