public class ASTPrinter extends Object
Constructor and Description |
---|
ASTPrinter(boolean showClassNames) |
ASTPrinter(Class tokenTypeConstants)
Constructs a printer.
|
ASTPrinter(Class tokenTypeConstants,
boolean showClassNames)
Constructs a printer.
|
Modifier and Type | Method and Description |
---|---|
static void |
appendEscapedMultibyteChars(String text,
StringBuilder buf) |
static String |
escapeMultibyteChars(String text) |
String |
getTokenTypeName(int type)
Returns the token type name for the given token type.
|
boolean |
isShowClassNames()
Getter for property 'showClassNames'.
|
String |
nodeToString(antlr.collections.AST ast,
boolean showClassName) |
String |
showAsString(antlr.collections.AST ast,
String header)
Renders the AST into 'ASCII art' form and returns that string representation.
|
void |
showAst(antlr.collections.AST ast,
PrintStream out)
Prints the AST in 'ASCII art' form to the specified print stream.
|
void |
showAst(antlr.collections.AST ast,
PrintWriter pw)
Prints the AST in 'ASCII art' tree form to the specified print writer.
|
public ASTPrinter(Class tokenTypeConstants)
ASTPrinter(Class, boolean)
with showClassNames
as truetokenTypeConstants
- The token types to use during printing; typically the {vocabulary}TokenTypes.java
interface generated by ANTLR.public ASTPrinter(boolean showClassNames)
public ASTPrinter(Class tokenTypeConstants, boolean showClassNames)
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.public boolean isShowClassNames()
public String showAsString(antlr.collections.AST ast, String header)
ast
- The AST to display.header
- The header for the display.public void showAst(antlr.collections.AST ast, PrintStream out)
ast
- The AST to print.out
- The print stream to which the AST should be printed.public void showAst(antlr.collections.AST ast, PrintWriter pw)
ast
- The AST to print.pw
- The print writer to which the AST should be written.public String getTokenTypeName(int type)
type
- The token type.public String nodeToString(antlr.collections.AST ast, boolean showClassName)
public static void appendEscapedMultibyteChars(String text, StringBuilder buf)
Copyright © 2017 JBoss by Red Hat. All rights reserved.