public override void Eval(Program program) { object retVal = expression.Eval(program); program.SetRetVal(retVal); program.Return(); }
public override void Eval(Program program) { while ((bool)check.Eval(program)) { statements.Eval(program); } }
public override void Eval(Program program) { bool b = (bool)check.Eval(program); if (b) { statements.Eval(program); } else { foreach (var stmnt in elseifs) { if ((bool)stmnt.check.Eval(program)) { stmnt.statements.Eval(program); return; } } if (elseStatements != null) { elseStatements.Eval(program); } } }
public override void Eval(Program program) { object value = expression.Eval(program); if (indexers.Count == 0) { program.SetVar(varName, value); } else { object cur = program.GetVar(varName); for (int i = 0; i < indexers.Count; i++) { int index = (int)indexers[i].Eval(program); if (cur is object[]) { object[] array = (object[])cur; if (i == indexers.Count - 1) { array[index] = value; } else { cur = array[index]; } } else if (cur is List <object> ) { List <object> array = (List <object>)cur; if (i == indexers.Count - 1) { array[index] = value; } else { cur = array[index]; } } } } //Debug.Log("Setting var '" + varName + "' to " + value); }
public override object Eval(Program program) { object baseObj = baseExpr.Eval(program); object index = indexExpr.Eval(program); if (baseObj is object[]) { object[] array = (object[])baseObj; return(array[(int)index]); } else if (baseObj is List <object> ) { List <object> array = (List <object>)baseObj; return(array[(int)index]); } return(null); }
public override object Eval(Program program) { object lhs = left.Eval(program); object rhs = right.Eval(program); if (lhs.GetType() == typeof(string) || rhs.GetType() == typeof(string)) { return(EvalString(lhs.ToString(), rhs.ToString())); } if (lhs.GetType() == typeof(int)) { return(EvalInt((int)lhs, (int)rhs)); } if (lhs.GetType() == typeof(bool)) { return(EvalBool((bool)lhs, (bool)rhs)); } return(null); }