예제 #1
0
 void Action(out Action act)
 {
     act = null; Expression exp = null; Variable v = null;
     if (la.kind == 3)
     {
         Get();
         InAction inAct = new InAction(t.val);
         if (la.kind == 10)
         {
             Get();
             Expect(3);
             v = new Variable(t.val); SetPos(v, t); inAct.AddVariable(v);
             while (la.kind == 11)
             {
                 Get();
                 Expect(3);
                 v = new Variable(t.val); SetPos(v, t); inAct.AddVariable(v);
             }
             Expect(12);
         }
         act = inAct;
     }
     else if (la.kind == 5)
     {
         Get();
         OutAction outAct = new OutAction(t.val);
         if (la.kind == 10)
         {
             Get();
             ArithmeticExpression(out exp);
             outAct.AddExpression(exp);
             while (la.kind == 11)
             {
                 Get();
                 ArithmeticExpression(out exp);
                 outAct.AddExpression(exp);
             }
             Expect(12);
         }
         act = outAct;
     }
     else if (la.kind == 6)
     {
         MethodCall(out exp, true);
         act = new Call((MethodCallExpression)exp);
     }
     else
     {
         SynErr(43);
     }
 }
 public virtual string Format(Action act)
 {
     string result = null;
     if (act is InAction) {
         result = Format((InAction)act);
     } else if (act is OutAction) {
         result = Format((OutAction)act);
     }
     else
     {
         return "ERROR: UNKNOWN ACTION";
     }
     return result;
 }
예제 #3
0
        public virtual string Format(Action act)
        {
            string result = null;

            if (act is InAction)
            {
                result = Format((InAction)act);
            }
            else if (act is OutAction)
            {
                result = Format((OutAction)act);
            }
            else
            {
                return("ERROR: UNKNOWN ACTION");
            }
            return(result);
        }
예제 #4
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;
            }
        }
 void Action(out Action act)
 {
     act = null; Expression exp = null;Variable v = null;
     if (la.kind == 3) {
     Get();
     InAction inAct = new InAction(t.val);
     if (la.kind == 10) {
         Get();
         Expect(3);
         v = new Variable(t.val); SetPos(v, t); inAct.AddVariable(v);
         while (la.kind == 11) {
             Get();
             Expect(3);
             v = new Variable(t.val); SetPos(v, t); inAct.AddVariable(v);
         }
         Expect(12);
     }
     act = inAct;
     } else if (la.kind == 5) {
     Get();
     OutAction outAct = new OutAction(t.val);
     if (la.kind == 10) {
         Get();
         ArithmeticExpression(out exp);
         outAct.AddExpression(exp);
         while (la.kind == 11) {
             Get();
             ArithmeticExpression(out exp);
             outAct.AddExpression(exp);
         }
         Expect(12);
     }
     act = outAct;
     } else if (la.kind == 6) {
     MethodCall(out exp, true);
     act = new Call((MethodCallExpression)exp);
     } else SynErr(43);
 }