1 package polyglot.ast; 2 3 import polyglot.util.Enum; 4 5 9 public interface Unary extends Expr 10 { 11 12 public static class Operator extends Enum { 13 boolean prefix; 14 String name; 15 16 public Operator(String name, boolean prefix) { 17 super(name + (prefix ? "" : "post")); 18 this.name = name; 19 this.prefix = prefix; 20 } 21 22 24 public boolean isPrefix() { return prefix; } 25 26 public String toString() { return name; } 27 } 28 29 public static final Operator BIT_NOT = new Operator("~", true); 30 public static final Operator NEG = new Operator("-", true); 31 public static final Operator POST_INC = new Operator("++", false); 32 public static final Operator POST_DEC = new Operator("--", false); 33 public static final Operator PRE_INC = new Operator("++", true); 34 public static final Operator PRE_DEC = new Operator("--", true); 35 public static final Operator POS = new Operator("+", true); 36 public static final Operator NOT = new Operator("!", true); 37 38 39 Expr expr(); 40 41 Unary expr(Expr e); 42 43 44 Operator operator(); 45 46 Unary operator(Operator o); 47 } 48 | Popular Tags |