00001: package clogs.ast;
00002: 
00003: import clogs.util.Optional;
00004: 
00005: 
00006: public class ExpUnOp extends Exp
00007: {
00008:   public enum UnOp { 
00009:     MINUS ("-"), 
00010:     BANG ("!");
00011: 
00012:     final String string;
00013: 
00014:     UnOp (String string) 
00015:     {
00016:       this.string = string;
00017:     }
00018: 
00019:     public String toString ()
00020:     {
00021:       return string;
00022:     }
00023:   };
00024: 
00025:   public final UnOp op;
00026:   public final Exp exp;
00027: 
00028: 
00029:   public ExpUnOp (UnOp op, Exp exp)
00030:   {
00031:     this (new Optional<Type> (), op, exp);
00032:   }
00033: 
00034: 
00035:   ExpUnOp (Optional<Type> to, UnOp op, Exp exp)
00036:   {
00037:     super (to);
00038:     clogs.util.NonNull.check (op, exp);
00039:     this.op = op;
00040:     this.exp = exp;
00041:   }
00042: 
00043: 
00044:   public Exp setType (Type type)
00045:   {
00046:     return new ExpUnOp (new Optional<Type> (type), op, exp);
00047:   }
00048: }
00049: