@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
38 lines (37 loc) • 2.07 kB
TypeScript
import { type CfgBasicBlockVertex, type CfgMarkerVertex, type CfgExpressionVertex, CfgVertex, type CfgStatementVertex, type ControlFlowInformation } from './control-flow-graph';
import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
export interface BasicCfgGuidedVisitorConfiguration<ControlFlow extends ControlFlowInformation = ControlFlowInformation> {
readonly controlFlow: ControlFlow;
readonly defaultVisitingOrder: 'forward' | 'backward';
}
/**
* In contrast to {@link visitCfgInOrder} and {@link visitCfgInReverseOrder}, this visitor is not a simple visitor
* and serves as the basis for a variety of more complicated visiting orders of the control flow graph.
* It includes features to provide additional information using the {@link NormalizedAst} and the {@link DataflowGraph}.
*
* Use {@link BasicCfgGuidedVisitor#start} to start the traversal.
*/
export declare class BasicCfgGuidedVisitor<ControlFlow extends ControlFlowInformation = ControlFlowInformation, Config extends BasicCfgGuidedVisitorConfiguration<ControlFlow> = BasicCfgGuidedVisitorConfiguration<ControlFlow>> {
protected readonly config: Config;
protected readonly visited: Map<NodeId, number>;
constructor(config: Config);
/**
* call this function to indicate that a node is to be considered visited.
* @returns `true` if the node was not visited before, `false` otherwise
*/
protected visitNode(node: NodeId): boolean;
protected startVisitor(start: readonly NodeId[]): void;
/**
* Start the visiting process.
*/
start(): void;
/**
* Get the control flow vertex for the given node id or fail if it does not exist.
*/
protected getCfgVertex(id: NodeId): CfgVertex | undefined;
protected onVisitNode(node: NodeId): void;
protected onBasicBlockNode(node: CfgBasicBlockVertex): void;
protected onStatementNode(_node: CfgStatementVertex): void;
protected onExpressionNode(_node: CfgExpressionVertex): void;
protected onEndMarkerNode(_node: CfgMarkerVertex): void;
}