Exemple #1
0
 void Restriction(out ActionRestrictions ar)
 {
     ar = null; ChannelRestrictions res = new ChannelRestrictions();
     Expect(24);
     if (la.kind == 3)
     {
         Get();
         res.Add(t.val); SetPos(res, t); res.ParenCount = 0; ar = res;
     }
     else if (la.kind == 25)
     {
         Get();
         res.ParenCount = 1;
         Expect(3);
         res.Add(t.val); SetPos(res, t);
         while (la.kind == 11)
         {
             Get();
             Expect(3);
             res.Add(t.val);
         }
         Expect(26);
         ar = res;
     }
     else if (la.kind == 6)
     {
         Get();
         ar = new CustomRestrictions(t.val.Replace(":", "")); SetPos(ar, t);
     }
     else
     {
         SynErr(45);
     }
 }
Exemple #2
0
 public virtual string Format(ActionRestrictions res)
 {
     if (res.HasParens)
     {
         return(" \\{" + Join(", ", res) + '}');
     }
     else if (res.Count == 1 && !res.HasParens)
     {
         return(" \\" + res[0]);
     }
     else if (res.Count == 0)
     {
         return("");
     }
     else
     {
         throw new Exception("Should never happen!");
     }
 }
Exemple #3
0
        void ActionPrefix(out Process proc)
        {
            ActionPrefix ap = null; ActionPrefix prev = null; ActionPrefix first = null; Process nextProc = null; ProcessConstant pc; proc = null; Action act = null;

            while (la.kind == 3 || la.kind == 5 || la.kind == 6)
            {
                Token startAction = la;
                Action(out act);
                ap = new ActionPrefix(act, null); SetStartPos(ap, startAction); if (first == null)
                {
                    first = ap;
                }
                if (prev != null)
                {
                    prev.Process = ap;
                }
                prev = ap;
                SetPos(act, startAction, t);
                Expect(16);
            }
            if (la.kind == 10)
            {
                Get();
                Process(out nextProc);
                Expect(12);
                nextProc.ParenCount++;
            }
            else if (la.kind == 17)
            {
                Get();
                nextProc = new NilProcess(); SetPos(nextProc, t);
            }
            else if (la.kind == 1)
            {
                ProcessConstantInvoke(out pc);
                nextProc = pc;
            }
            else if (la.kind == 18)
            {
                BranchProcess(out nextProc);
            }
            else
            {
                SynErr(42);
            }
            if (first == null)
            {
                proc = nextProc;
            }
            else
            {
                ap.Process = nextProc; proc = first;
            };
            if (la.kind == 21)
            {
                PreProcessActions ppa = null;
                Relabelling(out ppa);
                nextProc.PreProcessActions = ppa;
            }
            if (la.kind == 24)
            {
                ActionRestrictions ar = null;
                Restriction(out ar);
                nextProc.ActionRestrictions = ar;
            }
        }
 //ActionHandling
 public virtual void Visit(ActionRestrictions restrictions)
 {
 }