package net.sourceforge.phpdt.internal.compiler.ast; /** * @author Matthieu Casanova */ public class ForeachStatement extends Statement { public Expression expression; public Expression variable; public Statement statement; public ForeachStatement(Expression expression, Expression variable, Statement statement, int sourceStart, int sourceEnd) { super(sourceStart, sourceEnd); this.expression = expression; this.variable = variable; this.statement = statement; } /** * Return the object into String. * @param tab how many tabs (not used here * @return a String */ public String toString(int tab) { final StringBuffer buff = new StringBuffer(tabString(tab)); buff.append("foreach ("); buff.append(expression.toStringExpression()); buff.append(" as "); buff.append(variable.toStringExpression()); buff.append(" {\n"); buff.append(statement.toString(tab+1)); buff.append("\n}"); return buff.toString(); } }