+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * @author Matthieu Casanova
- */
-public abstract class AbstractCase extends Statement {
- public Statement[] statements;
-
- public AbstractCase(Statement[] statements, int sourceStart, int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.statements = statements;
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * Here are php comment.
- * @author Matthieu Casanova
- */
-public abstract class AbstractPHPComment extends AstNode {
-
- /**
- * Create a comment giving starting and ending offset
- * @param sourceStart starting offset
- * @param sourceEnd ending offset
- */
- public AbstractPHPComment(int sourceStart, int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * Variable suffix.
- * class access or [something]
- * Should it be an expression ?
- * @author Matthieu Casanova
- */
-public abstract class AbstractSuffixExpression extends Expression {
-
- public AbstractSuffixExpression(int sourceStart, int sourceEnd) {
- super(sourceStart, sourceEnd);
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * @author Matthieu Casanova
- */
-public class ArrayDeclarator extends AbstractSuffixExpression {
-
- public Expression prefix;
- public Expression vars;
-
- public ArrayDeclarator(Expression prefix,
- Expression vars,
- int sourceEnd) {
- super(prefix.sourceStart, sourceEnd);
- this.prefix = prefix;
- this.vars = vars;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final StringBuffer buff = new StringBuffer(prefix.toStringExpression());
- buff.append('[');
- if (vars != null) {
- buff.append(vars.toStringExpression());
- }
- buff.append(']');
- return buff.toString();
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * @author Matthieu Casanova
- */
-public class ArrayInitializer extends Expression {
-
- public ArrayVariableDeclaration[] vars;
-
- public ArrayInitializer(ArrayVariableDeclaration[] vars,
- int sourceStart,
- int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.vars = vars;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final StringBuffer buff = new StringBuffer("array(");
- for (int i = 0; i < vars.length; i++) {
- ArrayVariableDeclaration var = vars[i];
- if (var != null) {
- buff.append(var.toStringExpression());
- }
- if (i != 0) {
- buff.append(',');
- }
- }
- return buff.toString();
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * This variable declaration do not extend AbstractVariableDeclaration because
- * it could take Expression as key
- * @author Matthieu Casanova
- */
-public class ArrayVariableDeclaration extends Expression {
-
- public Expression key,value;
-
- public ArrayVariableDeclaration(Expression key,Expression value) {
- super(key.sourceStart, value.sourceEnd);
- this.key = key;
- this.value = value;
- }
-
- /**
- * Return the expression as String.
- * @return the expression
- */
- public String toStringExpression() {
- final StringBuffer buff = new StringBuffer();
- buff.append(key.toStringExpression());
- if (value != null) {
- buff.append(" => ");
- buff.append(value.toStringExpression());
- }
- return buff.toString();
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * @author Matthieu Casanova
- */
-public class BinaryExpression extends OperatorExpression {
-
- /** The two expressions. */
- public Expression left,right;
-
- public BinaryExpression(Expression left,
- Expression right,
- int operator) {
- super(operator, left.sourceStart, right.sourceEnd);
- this.left = left;
- this.right = right;
- }
-
- public String toStringExpressionNoParenthesis() {
- final StringBuffer buff = new StringBuffer(left.toStringExpression());
- buff.append(operatorToString());
- buff.append(right.toStringExpression());
- return buff.toString();
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * Here is a branchstatement : break or continue
- * @author Matthieu Casanova
- */
-public abstract class BranchStatement extends Statement {
-
- public Expression expression;
-
- public BranchStatement(Expression expression,int sourceStart, int sourceEnd) {
- super(sourceStart, sourceEnd);
- this.expression = expression;
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * A break statement.
- * @author Matthieu Casanova
- */
-public class Break extends BranchStatement {
-
- public Break(Expression expression, int sourceStart, int sourceEnd) {
- super(expression, sourceStart, sourceEnd);
- }
-
- public String toString(int tab) {
- String s = tabString(tab);
- if (expression == null) {
- return s + "break " + expression.toString();//$NON-NLS-1$
- }
- return s + "break";//$NON-NLS-1$
- }
-}
+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * A Case statement for a Switch.
- * @author Matthieu Casanova
- */
-public class Case extends AbstractCase {
-
- public Expression value;
- public Statement[] statements;
-
- public Case(Expression value,
- Statement[] statements,
- int sourceStart,
- int sourceEnd) {
- super(statements, sourceStart, sourceEnd);
- this.value = value;
- }
-
- /**
- * Return the object into String.
- * @param tab how many tabs (not used here
- * @return a String
- */
- public String toString(int tab) {
- final StringBuffer buff = new StringBuffer(tabString(tab));
- buff.append("case ");
- buff.append(value.toStringExpression());
- buff.append(" :\n");
- for (int i = 0; i < statements.length; i++) {
- Statement statement = statements[i];
- buff.append(statement.toString(tab + 1));
- }
- return buff.toString();
- }
-}
import java.util.List;
import java.util.TreeSet;
-import net.sourceforge.phpdt.internal.compiler.parser.PHPOutlineInfo;
-import net.sourceforge.phpdt.internal.compiler.parser.PHPSegment;
-import net.sourceforge.phpdt.internal.compiler.parser.PHPSegmentWithChildren;
+import net.sourceforge.phpdt.internal.compiler.parser.*;
import net.sourceforge.phpdt.internal.ui.viewsupport.ImageDescriptorRegistry;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
if (o2 instanceof PHPSegmentWithChildren && !(o1 instanceof PHPSegmentWithChildren)) {
return -1;
}
- return ((PHPSegment) o1).toString().compareToIgnoreCase(((PHPSegment) o2).toString());
+ return ((Outlineable) o1).toString().compareToIgnoreCase(((Outlineable) o2).toString());
}
}
PHPOutlineInfo outlineInfo = parser.parseInfo(fInput, text);
fVariables = outlineInfo.getVariables();
- PHPSegmentWithChildren declarations = outlineInfo.getDeclarations();
- PHPSegment temp;
+ OutlineableWithChildren declarations = outlineInfo.getDeclarations();
+ Outlineable temp;
for (int i = 0; i < declarations.size(); i++) {
temp = declarations.get(i);
fContent.add(temp);
}
Collections.sort(fContent, new SegmentComparator());
-
}
/*
* @see ITreeContentProvider#getParent(Object)
*/
public Object getParent(Object element) {
- if (element instanceof PHPSegment) {
- return ((PHPSegment) element).getParent();
+ if (element instanceof Outlineable) {
+ return ((Outlineable) element).getParent();
}
return null;
}
* override.
*/
public Image getImage(Object element) {
- if (element instanceof PHPSegment) {
- ImageDescriptor descriptor = ((PHPSegment) element).getImage();
+ if (element instanceof Outlineable) {
+ ImageDescriptor descriptor = ((Outlineable) element).getImage();
return fRegistry.get(descriptor);
}
return null;
import test.PHPParserManager;
/**
- * Class that defines the action for parsing the current PHP file
+ * ClassDeclaration that defines the action for parsing the current PHP file
*/
public class PHPParserAction extends TextEditorAction {