674f9d13327705b85ebb0498cd7e5a47e6d0ff2c
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / PHPEchoBlock.java
1 package net.sourceforge.phpdt.internal.compiler.ast;
2
3 import net.sourceforge.phpdt.internal.compiler.ast.declarations.VariableUsage;
4
5 import java.util.List;
6 import java.util.ArrayList;
7
8 /**
9  * a php echo block.
10  * <?= someexpression ?>
11  * @author Matthieu Casanova
12  */
13 public class PHPEchoBlock extends AstNode {
14
15   /** the expression. */
16   public Expression expr;
17
18   /**
19    * Create a new php echo block.
20    * @param expr the expression
21    * @param sourceStart the starting offset
22    * @param sourceEnd the ending offset
23    */
24   public PHPEchoBlock(final Expression expr,
25                       final int sourceStart,
26                       final int sourceEnd) {
27     super(sourceStart, sourceEnd);
28     this.expr = expr;
29   }
30
31   /**
32    * Return the object into String.
33    * @param tab how many tabs (not used here
34    * @return a String
35    */
36   public String toString(final int tab) {
37     final String tabs = tabString(tab);
38     final String expression = expr.toStringExpression();
39     final StringBuffer buff = new StringBuffer(tabs.length() +
40                                                expression.length() +
41                                                5);
42     buff.append(tabs);
43     buff.append("<?=");//$NON-NLS-1$
44     buff.append(expression);
45     buff.append("?>");//$NON-NLS-1$
46     return buff.toString();
47   }
48
49   /**
50    * Get the variables from outside (parameters, globals ...)
51    * @return an empty list
52    */
53   public List getOutsideVariable() {
54     return new ArrayList();
55   }
56
57   /**
58    * get the modified variables.
59    * @return an empty list
60    */
61   public List getModifiedVariable() {
62     return new ArrayList();
63   }
64
65   /**
66    * Get the variables used.
67    * @return the used variables are the used variables from the expression
68    */
69   public List getUsedVariable() {
70     return expr.getUsedVariable();
71   }
72 }