1 package net.sourceforge.phpdt.internal.compiler.ast;
4 * @author Matthieu Casanova
6 public class VarAssignation extends Expression {
8 public static final int EQUAL = 0;
9 public static final int PLUS_EQUAL = 1;
10 public static final int MINUS_EQUAL = 2;
11 public static final int STAR_EQUAL = 3;
12 public static final int SLASH_EQUAL = 4;
13 public static final int AND_EQUAL = 5;
14 public static final int OR_EQUAL = 6;
15 public static final int XOR_EQUAL = 7;
16 public static final int DOT_EQUAL = 8;
17 public static final int REM_EQUAL = 9;
18 public static final int TILDE_EQUAL = 10;
19 public static final int LSHIFT_EQUAL = 11;
20 public static final int RSIGNEDSHIFT_EQUAL = 12;
22 public char[] variable;
23 public Expression expression;
27 public VarAssignation(char[] variable,
28 Expression expression,
32 super(sourceStart, sourceEnd);
33 this.variable = variable;
34 this.expression = expression;
35 this.operator = operator;
38 public String operatorToString() {
41 return "="; //$NON-NLS-1$
43 return "+="; //$NON-NLS-1$
45 return "-="; //$NON-NLS-1$
47 return "*="; //$NON-NLS-1$
49 return "/="; //$NON-NLS-1$
51 return "<="; //$NON-NLS-1$
53 return "|=";//$NON-NLS-1$
55 return "^=";//$NON-NLS-1$
57 return ".="; //$NON-NLS-1$
59 return "%="; //$NON-NLS-1$
61 return " ="; //$NON-NLS-1$
63 return "<<="; //$NON-NLS-1$
64 case RSIGNEDSHIFT_EQUAL:
65 return ">>="; //$NON-NLS-1$
67 return " unknown operator ";
71 * Return the expression as String.
72 * @return the expression
74 public String toStringExpression() {
75 final StringBuffer buff = new StringBuffer();
76 buff.append(variable);
78 buff.append(operatorToString());
80 buff.append(expression.toStringExpression());
81 return buff.toString();