public object Visit(ASTVarNode node, object data) { Variable var = node.Var; if (var == null) { throw new EvaluationException("var was null in StandardEvaluator"); } object item = var.Value; if (this._trapNullValues && (item == null)) { throw new EvaluationException("Could not evaluate " + node.GetName() + ": no value set for the variable."); } if (this._trapNaN && (((item is double) && double.IsNaN((double)item)) || ((item is float) && float.IsNaN((float)item)))) { throw new EvaluationException("NaN value detected for variable " + node.GetName()); } if (this._trapInfinity && (((item is double) && double.IsInfinity((double)item)) || ((item is float) && float.IsInfinity((float)item)))) { throw new EvaluationException("Infinite value " + item.ToString() + "detected for variable " + node.GetName()); } this.stack.Push(item); return(data); }
protected double VisitVariable(ASTVarNode node) { object o = node.Var.Value; if (o == null) { throw new EvaluationException("Variable " + node.GetName() + " has a null value"); } return(FromObject(o)); }
public virtual object Visit(ASTVarNode node, object data) { this.sb.Append(node.GetName()); return(data); }