--- /dev/null
+package net.sourceforge.phpdt.internal.compiler.ast;
+
+/**
+ * @author Matthieu Casanova
+ */
+public class VarAssignation extends Expression {
+
+ public static final int EQUAL = 0;
+ public static final int PLUS_EQUAL = 1;
+ public static final int MINUS_EQUAL = 2;
+ public static final int STAR_EQUAL = 3;
+ public static final int SLASH_EQUAL = 4;
+ public static final int AND_EQUAL = 5;
+ public static final int OR_EQUAL = 6;
+ public static final int XOR_EQUAL = 7;
+ public static final int DOT_EQUAL = 8;
+ public static final int REM_EQUAL = 9;
+ public static final int TILDE_EQUAL = 10;
+ public static final int LSHIFT_EQUAL = 11;
+ public static final int RSIGNEDSHIFT_EQUAL = 12;
+
+ public char[] variable;
+ public Expression expression;
+ public int operator;
+
+
+ public VarAssignation(char[] variable,
+ Expression expression,
+ int operator,
+ int sourceStart,
+ int sourceEnd) {
+ super(sourceStart, sourceEnd);
+ this.variable = variable;
+ this.expression = expression;
+ this.operator = operator;
+ }
+
+ public String operatorToString() {
+ switch (operator) {
+ case EQUAL:
+ return "="; //$NON-NLS-1$
+ case PLUS_EQUAL:
+ return "+="; //$NON-NLS-1$
+ case MINUS_EQUAL:
+ return "-="; //$NON-NLS-1$
+ case STAR_EQUAL:
+ return "*="; //$NON-NLS-1$
+ case SLASH_EQUAL:
+ return "/="; //$NON-NLS-1$
+ case AND_EQUAL:
+ return "<="; //$NON-NLS-1$
+ case OR_EQUAL:
+ return "|=";//$NON-NLS-1$
+ case XOR_EQUAL:
+ return "^=";//$NON-NLS-1$
+ case DOT_EQUAL:
+ return ".="; //$NON-NLS-1$
+ case REM_EQUAL:
+ return "%="; //$NON-NLS-1$
+ case TILDE_EQUAL:
+ return " ="; //$NON-NLS-1$
+ case LSHIFT_EQUAL:
+ return "<<="; //$NON-NLS-1$
+ case RSIGNEDSHIFT_EQUAL:
+ return ">>="; //$NON-NLS-1$
+ }
+ return " unknown operator ";
+ }
+
+ /**
+ * Return the expression as String.
+ * @return the expression
+ */
+ public String toStringExpression() {
+ final StringBuffer buff = new StringBuffer();
+ buff.append(variable);
+ buff.append(' ');
+ buff.append(operatorToString());
+ buff.append(' ');
+ buff.append(expression.toStringExpression());
+ return buff.toString();
+ }
+}