1 package net.sourceforge.phpdt.internal.compiler.ast;
3 import org.eclipse.jface.text.Position;
4 import org.eclipse.jface.resource.ImageDescriptor;
5 import net.sourceforge.phpdt.internal.compiler.parser.Outlineable;
6 import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
7 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
10 import java.util.ArrayList;
14 * define(expression,expression)
15 * @author Matthieu Casanova
17 public class Define extends Statement implements Outlineable {
19 public Expression defineName,defineValue;
21 private Object parent;
22 private Position position;
24 public Define(final Object parent,
25 final Expression defineName,
26 final Expression defineValue,
27 final int sourceStart,
28 final int sourceEnd) {
29 super(sourceStart, sourceEnd);
31 this.defineName = defineName;
32 this.defineValue = defineValue;
33 position = new Position(sourceStart, sourceEnd);
36 public String toString(final int tab) {
37 final StringBuffer buff = new StringBuffer(tabString(tab));
38 buff.append("define(");
39 buff.append(defineName.toStringExpression());
41 buff.append(defineValue.toStringExpression());
43 return buff.toString();
46 public String toString() {
47 final StringBuffer buff = new StringBuffer(defineName.toStringExpression());
49 buff.append(defineValue.toStringExpression());
50 return buff.toString();
53 public ImageDescriptor getImage() {
54 return PHPUiImages.DESC_VAR;
57 public Object getParent() {
61 public Position getPosition() {
66 * Get the variables from outside (parameters, globals ...)
67 * @return the variables from outside
69 public List getOutsideVariable() {
70 final ArrayList list = new ArrayList(1);
71 list.add(new VariableUsage(defineName.toStringExpression(),sourceStart));//todo: someday : evaluate the defineName
76 * get the modified variables.
77 * @return the variables modified
79 public List getModifiedVariable() {
80 return new ArrayList(1);
84 * Get the variables used.
85 * @return the variables used
87 public List getUsedVariable() {
88 return new ArrayList(1);