Beispiel #1
0
        public override B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
        {
            var t = prev as B.TearOne;

            return(t == null
                ? new B.PushNew(Name, Args, "")
                : new B.PushNew(Name, Args, $"{t.Name}.{t.Target}"));
        }
Beispiel #2
0
        public override B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
        {
            var a = new B.AwaitOne()
            {
                Name = B.SystemPlan.Dealias(Name), Target = target, Flag = TmpContext, ExtraFlag = ExtraContext
            };

            a.BaseAction = prev;
            return(a);
        }
Beispiel #3
0
 private void ProduceActions(Action <B.HandleAction> add)
 {
     if (Context.Count > 0 && (Context[0].RHS is A.AwaitAction || Context[0].RHS is A.AwaitStarAction || Context[0].RHS is A.PopHashAction))
     {
         int            limit = Context.Count - 1;
         B.HandleAction tear  = null;
         if (Context[limit].RHS is A.TearAction)
         {
             limit--;
             tear = Context[^ 1].RHS.ToHandleAction();
Beispiel #4
0
        public override B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
        {
            var a = new B.AwaitMany
            {
                Name       = B.SystemPlan.Dealias(Name),
                Target     = target,
                Flag       = TmpContext,
                BaseAction = prev
            };

            return(a);
        }
Beispiel #5
0
        public override B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
        {
            var t = prev as B.TearOne;

            if (t == null)
            {
                return(new B.PushNew(Name, Args, ""));
            }
            else
            {
                return(new B.PushNew(Name, Args, tearing: $"{t.Name}.{t.Target}"));
            }
        }
Beispiel #6
0
        public override B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
        {
            var a = new B.PopSeveral {
                Name = B.SystemPlan.Dealias(Name), Target = target
            };

            a.SiblingActions.Add(prev);
            if (prev is B.PopSeveral ps)
            {
                a.SiblingActions.AddRange(ps.SiblingActions);
            }
            return(a);
        }
Beispiel #7
0
        internal void ProduceActions(Action <B.HandleAction> add)
        {
            if (Context.Count > 0 && (Context[0].RHS is A.AwaitAction || Context[0].RHS is A.AwaitStarAction || Context[0].RHS is A.PopHashAction))
            {
                int            limit = Context.Count - 1;
                B.HandleAction tear  = null;
                if (Context[limit].RHS is A.TearAction)
                {
                    limit--;
                    tear = Context[Context.Count - 1].RHS.ToHandleAction();
                }

                // Asynchronously: schedule parsing
                B.HandleAction act = RHS.ToHandleAction(prev: tear);
                for (int i = limit; i >= 0; i--)
                {
                    act = Context[i].RHS.ToHandleAction(Context[i].LHS, act);
                }
                // add *one* action!
                add(act);
            }
            else if (RHS is A.WrapReaction)
            {
                if (Context.Count > 1 || !(Context[0].RHS is A.PopAction))
                {
                    Console.WriteLine($"[ERR] the WRAP reaction cannot handle multiple POPs at the moment. Future work!");
                }
                // add one composite action
                add(RHS.ToHandleAction(B.SystemPlan.Dealias((Context[0].RHS as A.PopAction).Name)));
            }
            else
            {
                // Synchronously: just get it from the stack one by one
                foreach (var ass in Context)
                {
                    add(ass.RHS.ToHandleAction(ass.LHS));
                }
                add(RHS.ToHandleAction());
            }
        }
Beispiel #8
0
 public override B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
 => new B.TrimStream()
 {
     Type = Name, Starred = Starred
 };
Beispiel #9
0
 public override B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
 => new B.LiftFlag
 {
     Flag = Flag
 };
Beispiel #10
0
 // NB: in this case the "target" argument is actually the type since we know the [intermediate] target from the call
 public override B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
 => new B.WrapOne(Name, target, Args[0]);
Beispiel #11
0
 public override B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
 => new B.PopOne()
 {
     Name = B.SystemPlan.Dealias(Name), Target = target
 };
Beispiel #12
0
 public virtual B.HandleAction ToHandleAction(string target = "", B.HandleAction prev = null)
 => null;