Class DefaultASTPrinter

java.lang.Object
com.oracle.truffle.api.instrument.impl.DefaultASTPrinter
All Implemented Interfaces:
ASTPrinter

public class DefaultASTPrinter extends Object implements ASTPrinter
A language-agnostic for printing out various pieces of a Truffle AST.
  • Constructor Details

    • DefaultASTPrinter

      public DefaultASTPrinter()
  • Method Details

    • printTree

      public void printTree(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 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 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(PrintWriter p, Node node, int maxDepth, Node markNode, int level)
    • printChildren

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

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

      protected static void printNewLine(PrintWriter p, int level, boolean mark)
    • printNewLine

      protected static void printNewLine(PrintWriter p, int level)
    • nodeName

      protected static String nodeName(Node node)
    • sourceInfo

      protected static String sourceInfo(Node node)
    • instrumentInfo

      protected static String instrumentInfo(InstrumentationNode node)