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 public 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.sourceStart = sourceStart;
21 this.sourceEnd = 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 ...)
56 public abstract void getOutsideVariable(List list);
59 * get the modified variables.
61 public abstract void getModifiedVariable(List list);
64 * Get the variables used.
66 public abstract void getUsedVariable(List list);
69 * This method will analyze the code.
70 * by default it will do nothing
72 public void analyzeCode() {
76 * Check if the array array contains the object o
77 * @param array an array
79 * @return true if the array contained the object o
81 public boolean arrayContains(Object[] array, Object o) {
82 for (int i = 0; i < array.length; i++) {
83 if (array[i].equals(o)) {