3 public class AssignOperation {
4 public static final int EQ=1;
5 public static final int MULTEQ=2;
6 public static final int DIVEQ=3;
7 public static final int MODEQ=4;
8 public static final int PLUSEQ=5;
9 public static final int MINUSEQ=6;
10 public static final int LSHIFTEQ=7;
11 public static final int RSHIFTEQ=8;
12 public static final int URSHIFTEQ=9;
13 public static final int ANDEQ=10;
14 public static final int XOREQ=11;
15 public static final int OREQ=12;
16 public static final int POSTINC=13;
17 public static final int POSTDEC=14;
19 private int operation;
20 public AssignOperation(int op) {
24 public AssignOperation(String op) {
25 this.operation=parseOp(op);
32 public Operation getBaseOp() {
38 return new Operation(Operation.MULT);
41 return new Operation(Operation.DIV);
44 return new Operation(Operation.MOD);
47 return new Operation(Operation.ADD);
50 return new Operation(Operation.SUB);
53 return new Operation(Operation.LEFTSHIFT);
56 return new Operation(Operation.RIGHTSHIFT);
59 return new Operation(Operation.URIGHTSHIFT);
62 return new Operation(Operation.BIT_AND);
65 return new Operation(Operation.BIT_XOR);
68 return new Operation(Operation.BIT_OR);
71 return new Operation(Operation.POSTINC);
74 return new Operation(Operation.POSTDEC);
79 public static int parseOp(String st) {
82 else if (st.equals("multeq"))
84 else if (st.equals("diveq"))
86 else if (st.equals("modeq"))
88 else if (st.equals("pluseq"))
90 else if (st.equals("minuseq"))
92 else if (st.equals("lshifteq"))
94 else if (st.equals("urshifteq"))
96 else if (st.equals("rshifteq"))
98 else if (st.equals("andeq"))
100 else if (st.equals("xoreq"))
102 else if (st.equals("oreq"))
104 else if (st.equals("postinc"))
106 else if (st.equals("postdec"))
108 else throw new Error();
111 public String toString() {
114 else if (operation==MULTEQ)
116 else if (operation==DIVEQ)
118 else if (operation==MODEQ)
120 else if (operation==PLUSEQ)
122 else if (operation==MINUSEQ)
124 else if (operation==LSHIFTEQ)
126 else if (operation==RSHIFTEQ)
128 else if (operation==RSHIFTEQ)
130 else if (operation==ANDEQ)
132 else if (operation==XOREQ)
134 else if (operation==OREQ)
136 else if (operation==POSTINC)
138 else if (operation==POSTDEC)
140 else throw new Error();