|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openjava.ptree.util.ParseTreeVisitor | +--openjava.ptree.util.SourceCodeWriter
The class SourceCodeWriter
is a Visitor role
in the Visitor pattern and this also visits each child
ParseTree
object from left to right.
ParseTree
,
ParseTreeVisitor
Field Summary | |
private int |
debugLevel
to write debugging code |
private int |
nest
|
static String |
NEWLINE
|
protected PrintWriter |
out
|
private String |
tab
to write debugging code |
Constructor Summary | |
SourceCodeWriter(PrintWriter out)
Allocates a source code writer. |
Methods inherited from class openjava.ptree.util.ParseTreeVisitor |
visit, visit, visit, visit, visit, visit, visit, visit, visit |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected PrintWriter out
public static String NEWLINE
private int debugLevel
private String tab
private int nest
Constructor Detail |
public SourceCodeWriter(PrintWriter out)
Method Detail |
public void setDebugLevel(int n)
public int getDebugLevel()
public void setTab(String str)
public String getTab()
public void setNest(int i)
public int getNest()
public void pushNest()
public void popNest()
private final void writeDebugL(ParseTree ptree)
private final void writeDebugR()
private final void writeDebugLR()
private final void writeDebugLln()
private final void writeDebugRln()
private final void writeDebugln()
private final void writeDebug(String str)
private final void writeTab()
public void visit(AllocationExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ArrayAccess p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ArrayAllocationExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ArrayInitializer p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(AssignmentExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(BinaryExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(Block p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(BreakStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(CaseGroup p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(CaseGroupList p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(CaseLabel p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(CaseLabelList p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(CastExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(CatchBlock p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(CatchList p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ClassDeclaration p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ClassDeclarationList p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ClassLiteral p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(CompilationUnit p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ConditionalExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ConstructorDeclaration p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ConstructorInvocation p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ContinueStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(DoWhileStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(EmptyStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ExpressionList p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ExpressionStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(FieldAccess p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(FieldDeclaration p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ForStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(IfStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(InstanceofExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(LabeledStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(Literal p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(MemberDeclarationList p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(MemberInitializer p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(MethodCall p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(MethodDeclaration p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ModifierList p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(Parameter p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ParameterList p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ReturnStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(SelfAccess p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(StatementList p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(SwitchStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(SynchronizedStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(ThrowStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(TryStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(TypeName p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(UnaryExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(Variable p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(VariableDeclaration p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(VariableDeclarator p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(WhileStatement p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(QueryExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(AliasedExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(JoinExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
public void visit(InsertExpression p) throws ParseTreeException
visit
in class ParseTreeVisitor
ParseTreeException
private final void writeArguments(ExpressionList args) throws ParseTreeException
ParseTreeException
private final void writeAnonymous(Object obj) throws ParseTreeException
ParseTreeException
private final void writeList(List list) throws ParseTreeException
ParseTreeException
private final void writeListWithDelimiter(List list, String delimiter) throws ParseTreeException
ParseTreeException
private final void writeListWithSuffix(List list, String suffix) throws ParseTreeException
ParseTreeException
private final void writeParenthesis(Expression expr) throws ParseTreeException
ParseTreeException
private final void writeStatementsBlock(StatementList stmts) throws ParseTreeException
ParseTreeException
private static final boolean isOperatorNeededLeftPar(int operator, Expression leftexpr)
private static final boolean isOperatorNeededRightPar(int operator, Expression rightexpr)
private static final int operatorStrength(int op)
op
- the id number of operator.
private final void printComment(NonLeaf p)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |