Example #1
0
 public Constant(int constant)
 {
     type = 2;
     @bool = false;
     number = LNumber.makeInteger(constant);
     @string = null;
 }
Example #2
0
 public Constant(LObject constant)
 {
     if(constant is LNil)
     {
       type = 0;
       @bool = false;
       number = null;
       @string = null;
     }
     else if(constant is LBoolean)
     {
       type = 1;
       @bool = constant == LBoolean.LTRUE;
       number = null;
       @string = null;
     }
     else if(constant is LNumber)
     {
       type = 2;
       @bool = false;
       number = (LNumber) constant;
       @string = null;
     }
     else if(constant is LString)
     {
       type = 3;
       @bool = false;
       number = null;
       @string = ((LString) constant).deref();
     }
     else if(constant == null)
     {
     throw new Exception("Constant is null!");
     }
     else
     {
       throw new Exception("Illegal constant type: " + constant.ToString());
     }
 }