package net.sourceforge.phpdt.internal.compiler.ast;
+import java.util.List;
+import java.util.ArrayList;
+
/**
+ * an echo statement.
+ * echo something;
* @author Matthieu Casanova
*/
public class EchoStatement extends Statement {
/** An array of expressions in this echo statement. */
public Expression[] expressions;
- public EchoStatement (Expression[] expressions, int sourceStart) {
- super(sourceStart, expressions[expressions.length-1].sourceEnd);
+ public EchoStatement (final Expression[] expressions, final int sourceStart, final int sourceEnd) {
+ super(sourceStart, sourceEnd);
this.expressions = expressions;
}
public String toString() {
- StringBuffer buff = new StringBuffer("echo ");
+ final StringBuffer buff = new StringBuffer("echo ");//$NON-NLS-1$
for (int i = 0; i < expressions.length; i++) {
if (i != 0) {
- buff.append(", ");
+ buff.append(", ");//$NON-NLS-1$
}
- buff.append(expressions[i].toString());
+ buff.append(expressions[i].toStringExpression());
}
return buff.toString();
}
* @param tab how many tabs (not used here
* @return a String
*/
- public String toString(int tab) {
- return tabString(tab) + toString();
+ public String toString(final int tab) {
+ final String tabs = tabString(tab);
+ final String str = toString();
+ final StringBuffer buff = new StringBuffer(tabs.length()+str.length());
+ return buff.toString();
+ }
+
+ /**
+ * Get the variables from outside (parameters, globals ...)
+ */
+ public void getOutsideVariable(final List list) {
+ for (int i = 0; i < expressions.length; i++) {
+ expressions[i].getOutsideVariable(list);
+ }
+ }
+
+ /**
+ * get the modified variables.
+ */
+ public void getModifiedVariable(final List list) {
+ for (int i = 0; i < expressions.length; i++) {
+ expressions[i].getModifiedVariable(list);
+ }
+ }
+
+ /**
+ * Get the variables used.
+ */
+ public void getUsedVariable(final List list) {
+ for (int i = 0; i < expressions.length; i++) {
+ expressions[i].getUsedVariable(list);
+ }
}
}