|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object polyglot.visit.PrettyPrinter
public class PrettyPrinter
A PrettyPrinter generates output code from the processed AST. Output is sent to a code writer passes into the printAst method. To use: new PrettyPrinter().printAst(node, new CodeWriter(out));
Field Summary | |
---|---|
protected boolean |
appendSemicolon
|
protected boolean |
printType
|
Constructor Summary | |
---|---|
PrettyPrinter()
|
Method Summary | |
---|---|
boolean |
appendSemicolon()
Flag indicating whether to print a ';' after certain statements. |
boolean |
appendSemicolon(boolean a)
Set a flag indicating whether to print a ';' after certain statements. |
void |
print(Node parent,
Node child,
CodeWriter w)
Print an AST node using the given code writer. |
void |
printAst(Node ast,
CodeWriter w)
Print an AST node using the given code writer. |
boolean |
printType()
Flag indicating whether to print the type in a local declaration. |
boolean |
printType(boolean a)
Set a flag indicating whether to print type type in a local declaration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean appendSemicolon
protected boolean printType
Constructor Detail |
---|
public PrettyPrinter()
Method Detail |
---|
public boolean appendSemicolon()
public boolean appendSemicolon(boolean a)
public boolean printType()
public boolean printType(boolean a)
public void print(Node parent, Node child, CodeWriter w)
CodeWriter.flush()
method must be called after this method
to ensure code is output. Use printAst
rather than this
method to print the entire AST; this method should only be called by
nodes to print their children.
public void printAst(Node ast, CodeWriter w)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |