public override dynamic ValueEval(Dictionary<string, dynamic> local, ScriptRunner runner) { dynamic d; if (local.TryGetValue(name, out d)) return d; if (runner.Global.TryGetValue(name, out d)) return d; throw new InnerException(data.ExceptionMessage(string.Format("value name '{0}' is not defined.", name))); }
public override dynamic Run(Dictionary<string, dynamic> local, ScriptRunner runner) { foreach(var s in sentences) { var r = s.Run(local, runner); if (r != null) return r; } return null; }
public override IEnumerable<dynamic> CoRoutineRun(Dictionary<string, dynamic> local, ScriptRunner runner) { dynamic v = null; foreach(var s in sentences) { foreach(var r in s.CoRoutineRun(local, runner)) { v = r; if (YieldReturn.IsYieldValue(r)) { yield return r; } else if(r!=null) { goto end; } } } v = null; end: yield return v; }
public override IEnumerable<dynamic> CoRoutineRun(Dictionary<string, dynamic> local, ScriptRunner runner) { dynamic v = null; foreach (var t in sentences) { bool c; try { c = t.Item1.ValueEval(local, runner); } catch (Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } if (c) { foreach(var r in t.Item2.CoRoutineRun(local, runner)) { if (YieldReturn.IsYieldValue(r)) { yield return r; } else if (r != null) { v = r; goto end; } } } } if (else_sentence != null) { foreach (var r in else_sentence.CoRoutineRun(local,runner)) { if (YieldReturn.IsYieldValue(r)) { yield return r.Value; } else if (r != null) { v = r; goto end; } } } v = null; end: yield return v; }
public override dynamic Run(Dictionary<string, dynamic> local, ScriptRunner runner) { foreach(var t in sentences) { bool c; try { c = t.Item1.ValueEval(local, runner); } catch(Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } if (c) return t.Item2.Run(local, runner); } if (else_sentence != null) return else_sentence.Run(local, runner); return null; }
public override dynamic StaticEval(ScriptRunner runner) { return value; }
public override IEnumerable<dynamic> CoRoutineRun(Dictionary<string, dynamic> local, ScriptRunner runner) { dynamic v = null; if (local.ContainsKey(name)) throw new InnerException(data.ExceptionMessage(string.Format("counter value name '{0}' have been be defined.", name))); foreach (var r in expr.ValueEval(local, runner)) { local[name] = r; foreach(var u in sentence.CoRoutineRun(local, runner)) { if (YieldReturn.IsYieldValue(u)) { yield return u; } else if (u != null) { v = u; goto end; } } } v = null; end: local.Remove(name); yield return v; }
public override dynamic Run(Dictionary<string, dynamic> local, ScriptRunner runner) { throw new InnerException(data.ExceptionMessage("yield_return in normal calling is not allowed")); }
public override dynamic Run(Dictionary<string, dynamic> local, ScriptRunner runner) { return expr.ValueEval(local, runner); }
public override dynamic Run(Dictionary<string, dynamic> local, ScriptRunner runner) { runner.Global[name] = expr.ValueEval(local, runner); return null; }
public abstract dynamic Run(Dictionary<string, dynamic> local, ScriptRunner runner);
public override dynamic StaticEval(ScriptRunner runner) { var d = (from e in exprs select e.StaticEval(runner)).ToArray(); return d.Contains(null) ? null : func.StaticCall(d, data); }
public override dynamic ValueEval(Dictionary<string, dynamic> local, ScriptRunner runner) { return func.Call((from e in exprs select e.ValueEval(local, runner)).ToArray(), data); }
public override dynamic StaticEval(ScriptRunner runner) { dynamic d; return runner.ConstantValue.TryGetValue(name, out d) ? d : null; }
public abstract dynamic StaticEval(ScriptRunner runner);
public override IEnumerable<dynamic> CoRoutineRun(Dictionary<string, dynamic> local, ScriptRunner runner) { local[name] = expr.ValueEval(local, runner); yield return null; }
public abstract IEnumerable<dynamic> CoRoutineRun(Dictionary<string, dynamic> local, ScriptRunner runner);
public override IEnumerable<dynamic> CoRoutineRun(Dictionary<string, dynamic> local, ScriptRunner runner) { throw new NotImplementedException(); }
public override IEnumerable<dynamic> CoRoutineRun(Dictionary<string, dynamic> local, ScriptRunner runner) { if (local.ContainsKey(name)) throw new InnerException(data.ExceptionMessage(string.Format("counter value name '{0}' have been be defined.", name))); var las = last.ValueEval(local, runner); var ste = step.ValueEval(local, runner); bool c; dynamic v = null; local[name] = first.ValueEval(local, runner); try { c = (local[name] != las); } catch (Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } while (c) { foreach (var r in source.CoRoutineRun(local, runner)) { if (YieldReturn.IsYieldValue(r)) { yield return r; } else if (r != null) { v = r; goto end; } } try { local[name] = local[name] + ste; c = (local[name] != las); } catch (Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } } foreach(var r in source.CoRoutineRun(local, runner)) { if (YieldReturn.IsYieldValue(r)) yield return r; else if (r != null) { v = r; goto end; } } v = null; end: local.Remove(name); yield return v; }
public override IEnumerable<dynamic> CoRoutineRun(Dictionary<string, dynamic> local, ScriptRunner runner) { yield return new YieldValue(expr.ValueEval(local, runner)); }
public override dynamic Run(Dictionary<string, dynamic> local, ScriptRunner runner) { bool c; try { c = cond.ValueEval(local, runner); } catch(Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } while (c) { var r = source.Run(local, runner); if (r != null) return r; try { c = cond.ValueEval(local, runner); } catch (Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } } return null; }
public override dynamic Run(Dictionary<string, dynamic> local, ScriptRunner runner) { if (local.ContainsKey(name)) throw new InnerException(data.ExceptionMessage(string.Format("counter value name '{0}' have been be defined.", name))); foreach (var r in expr.ValueEval(local, runner)) { local[name] = YieldReturn.RemoveYield(r); var v = sentence.Run(local, runner); if (v != null) return v; } local.Remove(name); return null; }
public override IEnumerable<dynamic> CoRoutineRun(Dictionary<string, dynamic> local, ScriptRunner runner) { bool c; dynamic v = null; try { c = cond.ValueEval(local, runner); } catch (Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } while (c) { foreach (var r in source.CoRoutineRun(local, runner)) { if(YieldReturn.IsYieldValue(r)) { yield return r; } else if (r != null) { v = r; goto end; } try { c = cond.ValueEval(local, runner); } catch (Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } } } v = null; end: yield return v; }
public override dynamic Run(Dictionary<string, dynamic> local, ScriptRunner runner) { if (local.ContainsKey(name)) throw new InnerException(data.ExceptionMessage(string.Format("counter value name '{0}' have been be defined.", name))); var las = last.ValueEval(local, runner); var ste = step.ValueEval(local, runner); bool c; local[name] = first.ValueEval(local, runner); try { c = (local[name] != las); } catch (Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } while (c) { var r = source.Run(local, runner); if (r != null) return r; try { local[name] = local[name] + ste; c = (local[name] != las); } catch (Exception) { throw new InnerException(data.ExceptionMessage("dynamic type error.")); } } source.Run(local, runner); local.Remove(name); return null; }
public override dynamic ValueEval(Dictionary<string, dynamic> local, ScriptRunner runner) { return value; }