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);
28 public Operation getBaseOp() {
33 return new Operation(Operation.MULT);
35 return new Operation(Operation.DIV);
37 return new Operation(Operation.MOD);
39 return new Operation(Operation.ADD);
41 return new Operation(Operation.SUB);
43 return new Operation(Operation.LEFTSHIFT);
45 return new Operation(Operation.RIGHTSHIFT);
47 return new Operation(Operation.BIT_AND);
49 return new Operation(Operation.BIT_XOR);
51 return new Operation(Operation.BIT_OR);
53 return new Operation(Operation.POSTINC);
55 return new Operation(Operation.POSTDEC);
60 public static int parseOp(String st) {
63 else if (st.equals("multeq"))
65 else if (st.equals("diveq"))
67 else if (st.equals("modeq"))
69 else if (st.equals("pluseq"))
71 else if (st.equals("minuseq"))
73 else if (st.equals("lshifteq"))
75 else if (st.equals("rshifteq"))
77 else if (st.equals("andeq"))
79 else if (st.equals("xoreq"))
81 else if (st.equals("oreq"))
83 else if (st.equals("postinc"))
85 else if (st.equals("postdec"))
87 else throw new Error();
90 public String toString() {
93 else if (operation==MULTEQ)
95 else if (operation==DIVEQ)
97 else if (operation==MODEQ)
99 else if (operation==PLUSEQ)
101 else if (operation==MINUSEQ)
103 else if (operation==LSHIFTEQ)
105 else if (operation==RSHIFTEQ)
107 else if (operation==ANDEQ)
109 else if (operation==XOREQ)
111 else if (operation==OREQ)
113 else if (operation==POSTINC)
115 else if (operation==POSTDEC)
117 else throw new Error();