@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
38 lines (37 loc) • 1.93 kB
TypeScript
/**
* Sometimes we want to know all possible slicing criteria (obeying some filter).
* This module provides a function to collect all slicing criteria.
* @module
*/
import type { MergeableRecord } from '../../util/objects';
import type { SlicingCriteria } from './parse';
import type { RNodeWithParent } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
import type { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id';
/**
* Defines the filter for collecting all possible slicing criteria.
* @see DefaultAllVariablesFilter
*/
export interface SlicingCriteriaFilter extends MergeableRecord {
/**
* Inclusive minimum size of the slicing criteria (number of included slice points).
* Should be at least `1` to make sense (and of course at most {@link SlicingCriteriaFilter#maximumSize|maximum size}).
*/
minimumSize: number;
/**
* Inclusive maximum size of the slicing criteria (number of included slice points).
* Should be at least `1` to make sense (and of course at least {@link SlicingCriteriaFilter#minimumSize|minimum size}).
* <p>
* Be really careful with this one, as the number of possible slicing criteria can grow exponentially with the maximum size.
*/
maximumSize: number;
/**
* Function that determines the ids of all nodes that can be used as slicing criteria.
*/
collectAll: (root: RNodeWithParent) => NodeId[];
}
/**
* Will create all possible slicing criteria for the given ast, based on the {@link SlicingCriteriaFilter}.
* The slicing criteria will be *ordered* (i.e., it will not return `[1:2,3:4]` and `[3:4,1:2]` if `maximumSize` \> 1).
* If there are not enough matching nodes within the ast, this will return *no* slicing criteria!
*/
export declare function collectAllSlicingCriteria<OtherInfo>(ast: RNodeWithParent<OtherInfo>, filter: Readonly<SlicingCriteriaFilter>): Generator<SlicingCriteria, void, void>;