UNPKG

@eagleoutice/flowr-dev

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

86 lines (85 loc) 3.72 kB
import type { MergeableRecord } from './util/objects'; import Joi from 'joi'; import type { BuiltInDefinitions } from './dataflow/environments/built-in-config'; import type { KnownParser } from './r-bridge/parser'; export declare enum VariableResolve { /** Don't resolve constants at all */ Disabled = "disabled", /** Use alias tracking to resolve */ Alias = "alias", /** Only resolve directly assigned builtin constants */ Builtin = "builtin" } export interface FlowrConfigOptions extends MergeableRecord { /** * Whether source calls should be ignored, causing {@link processSourceCall}'s behavior to be skipped */ readonly ignoreSourceCalls: boolean; /** Configure language semantics and how flowR handles them */ readonly semantics: { /** Semantics regarding the handlings of the environment */ readonly environment: { /** Do you want to overwrite (parts) of the builtin definition? */ readonly overwriteBuiltIns: { /** Should the default configuration still be loaded? */ readonly loadDefaults?: boolean; /** The definitions to load */ readonly definitions: BuiltInDefinitions; }; }; }; /** * The engines to use for interacting with R code. Currently supports {@link TreeSitterEngineConfig} and {@link RShellEngineConfig}. * An empty array means all available engines will be used. */ readonly engines: readonly EngineConfig[]; /** * The default engine to use for interacting with R code. If this is undefined, an arbitrary engine from {@link engines} will be used. */ readonly defaultEngine?: EngineConfig['type']; /** How to resolve constants, constraints, cells, ... */ readonly solver: { /** * How to resolve variables and their values */ readonly variables: VariableResolve; /** * Whether to track pointers in the dataflow graph, * if not, the graph will be over-approximated wrt. * containers and accesses */ readonly pointerTracking: boolean; }; } export interface TreeSitterEngineConfig extends MergeableRecord { readonly type: 'tree-sitter'; /** * The path to the tree-sitter-r WASM binary to use. If this is undefined, {@link DEFAULT_TREE_SITTER_R_WASM_PATH} will be used. */ readonly wasmPath?: string; /** * The path to the tree-sitter WASM binary to use. If this is undefined, the path specified by the tree-sitter package will be used. */ readonly treeSitterWasmPath?: string; } export interface RShellEngineConfig extends MergeableRecord { readonly type: 'r-shell'; /** * The path to the R executable to use. If this is undefined, {@link DEFAULT_R_PATH} will be used. */ readonly rPath?: string; } export type EngineConfig = TreeSitterEngineConfig | RShellEngineConfig; export type KnownEngines = { [T in EngineConfig['type']]?: KnownParser; }; export declare const defaultConfigOptions: FlowrConfigOptions; export declare const flowrConfigFileSchema: Joi.ObjectSchema<any>; export declare function setConfigFile(file: string | undefined, workingDirectory?: string, forceLoad?: boolean): void; export declare function parseConfig(jsonString: string): FlowrConfigOptions | undefined; export declare function setConfig(config: FlowrConfigOptions): void; export declare function amendConfig(amendment: Partial<FlowrConfigOptions>): void; export declare function getConfig(): FlowrConfigOptions; export declare function getEngineConfig<T extends EngineConfig['type']>(engine: T): EngineConfig & { type: T; } | undefined;