@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
32 lines (31 loc) • 1.88 kB
TypeScript
import Parser from 'web-tree-sitter';
import type { Query, QueryCapture } from 'web-tree-sitter';
import type { RParseRequest } from '../../retriever';
import type { SyncParser, TreeSitterInformation } from '../../parser';
import type { TreeSitterEngineConfig } from '../../../config';
import type { ReadonlyFlowrAnalysisProvider } from '../../../project/flowr-analyzer';
export declare const DEFAULT_TREE_SITTER_R_WASM_PATH = "./node_modules/@eagleoutice/tree-sitter-r/tree-sitter-r.wasm";
export declare const DEFAULT_TREE_SITTER_WASM_PATH = "./node_modules/web-tree-sitter/tree-sitter.wasm";
/**
* Synchronous and (way) faster alternative to the {@link RShell} using tree-sitter.
*/
export declare class TreeSitterExecutor implements SyncParser<Parser.Tree> {
readonly name = "tree-sitter";
private readonly parser;
private static language;
/**
* Initializes the underlying tree-sitter parser. This only needs to be called once globally.
* @param config - The configuration for the tree-sitter engine, which can include paths to the wasm files.
* @param overrideWasmPath - The path to the tree-sitter-r wasm file, which takes precedence over the config and default paths if set.
* @param overrideTreeSitterWasmPath - The path to the tree-sitter wasm file, which takes precedence over the config and default paths if set.
*/
static initTreeSitter(config?: TreeSitterEngineConfig, overrideWasmPath?: string, overrideTreeSitterWasmPath?: string): Promise<void>;
constructor();
rVersion(): Promise<string | 'unknown' | 'none'>;
information(analyzer: ReadonlyFlowrAnalysisProvider): TreeSitterInformation;
treeSitterVersion(): number;
parse(request: RParseRequest): Parser.Tree;
createQuery(source: string): Query;
query(source: Query | string, ...tree: Parser.Tree[]): QueryCapture[];
close(): void;
}