UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

27 lines (26 loc) 1.51 kB
import Parser from 'web-tree-sitter'; import type { RParseRequest } from '../../retriever'; import type { SyncParser } from '../../parser'; import type { TreeSitterEngineConfig } from '../../../config'; 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"; readonly parser: 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'>; treeSitterVersion(): number; parse(request: RParseRequest): Parser.Tree; close(): void; }