UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

51 lines (50 loc) 2.36 kB
import type { RShell } from '../../r-bridge/shell'; import type { Queries, SupportedQueryTypes } from '../../queries/query'; import type { SupportedVirtualQueryTypes } from '../../queries/virtual-query/virtual-queries'; import type { VirtualCompoundConstraint } from '../../queries/virtual-query/compound-query'; import type { SlicingCriteria } from '../../slicing/criterion/parse'; import type { GeneralDocContext } from '../wiki-mk/doc-context'; import type { KnownParser } from '../../r-bridge/parser'; export interface ShowQueryOptions { readonly showCode?: boolean; readonly collapseResult?: boolean; readonly collapseQuery?: boolean; readonly shorthand?: string; } /** * Visualizes a query and its results in markdown format. */ export declare function showQuery<Base extends SupportedQueryTypes, VirtualArguments extends VirtualCompoundConstraint<Base> = VirtualCompoundConstraint<Base>>(parser: KnownParser, code: string, queries: Queries<Base, VirtualArguments>, { showCode, collapseResult, collapseQuery, shorthand }?: ShowQueryOptions): Promise<string>; export interface QueryDocumentation { readonly name: string; readonly type: 'virtual' | 'active'; readonly shortDescription: string; readonly functionName: string; /** Path to the file implementing the query function, the wiki generation will fail if this isn't found */ readonly functionFile: string; readonly buildExplanation: (shell: RShell, ctx: GeneralDocContext) => Promise<string>; } export declare const RegisteredQueries: { active: Map<string, QueryDocumentation>; virtual: Map<string, QueryDocumentation>; }; /** * Registers a new documentation for a query. */ export declare function registerQueryDocumentation(query: SupportedQueryTypes | SupportedVirtualQueryTypes, doc: QueryDocumentation): void; /** * Creates a REPL shorthand for the given slicing criteria and R code. */ export declare function sliceQueryShorthand(criteria: SlicingCriteria, code: string, forward?: boolean): string; /** * */ export declare function linkToQueryOfName(id: SupportedQueryTypes | SupportedVirtualQueryTypes): string; /** * */ export declare function tocForQueryType(type: 'active' | 'virtual'): string; /** * */ export declare function explainQueries(shell: RShell, ctx: GeneralDocContext, type: 'active' | 'virtual'): Promise<string>;