Beispiel #1
0
        void ActionPrefix(out Process proc, string locality)
        {
            Process nextproc = new NilProcess(); proc = null; Action action = null;

            if (la.kind == 17 || la.kind == 19 || la.kind == 20)
            {
                Action(out action, locality);
                if (la.kind == 13)
                {
                    Get();
                    ActionPrefix(out nextproc, locality);
                }
                proc = new ActionPrefix(action, nextproc); CopyPos(proc, action, t);
            }
            else if (la.kind == 14)
            {
                Get();
                Process(out proc, locality);
                Expect(15);
            }
            else if (la.kind == 16)
            {
                Get();
                proc = new NilProcess(); SetPos(proc, t);
            }
            else
            {
                SynErr(27);
            }
        }
 public override void Visit(NilProcess np)
 {
     if (np.Parent is NonDeterministicChoice)
     {
         _warnings.Add(new Warning(np.LexicalInfo, "Nil process will never be chosen in non deterministic choice. P+0 == 0"));
         np.IsUsed = false;
     }
     else if (np.Parent is ParallelComposition)
     {
         _warnings.Add(new Warning(np.LexicalInfo, "A nil process has no effect in parallel composition. P | 0 == 0"));
         np.IsUsed = false;
     }
     else if (np.Parent is ProcessDefinition)
     {
         string procName = ((ProcessDefinition)np.Parent).Name;
         _warnings.Add(new Warning(np.Parent.LexicalInfo, "Process " + procName + " has no effect and can be replaced with the nil process as appropriate"));
     }
 }
Beispiel #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;
            }
        }
 public virtual void Visit(NilProcess node)
 {
 }
Beispiel #5
0
 public virtual string Format(NilProcess np)
 {
     return("0");
 }
        public override void Visit(NilProcess node)
        {
            List <string> children = PopChildren();

            Return("0" + children[0] + children[1]);
        }