/**
* Create an argument.
- * @param initialization the initialization
* @param name the name
+ * @param reference the variable is a reference ?
+ * @param initialization the initialization
* @param sourceStart the start point
*/
public ArgumentDeclaration(char[] name,
+ boolean reference,
Expression initialization,
- int sourceStart,
- boolean reference) {
+ int sourceStart) {
super(name, initialization, sourceStart);
this.reference = reference;
}
/**
+ * Create an argument.
+ * @param name the name
+ * @param reference the variable is a reference ?
+ * @param sourceStart the start point
+ */
+ public ArgumentDeclaration(char[] name,
+ boolean reference,
+ int sourceStart) {
+ super(name, sourceStart);
+ this.reference = reference;
+ }
+ /**
* Return the expression as String.
* @return the expression
*/
public Expression[] expressions;
public EchoStatement (Expression[] expressions, int sourceStart) {
- super(sourceStart, expressions[expressions.length].sourceEnd);
+ super(sourceStart, expressions[expressions.length-1].sourceEnd);
this.expressions = expressions;
}
package net.sourceforge.phpdt.internal.compiler.ast;
-import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
-import net.sourceforge.phpdt.internal.ui.PHPUiImages;
-import org.eclipse.jface.resource.ImageDescriptor;
-
/**
+ * A Field declaration.
+ * This is a variable declaration for a php class
+ * In fact it's an array of VariableDeclaration, since a field could contains
+ * several vars :
+ * var $toto,$tata;
* @author Matthieu Casanova
*/
public class FieldDeclaration extends Statement {
+ /** The variables. */
public VariableDeclaration[] vars;
- public FieldDeclaration(VariableDeclaration[] vars,int sourceStart,int sourceEnd) {
- super(sourceStart,sourceEnd);
+ /**
+ * Create a new field.
+ * @param vars the array of variables.
+ * @param sourceStart the starting offset
+ * @param sourceEnd the ending offset
+ */
+ public FieldDeclaration(VariableDeclaration[] vars, int sourceStart, int sourceEnd) {
+ super(sourceStart, sourceEnd);
this.vars = vars;
}
-
+ /**
+ * 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("var ");
public class IfStatement extends Statement {
public Expression condition;
+ public Statement statement;
public ElseIf[] elseifs;
public Else els;
+ /**
+ * Create a new If statement
+ * @param condition the condition
+ * @param statement a statement or a block of statements
+ * @param elseifs the elseifs
+ * @param els the else (or null)
+ * @param sourceStart the starting position
+ * @param sourceEnd the ending offset
+ */
public IfStatement(Expression condition,
+ Statement statement,
ElseIf[] elseifs,
Else els,
int sourceStart,
int sourceEnd) {
super(sourceStart, sourceEnd);
this.condition = condition;
+ this.statement = statement;
this.elseifs = elseifs;
this.els = els;
}
public String[] vars;
public Expression expression;
- public ListExpression(String[] vars, Expression expression, int sourceStart, int sourceEnd) {
+ public ListExpression(String[] vars,
+ Expression expression,
+ int sourceStart,
+ int sourceEnd) {
super(sourceStart, sourceEnd);
this.vars = vars;
this.expression = expression;
}
+ public ListExpression(String[] vars,
+ int sourceStart,
+ int sourceEnd) {
+ super(sourceStart, sourceEnd);
+ this.vars = vars;
+ }
+
/**
* Return the expression as String.
* @return the expression
if (node == null) {
break;
}
- buff.append(node);
+ buff.append(node.toString(0));
}
return buff.toString();
}
super(name, sourceStart, initialization.sourceEnd);
this.initialization = initialization;
}
+
+ /**
+ * Create a variable.
+ * @param name the name of the variable
+ * @param sourceStart the start point
+ */
+ public VariableDeclaration(char[] name,
+ int sourceStart) {
+ super(name, sourceStart, sourceStart + name.length);
+ this.initialization = initialization;
+ }
+
/**
* Return the variable into String.
* @return a String