Beispiel #1
0
 protected override object ReallyDoEvaluate(Irony.Interpreter.ScriptThread thread)
 {
     foreach (var cn in TreeNode.ChildNodes)
     {
         (cn.AstNode as ShakespeareBaseAstNode).Evaluate(thread);
     }
     return(base.ReallyDoEvaluate(thread));
 }
        protected override object DoEvaluate(Irony.Interpreter.ScriptThread thread)
        {
            thread.CurrentNode = this;
            try
            {
                MtResult[] result = new MtResult[_args.Count];

                for (var i = 0; i < _args.Count; ++i)
                {
                    try
                    {
                        var subthread  = _args[i].NewScriptThread(thread);
                        var evalResult = _args[i].Evaluate(subthread);

                        if (evalResult == null)
                        {
                            throw new Exception(string.Format("_args[{0}].Evaluate evaluated to null!", i));
                        }

                        if (evalResult is MtResult)
                        {
                            result[i] = evalResult as MtResult;
                        }
                        else
                        {
                            // A function, wrap it!
                            result[i] = MtResult.CreateAndWrap(evalResult);
                        }

                        if (result[i] == null)
                        {
                            throw new Exception("Result is a non-MtResult!");
                        }
                    }
                    catch (Exception e)
                    {
                        throw new Exception(string.Format("There was a problem evaluating arg {0}", i), e);
                    }
                }

                return(result);
            }
            catch (Exception e)
            {
                throw new Exception("Error on MtArguments.DoEvaluate", e);
            }
            finally
            {
                //thread.CurrentNode = Parent;
            }
        }
Beispiel #3
0
 protected override object DoEvaluate(Irony.Interpreter.ScriptThread thread)
 {
     // PROLOG
     thread.CurrentNode = this;
     try
     {
         // Atoms are synchronous, and evaluate to MtObjects
         return(MtResult.CreateAndWrap(_value));
     }
     catch (Exception e)
     {
         throw new Exception("Exception on MtAtom.", e);
     }
     finally
     {
         // EPILOG
         //thread.CurrentNode = Parent;
     }
 }
Beispiel #4
0
 protected override object ReallyDoEvaluate(Irony.Interpreter.ScriptThread thread)
 {
     AstNode1.Evaluate(thread);
     AstNode2.Evaluate(thread);
     return(base.ReallyDoEvaluate(thread));
 }
 protected override object DoEvaluate(Irony.Interpreter.ScriptThread thread)
 {
     throw new Exception("MtArgListForDecl can't be evaluated!");
 }
Beispiel #6
0
 protected override object ReallyDoEvaluate(Irony.Interpreter.ScriptThread thread)
 {
     return(Value);
 }