First try, not finished
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / AstNode.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AstNode.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/AstNode.java
new file mode 100644 (file)
index 0000000..e686abf
--- /dev/null
@@ -0,0 +1,30 @@
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+/**
+ * It will be the mother of our own ast tree for php just like the ast tree of Eclipse.
+ * @author Matthieu Casanova
+ */
+public abstract class AstNode {
+
+  public int sourceStart, sourceEnd;
+
+  /**
+   * Add some tabulations.
+   * @param tab the number of tabulations
+   * @return a String containing some spaces
+   */
+  public static String tabString(int tab) {
+    StringBuffer s = new StringBuffer();
+    for (int i = tab; i > 0; i--)
+      s.append("  "); //$NON-NLS-1$
+    return s.toString();
+  }
+
+  public String toString() {
+    return toString(0);
+  }
+
+  public String toString(int tab) {
+    return "****" + super.toString() + "****";  //$NON-NLS-2$ //$NON-NLS-1$
+  }
+}