Exemplo n.º 1
0
 public override void checkIsPercent(CheckingContext context)
 {
     operand.checkIsPercent(context);
 }
Exemplo n.º 2
0
 public override void checkIsPercent(CheckingContext context)
 {
 }
Exemplo n.º 3
0
 public override void checkIsBoolean(CheckingContext context)
 {
     throw operator_.parseThing.createError("cannot evaluate '" + operator_.text + operand.ToString() + "' as a conditional expression");
 }
Exemplo n.º 4
0
 public override void checkIsBoolean(CheckingContext context)
 {
     CheckingContext.throwNotABooleanError(value);
 }
Exemplo n.º 5
0
 public override void checkIsInt(CheckingContext context)
 {
     CheckingContext.throwNotAnIntError(value);
 }
Exemplo n.º 6
0
 public override void checkIsInt(CheckingContext context)
 {
     context.checkIsInt(token);
 }
Exemplo n.º 7
0
 public override void checkIsPercent(CheckingContext context)
 {
     CheckingContext.throwNotAPercentError(token);
 }
Exemplo n.º 8
0
 public override void checkIsPercent(CheckingContext context)
 {
     condition.checkIsBoolean(context);
     thenPart.checkIsPercent(context);
     operand.checkIsPercent(context);
 }
Exemplo n.º 9
0
 public override void checkIsBoolean(CheckingContext context)
 {
     context.checkIsBoolean(token);
 }
Exemplo n.º 10
0
 public override void checkIsBoolean(CheckingContext context)
 {
 }
Exemplo n.º 11
0
 public override void checkIsPercent(CheckingContext context)
 {
     // this is really tricky
     if (operator_.text != "*")
         throw operator_.parseThing.createError("operator '" + operator_.text + "' does not produce a percent");
     if (left.usedNames().Contains("level"))
     {
         left.checkIsInt(context);
         right.checkIsPercent(context);
     }
     else if (right.usedNames().Contains("level"))
     {
         left.checkIsPercent(context);
         right.checkIsInt(context);
     }
     else
     {
         throw operator_.parseThing.createError("multiplication can only produce a percent by multiplying a percent by something with 'level' in it");
     }
 }
Exemplo n.º 12
0
 public override void checkIsInt(CheckingContext context)
 {
     switch (operator_.text)
     {
         case "*":
         case "+":
         case "-":
             left.checkIsInt(context);
             right.checkIsInt(context);
             return;
         case "/":
             left.checkIsInt(context);
             if (!(right is IntLiteral))
                 throw operator_.parseThing.createError("denominator must be a literal integer, not '" + left.ToString() + "'");
             if (((IntLiteral)right).value.value == 0)
                 throw operator_.parseThing.createError("divide by 0");
             return;
     }
     throw operator_.parseThing.createError("operator '" + operator_.text + "' does not produce an integer");
 }
Exemplo n.º 13
0
 public override void checkIsBoolean(CheckingContext context)
 {
     switch (operator_.text)
     {
         case "<=":
         case "<":
         case ">=":
         case ">":
             left.checkIsInt(context);
             right.checkIsInt(context);
             return;
         case "AND":
         case "OR":
             left.checkIsBoolean(context);
             right.checkIsBoolean(context);
             return;
     }
     throw operator_.parseThing.createError("operator '" + operator_.text + "' does not produce a conditional expresion");
 }
Exemplo n.º 14
0
 public virtual void checkIsPercent(CheckingContext context)
 {
     throw new NotImplementedException();
 }