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
+ */
+ protected Expression(final int sourceStart, final 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 final String toString(final 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();
}