public override ReturnValue Value(Binding b) { try { return b.ValueFor(name); } catch (KeyNotFoundException /* unused */) { return new ReturnValue(); } }
public override ReturnValue Value(Binding b) { if (expr != null) { if (b.Set (name, expr)) { ReturnValue ret = expr.Value (b); return new ReturnValue (name + " = " + ret); } else { return new ReturnValue (name + " = " + b.ValueFor (name)); } } return new ReturnValue (name + " = undefined"); }
public override ReturnValue Value(Binding binding) { ReturnValue ra = a.Value(binding); ReturnValue rb = b.Value(binding); if (!ra.Defined() || !rb.Defined()) { return new ReturnValue(); } if (op == '+') { return new ReturnValue(ra.Value() + rb.Value()); } else if (op == '-') { return new ReturnValue(ra.Value() - rb.Value()); } else if (op == '*') { return new ReturnValue(ra.Value() * rb.Value()); } else if (op == '/') { return new ReturnValue(ra.Value() / rb.Value()); } else { throw new ParserException("Unknown operator: " + op); } }
public abstract ReturnValue Value(Binding b);
public override ReturnValue Value(Binding b) { return new ReturnValue(val); }
public Calculator(Binding b) { this.binding = b; }