3.x RC1 compatibility
[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 java.util.List;
4
5 /**
6  * a php echo block.
7  * <?= someexpression ?>
8  * @author Matthieu Casanova
9  */
10 public final class PHPEchoBlock extends AstNode {
11
12   /** the expression. */
13   private final Expression expr;
14
15   /**
16    * Create a new php echo block.
17    * @param expr the expression
18    * @param sourceStart the starting offset
19    * @param sourceEnd the ending offset
20    */
21   public PHPEchoBlock(final Expression expr,
22                       final int sourceStart,
23                       final int sourceEnd) {
24     super(sourceStart, sourceEnd);
25     this.expr = expr;
26   }
27
28   /**
29    * Return the object into String.
30    * @param tab how many tabs (not used here
31    * @return a String
32    */
33   public String toString(final int tab) {
34     final String tabs = tabString(tab);
35     final String expression = expr.toStringExpression();
36     final StringBuffer buff = new StringBuffer(tabs.length() +
37                                                expression.length() +
38                                                5);
39     buff.append(tabs);
40     buff.append("<?=");//$NON-NLS-1$
41     buff.append(expression);
42     buff.append("?>");//$NON-NLS-1$
43     return buff.toString();
44   }
45
46   /**
47    * Get the variables from outside (parameters, globals ...)
48    *
49    * @param list the list where we will put variables
50    */
51   public void getOutsideVariable(final List list) {}
52
53   /**
54    * get the modified variables.
55    *
56    * @param list the list where we will put variables
57    */
58   public void getModifiedVariable(final List list) {}
59
60   /**
61    * Get the variables used.
62    *
63    * @param list the list where we will put variables
64    */
65   public void getUsedVariable(final List list) {
66     expr.getUsedVariable(list);
67   }
68 }