Class DefaultASTPrinter

  • All Implemented Interfaces:
    ASTPrinter

    public class DefaultASTPrinter
    extends java.lang.Object
    implements ASTPrinter
    A language-agnostic for printing out various pieces of a Truffle AST.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.lang.String instrumentInfo​(InstrumentationNode node)  
      protected static java.lang.String nodeName​(Node node)  
      protected void printChild​(java.io.PrintWriter p, int maxDepth, Node markNode, int level, NodeUtil.NodeField field, java.lang.Object value)  
      protected void printChildren​(java.io.PrintWriter p, int maxDepth, Node markNode, int level, NodeUtil.NodeField field, java.lang.Object value)  
      protected static void printNewLine​(java.io.PrintWriter p, int level)  
      protected static void printNewLine​(java.io.PrintWriter p, int level, boolean mark)  
      void printTree​(java.io.PrintWriter p, Node node, int maxDepth, Node markNode)
      Prints a textual AST display, one line per node, with nesting.
      protected void printTree​(java.io.PrintWriter p, Node node, int maxDepth, Node markNode, int level)  
      java.lang.String printTreeToString​(Node node, int maxDepth)
      Creates a textual AST display, one line per node, with nesting.
      java.lang.String printTreeToString​(Node node, int maxDepth, Node markNode)
      Creates a textual AST display, one line per node, with nesting.
      protected static java.lang.String sourceInfo​(Node node)  
      • Methods inherited from class java.lang.Object

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

      • DefaultASTPrinter

        public DefaultASTPrinter()
    • Method Detail

      • printTree

        public void printTree​(java.io.PrintWriter p,
                              Node node,
                              int maxDepth,
                              Node markNode)
        Description copied from interface: ASTPrinter
        Prints a textual AST display, one line per node, with nesting.
        Specified by:
        printTree in interface ASTPrinter
        node - the root node of the display.
        maxDepth - the maximum number of levels to print below the root
        markNode - a node to mark with a textual arrow prefix, if present.
      • printTreeToString

        public java.lang.String printTreeToString​(Node node,
                                                  int maxDepth,
                                                  Node markNode)
        Description copied from interface: ASTPrinter
        Creates a textual AST display, one line per node, with nesting.
        Specified by:
        printTreeToString in interface ASTPrinter
        Parameters:
        node - the root node of the display.
        maxDepth - the maximum number of levels to print below the root
        markNode - a node to mark with a textual arrow prefix, if present.
      • printTreeToString

        public java.lang.String printTreeToString​(Node node,
                                                  int maxDepth)
        Description copied from interface: ASTPrinter
        Creates a textual AST display, one line per node, with nesting.
        Specified by:
        printTreeToString in interface ASTPrinter
        Parameters:
        node - the root node of the display.
        maxDepth - the maximum number of levels to print below the root
      • printTree

        protected void printTree​(java.io.PrintWriter p,
                                 Node node,
                                 int maxDepth,
                                 Node markNode,
                                 int level)
      • printChildren

        protected void printChildren​(java.io.PrintWriter p,
                                     int maxDepth,
                                     Node markNode,
                                     int level,
                                     NodeUtil.NodeField field,
                                     java.lang.Object value)
      • printChild

        protected void printChild​(java.io.PrintWriter p,
                                  int maxDepth,
                                  Node markNode,
                                  int level,
                                  NodeUtil.NodeField field,
                                  java.lang.Object value)
      • printNewLine

        protected static void printNewLine​(java.io.PrintWriter p,
                                           int level,
                                           boolean mark)
      • printNewLine

        protected static void printNewLine​(java.io.PrintWriter p,
                                           int level)
      • nodeName

        protected static java.lang.String nodeName​(Node node)
      • sourceInfo

        protected static java.lang.String sourceInfo​(Node node)
      • instrumentInfo

        protected static java.lang.String instrumentInfo​(InstrumentationNode node)