org.hibernate.hql.ast.util
Class ASTPrinter
java.lang.Object
org.hibernate.hql.ast.util.ASTPrinter
public class ASTPrinter
extends java.lang.Object
An 'ASCII art' AST printer for debugging ANTLR grammars.
ASTPrinter(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).
|
static void | appendEscapedMultibyteChars(String text, StringBuffer buf)
|
static String | escapeMultibyteChars(String text)
|
static String | getConstantName(Class tokenTypeConstants, int type) - Get a single token type name in the specified set of token type constants (interface).
|
boolean | isShowClassNames() - Returns true if the node class names will be displayed.
|
String | nodeToString(AST ast, boolean showClassName)
|
void | setShowClassNames(boolean showClassNames) - Enables or disables AST node class name display.
|
String | showAsString(AST ast, String header) - Prints the AST in 'ASCII art' tree form into a string.
|
void | showAst(AST ast, PrintWriter pw) - Prints the AST in 'ASCII art' tree form to the specified print writer.
|
ASTPrinter
public ASTPrinter(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).
tokenTypeConstants
- The class with token type constants in it.
appendEscapedMultibyteChars
public static void appendEscapedMultibyteChars(String text,
StringBuffer buf)
escapeMultibyteChars
public static String escapeMultibyteChars(String text)
getConstantName
public static String getConstantName(Class tokenTypeConstants,
int type)
Get a single token type name in the specified set of token type constants (interface).
tokenTypeConstants
- Token type constants interface (e.g. HqlSqlTokenTypes.class).type
- The token type ( typically from ast.getType() ).
- The token type name, *or* the integer value if the name could not be found for some reason.
isShowClassNames
public boolean isShowClassNames()
Returns true if the node class names will be displayed.
- true if the node class names will be displayed.
nodeToString
public String nodeToString(AST ast,
boolean showClassName)
setShowClassNames
public void setShowClassNames(boolean showClassNames)
Enables or disables AST node class name display.
showClassNames
- true to enable class name display, false to disable
showAsString
public String showAsString(AST ast,
String header)
Prints the AST in 'ASCII art' tree form into a string.
ast
- The AST to display.header
- The header for the display.
- The AST in 'ASCII art' form, as a string.
showAst
public void showAst(AST ast,
PrintWriter pw)
Prints the AST in 'ASCII art' tree form to the specified print writer.
ast
- The AST to print.pw
- The print writer.