Package EDU.purdue.jtb.common
Class JavaBranchPrinter
java.lang.Object
EDU.purdue.jtb.common.JavaBranchPrinter
Class
JavaBranchPrinter
is not itself a visitor but it uses a JavaPrinter
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
ConstructorsConstructorDescriptionJavaBranchPrinter
(JTBOptions aJopt, Spacing aSpc) Constructs a new instance with a default allocated buffer and a given indentation object. -
Method Summary
Modifier and TypeMethodDescriptiongenJavaBranch
(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 Details
-
JavaBranchPrinter
Constructs a new instance with a default allocated buffer and a given indentation object.- Parameters:
aJopt
- - the JTB optionsaSpc
- - an indentation
-
-
Method Details
-
genJavaBranch
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
-