public class ASTPrinter
extends java.lang.Object
Constructor and Description |
---|
ASTPrinter(boolean showClassNames) |
ASTPrinter(java.lang.Class tokenTypeConstants)
Constructs a printer.
|
ASTPrinter(java.lang.Class tokenTypeConstants,
boolean showClassNames)
Constructs a printer.
|
Modifier and Type | Method and Description |
---|---|
static void |
appendEscapedMultibyteChars(java.lang.String text,
java.lang.StringBuilder buf) |
static java.lang.String |
escapeMultibyteChars(java.lang.String text) |
java.lang.String |
getTokenTypeName(int type)
Returns the token type name for the given token type.
|
boolean |
isShowClassNames()
Getter for property 'showClassNames'.
|
java.lang.String |
nodeToString(antlr.collections.AST ast,
boolean showClassName) |
java.lang.String |
showAsString(antlr.collections.AST ast,
java.lang.String header)
Renders the AST into 'ASCII art' form and returns that string representation.
|
void |
showAst(antlr.collections.AST ast,
java.io.PrintStream out)
Prints the AST in 'ASCII art' 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.
|
public ASTPrinter(java.lang.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(java.lang.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 java.lang.String showAsString(antlr.collections.AST ast, java.lang.String header)
ast
- The AST to display.header
- The header for the display.public void showAst(antlr.collections.AST ast, java.io.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, java.io.PrintWriter pw)
ast
- The AST to print.pw
- The print writer to which the AST should be written.public java.lang.String getTokenTypeName(int type)
type
- The token type.public java.lang.String nodeToString(antlr.collections.AST ast, boolean showClassName)
public static void appendEscapedMultibyteChars(java.lang.String text, java.lang.StringBuilder buf)
public static java.lang.String escapeMultibyteChars(java.lang.String text)
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.