Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hibernate.hql.ast
Class ASTPrinter  view ASTPrinter download ASTPrinter.java

java.lang.Object
  extended byorg.hibernate.hql.ast.ASTPrinter

public class ASTPrinter
extends java.lang.Object

An 'ASCII art' AST printer for debugging ANTLR grammars.


Field Summary
private  boolean showClassNames
           
private  java.lang.Class tokenTypeConstants
           
private  java.util.Map tokenTypeNamesByTokenType
           
 
Constructor Summary
ASTPrinter(java.lang.Class tokenTypeConstants)
          Constructs an org.hibernate.hql.antlr.ASTPrinter, given the class that contains the token type constants (typically the '{grammar}TokenTypes' interface generated by ANTLR).
 
Method Summary
static java.lang.String getConstantName(java.lang.Class tokenTypeConstants, int type)
          Get a single token type name in the specified set of token type constants (interface).
private static java.lang.String getTokenTypeName(java.lang.reflect.Field field, int type, boolean checkType)
           
private  java.lang.String getTokenTypeName(int type)
          Returns the token type name for the given token type.
 boolean isShowClassNames()
          Returns true if the node class names will be displayed.
 java.lang.String nodeToString(antlr.collections.AST ast, boolean showClassName)
           
 void setShowClassNames(boolean showClassNames)
          Enables or disables AST node class name display.
 java.lang.String showAsString(antlr.collections.AST ast, java.lang.String header)
          Prints the AST in 'ASCII art' tree form into a string.
private  void showAst(java.util.ArrayList parents, java.io.PrintWriter pw, antlr.collections.AST ast)
           
private  void showAst(antlr.collections.AST ast, java.io.PrintStream out)
          Prints the AST in 'ASCII art' tree form to the specified print stream.
 void showAst(antlr.collections.AST ast, java.io.PrintWriter pw)
          Prints the AST in 'ASCII art' tree form to the specified print writer.
private  void showNode(java.io.PrintWriter pw, antlr.collections.AST ast)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokenTypeNamesByTokenType

private java.util.Map tokenTypeNamesByTokenType

tokenTypeConstants

private java.lang.Class tokenTypeConstants

showClassNames

private boolean showClassNames
Constructor Detail

ASTPrinter

public ASTPrinter(java.lang.Class tokenTypeConstants)
Constructs an org.hibernate.hql.antlr.ASTPrinter, given the class that contains the token type constants (typically the '{grammar}TokenTypes' interface generated by ANTLR).

Method Detail

isShowClassNames

public boolean isShowClassNames()
Returns true if the node class names will be displayed.


setShowClassNames

public void setShowClassNames(boolean showClassNames)
Enables or disables AST node class name display.


showAst

private void showAst(antlr.collections.AST ast,
                     java.io.PrintStream out)
Prints the AST in 'ASCII art' tree form to the specified print stream.


showAst

public void showAst(antlr.collections.AST ast,
                    java.io.PrintWriter pw)
Prints the AST in 'ASCII art' tree form to the specified print writer.


showAsString

public java.lang.String showAsString(antlr.collections.AST ast,
                                     java.lang.String header)
Prints the AST in 'ASCII art' tree form into a string.


getConstantName

public static java.lang.String getConstantName(java.lang.Class tokenTypeConstants,
                                               int type)
Get a single token type name in the specified set of token type constants (interface).


getTokenTypeName

private static java.lang.String getTokenTypeName(java.lang.reflect.Field field,
                                                 int type,
                                                 boolean checkType)

getTokenTypeName

private java.lang.String getTokenTypeName(int type)
Returns the token type name for the given token type.


showAst

private void showAst(java.util.ArrayList parents,
                     java.io.PrintWriter pw,
                     antlr.collections.AST ast)

showNode

private void showNode(java.io.PrintWriter pw,
                      antlr.collections.AST ast)

nodeToString

public java.lang.String nodeToString(antlr.collections.AST ast,
                                     boolean showClassName)