Package EDU.purdue.jtb.common
Class JavaBranchPrinter
- java.lang.Object
-
- EDU.purdue.jtb.common.JavaBranchPrinter
-
public class JavaBranchPrinter extends java.lang.Object
ClassJavaBranchPrinter
is not itself a visitor but it uses aJavaPrinter
visitor to visit a java code branch of the tree and returns a pretty printed string representation of the subtree.Class maintains state (for a grammar), and not supposed to be run in parallel threads (on the same grammar).
-
-
Constructor Summary
Constructors Constructor Description JavaBranchPrinter(JTBOptions aJopt, Spacing aSpc)
Constructs a new instance with a default allocated buffer and a given indentation object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringBuilder
genJavaBranch(INode aJavaNode)
Visits a given (java code) node branch of the tree and returns a pretty printed string representation of the subtree.
Implementation note : it reuses a class allocated StringBuilder buffer, which is therefore overwritten on a next call.
-
-
-
Constructor Detail
-
JavaBranchPrinter
public JavaBranchPrinter(JTBOptions aJopt, Spacing aSpc)
Constructs a new instance with a default allocated buffer and a given indentation object.- Parameters:
aJopt
- - the JTB optionsaSpc
- - an indentation
-
-
Method Detail
-
genJavaBranch
public java.lang.StringBuilder genJavaBranch(INode aJavaNode)
Visits a given (java code) node branch of the tree and returns a pretty printed string representation of the subtree.
Implementation note : it reuses a class allocated StringBuilder buffer, which is therefore overwritten on a next call.- Parameters:
aJavaNode
- - the node to walk down and pretty print- Returns:
- the pretty print in a reused StringBuilder buffer
-
-