1 package polyglot.ast; 2 3 import polyglot.util.Enum; 4 5 9 public interface Binary extends Expr 10 { 11 12 public static class Operator extends Enum { 13 Precedence prec; 14 15 public Operator(String name, Precedence prec) { 16 super(name); 17 this.prec = prec; 18 } 19 20 21 public Precedence precedence() { return prec; } 22 } 23 24 public static final Operator GT = new Operator(">", Precedence.RELATIONAL); 25 public static final Operator LT = new Operator("<", Precedence.RELATIONAL); 26 public static final Operator EQ = new Operator("==", Precedence.EQUAL); 27 public static final Operator LE = new Operator("<=", Precedence.RELATIONAL); 28 public static final Operator GE = new Operator(">=", Precedence.RELATIONAL); 29 public static final Operator NE = new Operator("!=", Precedence.EQUAL); 30 public static final Operator COND_OR = new Operator("||", Precedence.COND_OR); 31 public static final Operator COND_AND = new Operator("&&", Precedence.COND_AND); 32 public static final Operator ADD = new Operator("+", Precedence.ADD); 33 public static final Operator SUB = new Operator("-", Precedence.ADD); 34 public static final Operator MUL = new Operator("*", Precedence.MUL); 35 public static final Operator DIV = new Operator("/", Precedence.MUL); 36 public static final Operator MOD = new Operator("%", Precedence.MUL); 37 public static final Operator BIT_OR = new Operator("|", Precedence.BIT_OR); 38 public static final Operator BIT_AND = new Operator("&", Precedence.BIT_AND); 39 public static final Operator BIT_XOR = new Operator("^", Precedence.BIT_XOR); 40 public static final Operator SHL = new Operator("<<", Precedence.SHIFT); 41 public static final Operator SHR = new Operator(">>", Precedence.SHIFT); 42 public static final Operator USHR = new Operator(">>>", Precedence.SHIFT); 43 44 47 Expr left(); 48 49 52 Binary left(Expr left); 53 54 57 Operator operator(); 58 59 62 Binary operator(Operator op); 63 64 67 Expr right(); 68 69 72 Binary right(Expr right); 73 74 78 boolean throwsArithmeticException(); 79 80 83 Binary precedence(Precedence precedence); 84 } 85 | Popular Tags |