Ejemplo n.º 1
0
 protected virtual void OnBeforeEval(BeforeEvalEventArgs args)
 {
     EventHandler<BeforeEvalEventArgs> handler = BeforeEval;
     if (handler != null)
         handler(this, args);
 }
Ejemplo n.º 2
0
        //.........................................................................
        public virtual object Eval(object o)
        {
            object result = null;
            BeforeEvalEventArgs args = new BeforeEvalEventArgs(o);
            OnBeforeEval(args);
            if (!args.Cancel && args.Eval != null) {
                Exception e = null;
                try {
                    result = Interpreter.Eval(args.Eval);
                    Debug(result);
                } catch (Exception ex) {
                    e = ex;
                    Debug(FormatException(ex));
                    if (result == null)
                        result = ex;
                }
                AfterEvalEventArgs args2 = new AfterEvalEventArgs(args.Eval, result, e);
                OnAfterEval(args2);
                /*if (e != null && !(e is LispException) && !args2.ExceptionHandled)
                    throw e;*/
            }

            return result;
        }