UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

84 lines (83 loc) 3.77 kB
import { type DataflowGraph } from '../../dataflow/graph/graph'; import { NodeId } from '../../r-bridge/lang-4.x/ast/model/processing/node-id'; import { type IdentifierDefinition } from '../../dataflow/environments/identifier'; import { type DataflowGraphVertexInfo } from '../../dataflow/graph/vertex'; import { type MermaidMarkdownMark, type MermaidMarkStyle } from './info'; import { DataflowInformation } from '../../dataflow/info'; /** * Internal representation of a mermaid graph in flowR */ export interface MermaidGraph { nodeLines: string[]; edgeLines: string[]; includeEnvironments: boolean; mark: ReadonlySet<MermaidMarkdownMark> | undefined; markStyle: MermaidMarkStyle; /** in the form of from-\>to because I am lazy, see {@link encodeEdge} */ presentEdges: Set<string>; presentVertices: Set<string>; rootGraph: DataflowGraph; /** if given, the dataflow graph will only focus on the "important" parts */ simplified?: boolean; } /** * Translates a vertex tag to the corresponding mermaid node brackets. */ export declare function mermaidNodeBrackets(tag: DataflowGraphVertexInfo['tag']): { open: string; close: string; }; /** * Prints an identifier definition in a human-readable format. */ export declare function printIdentifier(id: IdentifierDefinition): string; export interface MermaidGraphConfiguration { graph: DataflowGraph; prefix?: string | null; idPrefix?: string; includeEnvironments?: boolean; mark?: ReadonlySet<MermaidMarkdownMark>; markStyle?: MermaidMarkStyle; rootGraph?: DataflowGraph; presentEdges?: Set<string>; simplified?: boolean; includeOnlyIds?: ReadonlySet<NodeId>; } export interface LabeledDiffGraph { label: string; graph: DataflowGraph; mark?: Set<MermaidMarkdownMark>; } /** uses same id map but ensures, it is different from the rhs so that mermaid can work with that */ export declare function diffGraphsToMermaid(left: LabeledDiffGraph, right: LabeledDiffGraph, prefix: string): string; /** * Converts two dataflow graphs to a mermaid url that visualizes their differences. */ export declare function diffGraphsToMermaidUrl(left: LabeledDiffGraph, right: LabeledDiffGraph, prefix: string): string; /** * The helper object for all things regarding the mermaid based visualization of dataflow graphs! */ export declare const DataflowMermaid: { readonly name: "DataflowMermaid"; /** * Converts a dataflow graph to mermaid graph code that visualizes the graph. * @see {@link DataflowMermaid.url} - render the given graph to a url to mermaid.live */ readonly convert: (this: void, config: MermaidGraphConfiguration) => { string: string; mermaid: MermaidGraph; }; /** * This is a simplified version of {@link DataflowMermaid.convertToMermaid} */ readonly raw: (this: void, graph: DataflowGraph | DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string; /** * Converts a dataflow graph to a mermaid url that visualizes the graph. * This is basically a combination of {@link DataflowMermaid.mermaidRaw} and {@link Mermaid.codeToUrl}. * @param graph - the dataflow graph to render * @param includeEnvironments - whether to include the environment content in the output * @param mark - which vertices to highlight in the visualization * @param simplified - whether to show a simplified use of the graph with fewer details on the vertices and edges */ readonly url: (this: void, graph: DataflowGraph | DataflowInformation, includeEnvironments?: boolean, mark?: ReadonlySet<NodeId>, simplified?: boolean) => string; };