First try for AST structure. A lot of things to change
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / GlobalStatement.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/GlobalStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/GlobalStatement.java
new file mode 100644 (file)
index 0000000..8d17144
--- /dev/null
@@ -0,0 +1,50 @@
+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 GlobalStatement statement in php.
+ * @author Matthieu Casanova
+ */
+public class GlobalStatement extends Statement implements Outlineable {
+
+  /** An array of the variables called by this global statement. */
+  public String[] variables;
+
+  private Object parent;
+
+  public GlobalStatement(Object parent, String[] variables, int sourceStart, int sourceEnd) {
+    super(sourceStart, sourceEnd);
+    this.variables = variables;
+    this.parent = parent;
+  }
+
+  public String toString() {
+    StringBuffer buff = new StringBuffer("global ");
+    for (int i = 0; i < variables.length; i++) {
+      if (i != 0) {
+        buff.append(", ");
+      }
+      buff.append(variables[i]);
+    }
+    return buff.toString();
+  }
+
+  public String toString(int tab) {
+    return tabString(tab) + toString();
+  }
+
+  /**
+   * This will return the image for the outline of the object.
+   * @return an image
+   */
+  public ImageDescriptor getImage() {
+    return PHPUiImages.DESC_INC;
+  }
+
+  public Object getParent() {
+    return parent;
+  }
+}