类 ASTPrinter
- java.lang.Object
-
- org.hibernate.hql.internal.ast.util.ASTPrinter
-
- 直接已知子类:
ASTReferencedTablesPrinter
public class ASTPrinter extends Object
Utility for generating pretty "ASCII art" representations of syntax trees. This class is threadsafe: reuse instances as needed.- 作者:
- Joshua Davis, Steve Ebersole
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 static voidappendEscapedMultibyteChars(String text, StringBuilder buf)LinkedHashMap<String,Object>createNodeProperties(antlr.collections.AST ast)static StringescapeMultibyteChars(String text)StringgetTokenTypeName(int type)Returns the token type name for the given token type.StringnodeToString(antlr.collections.AST ast)StringpropertyToString(String label, Object value, antlr.collections.AST ast)StringshowAsString(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.
-
-
-
方法详细资料
-
showAsString
public String showAsString(antlr.collections.AST ast, String header)
Renders the AST into 'ASCII art' form and returns that string representation.- 参数:
ast- The AST to display.header- The header for the display.- 返回:
- The AST in 'ASCII art' form, as a string.
-
showAst
public void showAst(antlr.collections.AST ast, PrintStream out)Prints the AST in 'ASCII art' form to the specified print stream.- 参数:
ast- The AST to print.out- The print stream to which the AST should be printed.
-
showAst
public void showAst(antlr.collections.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 to which the AST should be written.
-
getTokenTypeName
public String getTokenTypeName(int type)
Returns the token type name for the given token type.- 参数:
type- The token type.- 返回:
- String - The token type name from the token type constant class, or just the integer as a string if none exists.
-
nodeToString
public String nodeToString(antlr.collections.AST ast)
-
createNodeProperties
public LinkedHashMap<String,Object> createNodeProperties(antlr.collections.AST ast)
-
propertyToString
public String propertyToString(String label, Object value, antlr.collections.AST ast)
-
appendEscapedMultibyteChars
public static void appendEscapedMultibyteChars(String text, StringBuilder buf)
-
-