First try for AST structure. A lot of things to change
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / AstNode.java
index e686abf..9eabb41 100644 (file)
@@ -6,9 +6,20 @@ package net.sourceforge.phpdt.internal.compiler.ast;
  */
 public abstract class AstNode {
 
+  /** Starting and ending position of the node in the sources. */
   public int sourceStart, sourceEnd;
 
   /**
+   * Create a node giving starting and ending offset
+   * @param sourceStart starting offset
+   * @param sourceEnd ending offset
+   */
+  public AstNode(int sourceStart, int sourceEnd) {
+    this.sourceStart = sourceStart;
+    this.sourceEnd = sourceEnd;
+  }
+
+  /**
    * Add some tabulations.
    * @param tab the number of tabulations
    * @return a String containing some spaces
@@ -20,11 +31,19 @@ public abstract class AstNode {
     return s.toString();
   }
 
+  /**
+   * Return the object into String.
+   * It should be overriden
+   * @return a String
+   */
   public String toString() {
-    return toString(0);
-  }
-
-  public String toString(int tab) {
     return "****" + super.toString() + "****";  //$NON-NLS-2$ //$NON-NLS-1$
   }
+
+  /**
+   * Return the object into String.
+   * @param tab how many tabs (not used here
+   * @return a String
+   */
+  public abstract String toString(int tab);
 }