Exemple #1
0
        public void EvalBlock(RCRunner runner, RCClosure closure, RCTemplate right)
        {
            RCBlock result = RCBlock.Empty;

            for (int i = 0; i < right.Count - 1; ++i)
            {
                RCBlock current = right.GetName(i);
                result = new RCBlock(result, current.Name, current.Evaluator, current.Value);
            }
            runner.Yield(closure, result);
        }
Exemple #2
0
        public override RCClosure Handle(RCRunner runner,
                                         RCClosure closure,
                                         Exception exception,
                                         long status,
                                         out RCValue result)
        {
            // When the runner finds out about an exception it will try to call this
            // Handle method on all of the parents in the stack until it gets to
            // one that returns a closure to eval next.
            RCBlock     wrapper = new RCBlock("status", ":", new RCLong(status));
            RCException rcex    = exception as RCException;
            string      message;

            if (rcex != null)
            {
                if (RCSystem.Args.OutputEnum == RCOutput.Test)
                {
                    message = rcex.ToTestString();
                }
                else
                {
                    message = rcex.ToString();
                }
            }
            else
            {
                message = exception.Message;
            }
            RCBlock report      = new RCBlock("", ":", new RCString(message + "\n"));
            int     escapeCount = RCTemplate.CalculateReportTemplateEscapeLevel(message);

            if (RCSystem.Args.OutputEnum == RCOutput.Test)
            {
                wrapper = new RCBlock(wrapper, "data", ":", new RCTemplate(report, escapeCount, true));
            }
            else
            {
                wrapper = new RCBlock(wrapper, "data", ":", new RCTemplate(report, escapeCount, true));
            }
            result = wrapper;
            return(base.Next(runner, closure, closure, result));
        }
Exemple #3
0
 public void EvalCount(RCRunner runner, RCClosure closure, RCTemplate right)
 {
     runner.Yield(closure, new RCLong(right.Count));
 }
Exemple #4
0
 public void EvalEach(RCRunner runner, RCClosure closure, RCTemplate left, RCBlock right)
 {
     EvalEach(runner, closure, (RCBlock)left, right);
 }