示例#1
0
        public static string Expand(this Step.Interpreter.Step step, Module g)
        {
            string result = null;

            step.Try(TextBuffer.NewEmpty(),
                     new BindingEnvironment(g,
                                            new MethodCallFrame(null, null, new LogicVariable[0], null, null)),
                     (o, u, s, p) =>
            {
                result = o.AsString;
                return(true);
            },
                     null);
            return(result);
        }
示例#2
0
        internal static Step.Interpreter.Step Sequence(params object[] steps)
        {
            Step.Interpreter.Step next = null;
            for (var i = steps.Length - 1; i >= 0; i--)
            {
                var step = steps[i];
                switch (step)
                {
                case string[] tokens:
                    next = new EmitStep(tokens, next);
                    break;

                case object[] call:
                    next = new Call(call[0], call.Skip(1).ToArray(), next);
                    break;

                default:
                    throw new ArgumentException($"Unknown step argument in Step.Sequence: {step}");
                }
            }

            return(next);
        }
示例#3
0
 bool Succeeds(Step.Interpreter.Step s)
 {
     return(s.Try(TextBuffer.NewEmpty(), BindingEnvironment.NewEmpty(), (o, e, ds, p) => true, null));
 }
示例#4
0
 public static string Expand(this Step.Interpreter.Step step)
 {
     return(step.Expand(new Module("test")));
 }
示例#5
0
 private AssignmentStep(LocalVariableName localVariable, FunctionalExpression value, Step next)
     : base(next)
 {
     GlobalVariable = null;
     LocalVariable  = localVariable;
     Value          = value;
 }