PopTask() public method

public PopTask ( ) : Continuation
return Continuation
Esempio n. 1
0
 public Datum Evaluate(Continuation c)
 {
     try
     {
         while (c.Task != null)
         {
             if (debug)
             {
                 Console.WriteLine("{0}", c.GetStackTrace());
                 Console.Write("Press enter for next step.");
                 Console.ReadLine();
             }
             c = c.Task.Perform(c.PopTask());
         }
         c = c.PopTask();
         var result = c.Result;
         c = c.PopResult();
         if (c.Result != null)
             throw new Exception(string.Format("Additional '{0}' on result stack", c.Result));
         return result;
     }
     catch (EvaluationException)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw c.error(ex, "EvaluationError", ex.Message);
     }
 }
Esempio n. 2
0
 public Datum Evaluate(Continuation c)
 {
     try
     {
         while (c.Task != null)
         {
             if (debug)
             {
                 Console.WriteLine("{0}", c.GetStackTrace());
                 Console.Write("Press enter for next step.");
                 Console.ReadLine();
             }
             c = c.Task.Perform(c.PopTask());
         }
         c = c.PopTask();
         var result = c.Result;
         c = c.PopResult();
         if (c.Result != null)
         {
             throw new Exception(string.Format("Additional '{0}' on result stack", c.Result));
         }
         return(result);
     }
     catch (EvaluationException)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw c.error(ex, "EvaluationError", ex.Message);
     }
 }
Esempio n. 3
0
 private static void dumpTasks(Continuation c, TextWriter sw)
 {
     sw.WriteLine("Tasks:");
     while (c.Task != null)
     {
         sw.WriteLine("{0}", c.Task);
         c = c.PopTask();
     }
 }
Esempio n. 4
0
        // The following are useful for debugging.
        public static IEnvironment GetEnvironment(this Continuation c)
        {
            EvaluateTask t = null;

            while (c.Task != null && (t = c.Task as EvaluateTask) == null)
            {
                c = c.PopTask();
            }
            return(t == null ? null : t.Env);
        }
Esempio n. 5
0
 private static Datum Evaluate(Continuation c)
 {
     while (c.Task != null)
     {
         try
         {
             c = c.Task.Perform(c.PopTask());
             c.Statistics.Steps++;
         }
         catch (Exception ex)
         {
             c = c.ErrorHandler(c, ex);
         }
     }
     return(c.Result);
 }
Esempio n. 6
0
 private static Datum Evaluate(Continuation c)
 {
     while (c.Task != null)
     {
         try
         {
             c = c.Task.Perform(c.PopTask());
             c.Statistics.Steps++;
         }
         catch (Exception ex)
         {
             c = c.ErrorHandler(c, ex);
         }
     }
     return c.Result;
 }
Esempio n. 7
0
 private static void dumpTasks(Continuation c, TextWriter sw)
 {
     sw.WriteLine("Tasks:");
     while (c.Task != null)
     {
         sw.WriteLine("{0}", c.Task);
         c = c.PopTask();
     }
 }