SPeCS Packages Documentation
    Preparing search index...

    A formatter for converting a flow graph into a DOT string.

    ControlFlowNodes are visualized as contained inside their respective FunctionNode, unless an explicit parent is specified.

    The ControlFlowEndNode is visualized as a distinguished special symbol. The entry control-flow node is represented like a regular control-flow node, but with a double border. If a ControlFlowNode has more than one non-fake outgoing edge, it appears diamond-shaped to represent its conditional nature.

    A FunctionNode has its name as the label, while a ControlFlowNode has its id as the label. These labels may (and usually should) be overridden by a subclass or an instance.

    Colors help distinguish between different types of nodes and edges. fake edges appear with a dashed line.

    Type Parameters

    • G extends CoralGraph.Class = CoralGraph.Class

      The type of the graph. This parameter exists so that the formatter may be extended into a formatter that requires a more specific graph type.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    getContainer: (
        node: BaseNode.Class,
    ) => BaseNode.Class<BaseNode.Data, BaseNode.ScratchData> | undefined

    Given a node, returns the node that will contain it. By default that is the parent of the node, but subclasses may override this method to visualize other parent-like relationships.

    getEdgeAttrs: (edge: BaseEdge.Class) => Record<string, string>

    The attributes to add to each edge.

    getGraphAttrs: () => Record<string, string>

    The attributes to add to the graph.

    getNodeAttrs: (node: BaseNode.Class) => Record<string, string>

    The attributes to add to each node.

    cfgDefaultEdgeColor: string
    cfgEdgeTransparency: string
    cfgEndNodeSize: string
    cfgNodeColor: string
    cfgNodeDarkColor: string
    codeFontSize: string = "10"
    codeSmFontSize: string = "8"
    falseColor: string = "#d10202"
    functionColor: string
    functionDarkColor: string
    functionFontSize: string
    jumpScopeTransparency: string = "8f"
    keywordColor: string = "#4040e0"
    locationFontColor: string = "#c0c0c0"
    locationFontSize: string = "9"
    symbolColor: string = "#8080a0"
    trueColor: string = "#7bc706"

    Methods

    • Adds attributes to each edge. Only overrides the attributes that are explicitly set by the function, leaving the others unchanged.

      For completely overriding the previous attributes, just set getEdgeAttrs directly.

      Parameters

      • f: (edge: BaseEdge.Class) => Record<string, string>

        The function that adds attributes to each edge.

      Returns this

      The same formatter, for chaining.

    • Adds attributes to the graph. Only overrides the attributes that are explicitly set by the function, leaving the others unchanged.

      For completely overriding the previous attributes, just set getGraphAttrs directly.

      Parameters

      • f: () => Record<string, string>

        The function that adds attributes to the graph.

      Returns this

      The same formatter, for chaining.

    • Adds attributes to each node. Only overrides the attributes that are explicitly set by the function, leaving the others unchanged.

      For completely overriding the previous attributes, just set getNodeAttrs directly.

      Parameters

      • f: (node: BaseNode.Class) => Record<string, string>

        The function that adds attributes to each node.

      Returns this

      The same formatter, for chaining.

    • Converts a graph to a DOT string.

      Parameters

      • graph: G

        The graph to convert.

      Returns string

      The resulting DOT string.

    • Checks if a node is contained by another node. This is based on getContainer.

      Parameters

      Returns boolean

      Whether the node is contained by another node.

    • Converts a graph into a DOT graph.

      Parameters

      • graph: G

        The graph to convert.

      Returns DotGraph

      The resulting DOT graph.

    • The default attributes of a graph.

      Returns Record<string, string>

      The attributes of the graph.