Package org.hibernate.hql.ast.util
Class ASTPrinter
java.lang.Object
org.hibernate.hql.ast.util.ASTPrinter
Utility for generating pretty "ASCII art" representations of syntax trees.
-
Constructor Summary
ConstructorsConstructorDescriptionASTPrinter(boolean showClassNames) ASTPrinter(Class tokenTypeConstants) Constructs a printer.ASTPrinter(Class tokenTypeConstants, boolean showClassNames) Constructs a printer. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendEscapedMultibyteChars(String text, StringBuffer buf) static StringescapeMultibyteChars(String text) getTokenTypeName(int type) Returns the token type name for the given token type.booleanGetter for property 'showClassNames'.nodeToString(antlr.collections.AST ast, boolean showClassName) showAsString(antlr.collections.AST ast, String header) Renders the AST into 'ASCII art' form and returns that string representation.voidshowAst(antlr.collections.AST ast, PrintStream out) Prints the AST in 'ASCII art' form to the specified print stream.voidshowAst(antlr.collections.AST ast, PrintWriter pw) Prints the AST in 'ASCII art' tree form to the specified print writer.
-
Constructor Details
-
ASTPrinter
Constructs a printer. Delegates toASTPrinter(Class, boolean)withshowClassNamesas true- Parameters:
tokenTypeConstants- The token types to use during printing; typically the {vocabulary}TokenTypes.java interface generated by ANTLR.
-
ASTPrinter
public ASTPrinter(boolean showClassNames) -
ASTPrinter
Constructs a printer.- Parameters:
tokenTypeConstants- The token types to use during printing; typically the {vocabulary}TokenTypes.java interface generated by ANTLR.showClassNames- Should the AST class names be shown.
-
-
Method Details
-
isShowClassNames
public boolean isShowClassNames()Getter for property 'showClassNames'.- Returns:
- Value for property 'showClassNames'.
-
showAsString
Renders the AST into 'ASCII art' form and returns that string representation.- Parameters:
ast- The AST to display.header- The header for the display.- Returns:
- The AST in 'ASCII art' form, as a string.
-
showAst
Prints the AST in 'ASCII art' form to the specified print stream.- Parameters:
ast- The AST to print.out- The print stream to which the AST should be printed.
-
showAst
Prints the AST in 'ASCII art' tree form to the specified print writer.- Parameters:
ast- The AST to print.pw- The print writer to which the AST should be written.
-
getTokenTypeName
Returns the token type name for the given token type.- Parameters:
type- The token type.- Returns:
- String - The token type name from the token type constant class, or just the integer as a string if none exists.
-
nodeToString
-
appendEscapedMultibyteChars
-
escapeMultibyteChars
-