package net.sourceforge.phpdt.internal.compiler.ast;
-import net.sourceforge.phpdt.internal.compiler.ast.AstNode;
-
-
/**
* A Block is
* {
public String toString(int tab) {
final String s = AstNode.tabString(tab);
final StringBuffer buff = new StringBuffer(s);
- if (this.statements == null) {
- buff.append("{\n"); //$NON-NLS-1$
- buff.append(s);
- buff.append("}"); //$NON-NLS-1$
- return s;
- }
buff.append("{\n"); //$NON-NLS-1$
- buff.append(this.toStringStatements(tab));
- buff.append(s);
- buff.append("}"); //$NON-NLS-1$
- return s;
- }
-
- public String toStringStatements(int tab) {
- if (this.statements == null)
- return ""; //$NON-NLS-1$
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < statements.length; i++) {
- buffer.append(statements[i].toString(tab + 1));
- if (statements[i] instanceof Block) {
- buffer.append("\n"); //$NON-NLS-1$
- } else {
- buffer.append(";\n"); //$NON-NLS-1$
+ if (this.statements == null) {
+ for (int i = 0; i < statements.length; i++) {
+ buff.append(statements[i].toString(tab+1)).append(";\n");//$NON-NLS-1$
}
}
- return buffer.toString();
+ buff.append("}\n"); //$NON-NLS-1$
+ return buff.toString();
}
}
stmts.toArray(statementsArray);
{if (true) return new IfStatement(condition,
new Block(statementsArray,pos,endStatements),
- elseIfs,
- elseStatement,
- pos,
- SimpleCharStream.getPosition());}
+ elseIfs,
+ elseStatement,
+ pos,
+ SimpleCharStream.getPosition());}
}
break;
case PHPEND:
stmts.toArray(statementsArray);
return new IfStatement(condition,
new Block(statementsArray,pos,endStatements),
- elseIfs,
- elseStatement,
- pos,
- SimpleCharStream.getPosition());
+ elseIfs,
+ elseStatement,
+ pos,
+ SimpleCharStream.getPosition());
}
}