@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
47 lines (46 loc) • 1.89 kB
TypeScript
import { type RShellExecutionOptions } from './shell';
import type { SemVer } from 'semver';
import type { BaseRShellInformation, SyncParser } from './parser';
import { type RParseRequest } from './retriever';
/**
* This is a synchronous alternative to the {@link RShell}.
* Please be aware that using this is expensive.
* Every request effectively causes a new initialization of the R interpreter.
*
* With this class you can {@link RShellExecutor#run|run(command)} commands,
* that are potentially decorated with {@link RShellExecutor#addPrerequisites|prerequisites}.
* For compatibility,
* we provide {@link RShellExecutor#parse|parse(request)} and {@link RShellExecutor#rVersion|rVersion()}.
*/
export declare class RShellExecutor implements SyncParser<string> {
readonly name = "r-shell";
readonly options: Readonly<RShellExecutionOptions>;
private readonly prerequisites;
constructor(options?: Partial<RShellExecutionOptions>);
/**
* Adds commands that should be executed for every {@link RShellExecutor#run|run}.
*/
addPrerequisites(commands: string | string[]): this;
/**
* @returns the version of the R interpreter available to this executor.
* @see {@link RShellExecutor#usedRVersion}
* @see {@link RShell#rVersion}
* @see {@link RShell#usedRVersion}
*/
rVersion(): Promise<string | 'unknown' | 'none'>;
information(): BaseRShellInformation;
/**
* Instead of returning a promise, this method returns the version of the R interpreter available to this executor,
* in the SemVer format.
*/
usedRVersion(): SemVer | null;
/**
* Runs the given command in the R interpreter.
*/
run(command: string, returnErr?: boolean): string;
/**
* Parses the given request and returns the result.
*/
parse(request: RParseRequest): string;
close(): void;
}