Class DotFormatter


  • public final class DotFormatter
    extends java.lang.Object

    DotFormatter prints out a dot file of the Abstract Syntax Tree. For a detailed description of the dot format and visualization tool refer to Graphviz.

    Typical usage of this class

    System.out.println(new DotFormatter().toDot(node));

    This class is not thread safe and should not be used without proper external synchronization.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String toDot​(GraphvizGraph graph)
      Outputs a string in DOT format that presents the graph.
      static java.lang.String toDot​(Node n)
      Converts an AST to dot representation.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toDot

        public static java.lang.String toDot​(Node n)
                                      throws java.io.IOException
        Converts an AST to dot representation.
        Parameters:
        n - the root of the AST described in the dot formatted string
        Returns:
        the dot representation of the AST
        Throws:
        java.io.IOException
      • toDot

        public static java.lang.String toDot​(GraphvizGraph graph)
        Outputs a string in DOT format that presents the graph.
        Parameters:
        graph - Input graph.
        Returns:
        A string in Dot format that presents the graph.