First try for AST structure. A lot of things to change
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / Expression.java
index 76fc023..b5b5947 100644 (file)
@@ -1,26 +1,33 @@
 package net.sourceforge.phpdt.internal.compiler.ast;
 
+
 /**
  * An expression.
  * @author Matthieu Casanova
  */
-public class Expression extends AstNode {
+public abstract class Expression extends Statement {
 
-  public String toString(int tab) {
-    String s = tabString(tab);
-    return s + toStringExpression(tab);
+  /**
+   * Create an expression giving starting and ending offset
+   * @param sourceStart starting offset
+   * @param sourceEnd ending offset
+   */
+  public Expression(int sourceStart, int sourceEnd) {
+    super(sourceStart, sourceEnd);
   }
 
-  //Subclass re-define toStringExpression
-//This method is abstract and should never be called
-//but we provide some code that is running.....just in case
-//of developpement time (while every  thing is not built)
-  public String toStringExpression() {
-    return super.toString(0);
+  /**
+   * Return the expression with a number of spaces before.
+   * @param tab how many spaces before the expression
+   * @return a string representing the expression
+   */
+  public String toString(int tab) {
+    return tabString(tab) + toStringExpression();
   }
 
-  public String toStringExpression(int tab) {
-    // default is regular toString expression (qualified allocation expressions redifine this method)
-    return this.toStringExpression();
-  }
+  /**
+   * Return the expression as String.
+   * @return the expression
+   */
+  public abstract String toStringExpression();
 }