1 package net.sourceforge.phpdt.internal.compiler.ast;
6 * It will be the mother of our own ast tree for php just like the ast tree of Eclipse.
7 * @author Matthieu Casanova
9 public abstract class AstNode {
11 /** Starting and ending position of the node in the sources. */
12 private int sourceStart, sourceEnd;
15 * Create a node giving starting and ending offset
16 * @param sourceStart starting offset
17 * @param sourceEnd ending offset
19 public AstNode(final int sourceStart, final int sourceEnd) {
20 this.setSourceStart(sourceStart);
21 this.setSourceEnd(sourceEnd);
25 * Add some tabulations.
26 * @param tab the number of tabulations
27 * @return a String containing some spaces
29 public static String tabString(final int tab) {
30 final StringBuffer s = new StringBuffer(2 * tab);
31 for (int i = tab; i > 0; i--) {
32 s.append(" "); //$NON-NLS-1$
38 * Return the object into String.
39 * It should be overriden
42 public String toString() {
43 return "****" + super.toString() + "****"; //$NON-NLS-2$ //$NON-NLS-1$
47 * Return the object into String.
48 * @param tab how many tabs (not used here
51 public abstract String toString(int tab);
54 * Get the variables from outside (parameters, globals ...)
55 * @return the variables from outside
57 public abstract List getOutsideVariable();
60 * get the modified variables.
61 * @return the variables modified
63 public abstract List getModifiedVariable();
66 * Get the variables used.
67 * @return the variables used
69 public abstract List getUsedVariable();
71 public int getSourceStart() {
75 public int getSourceEnd() {
79 public void setSourceStart(int sourceStart) {
80 this.sourceStart = sourceStart;
83 public void setSourceEnd(int sourceEnd) {
84 this.sourceEnd = sourceEnd;