@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
38 lines (37 loc) • 1.83 kB
TypeScript
import type { DummyAppendMemoryMap, StatisticAppendProvider } from './file-provider';
/**
* Requires source information to be attached on parsing!
* <p>
* Returns the content of the node (i.e., the text content excluding the children)
*/
export declare function extractNodeContent(node: Node): string;
/** by default, we do not write to anything */
export declare let statisticsFileProvider: StatisticAppendProvider;
/**
* Make the statistics write to a given output directory.
*/
export declare function initFileProvider(outputDirectory: string): void;
/**
* Either ignore the statistics or write them to a given map (e.g., for testing).
*
* @param map - The map to write to, will not persist calls if no map is given
*/
export declare function initDummyFileProvider(map?: DummyAppendMemoryMap): void;
/**
* Format used to dump each entry of a feature during collection.
*/
export type StatisticsOutputFormat<T = string> = [
/** the collected value (like the assignment operator lexeme, ...) */
value: T,
/** the context of the information retrieval (e.g. the name of the file that contained the R source code) */
context: string | undefined
];
/**
* Append the content of all nodes to the storage file for the given feature
* @param name - The name of the feature {@link Feature#name}
* @param fn - The name of the feature-aspect to record
* @param nodes - The nodes to append, you may pass already transformed string contents
* @param context - The context of the information retrieval (e.g. the name of the file that contained the R source code)
* @param unique - Should duplicate entries be removed on addition
*/
export declare function appendStatisticsFile<T>(name: string, fn: keyof T, nodes: string[] | Node[] | object[], context: string | undefined, unique?: boolean): void;