/// Evaluate the operation against stack public void Eval(IEvaluationContext context, Stack <object> stack) { string name = null; foreach (var option in _options) { object z; if (option.Name != null) { name = option.Name; if (context.TryGetValue(option.Name, out z)) { stack.Push(z); return; } } else if (option.Expression != null) { option.Expression.Eval(context, stack); return; } else { stack.Push(option.Value); return; } } throw new KeyNotFoundException("Variable '" + name + "' is undefined"); }
/// Evaluate the operation against stack public void Eval(IEvaluationContext context, Stack<object> stack) { string name = null; foreach (var option in _options) { object z; if (option.Name != null) { name = option.Name; if (context.TryGetValue(option.Name, out z)) { stack.Push(z); return; } } else if (option.Expression != null) { option.Expression.Eval(context, stack); return; } else { stack.Push(option.Value); return; } } throw new KeyNotFoundException("Variable '"+name+"' is undefined"); }