First try for AST structure. A lot of things to change
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ArrayVariableDeclaration.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArrayVariableDeclaration.java
new file mode 100644 (file)
index 0000000..b9a0d6b
--- /dev/null
@@ -0,0 +1,31 @@
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+/**
+ * This variable declaration do not extend AbstractVariableDeclaration because
+ * it could take Expression as key
+ * @author Matthieu Casanova
+ */
+public class ArrayVariableDeclaration extends Expression {
+
+  public Expression key,value;
+
+  public ArrayVariableDeclaration(Expression key,Expression value) {
+    super(key.sourceStart, value.sourceEnd);
+    this.key = key;
+    this.value = value;
+  }
+
+  /**
+   * Return the expression as String.
+   * @return the expression
+   */
+  public String toStringExpression() {
+    final StringBuffer buff = new StringBuffer();
+    buff.append(key.toStringExpression());
+    if (value != null) {
+      buff.append(" => ");
+      buff.append(value.toStringExpression());
+    }
+    return buff.toString();
+  }
+}