Esempio n. 1
0
        void WhenClause(Rule rule)
        {
            Expect(18);
            ICondition when;

            Condition(out when);
            rule.NestCondition(when);
        }
Esempio n. 2
0
        void Action(Rule rule)
        {
            string name; ICondition c;

            if (la.kind == 21)
            {
                Get();
                Identifier(out name);
                rule.AddEffect(new SendEffect(SM, name));
            }
            else if (la.kind == 22)
            {
                Get();
                Identifier(out name);
                rule.AddEffect(new CallEffect(SM, name));
            }
            else if (la.kind == 23)
            {
                Get();
                while (la.kind == 16 || la.kind == 17 || la.kind == 18)
                {
                    if (la.kind == 18)
                    {
                        Get();
                        var nested = new Rule(rule, true);
                        Condition(out c);
                        nested.NestCondition(c);
                        while (la.kind == 21 || la.kind == 22 || la.kind == 23)
                        {
                            Action(nested);
                        }
                        nested.CreateNested(SM);
                    }
                    else if (la.kind == 16)
                    {
                        Trigger(rule);
                    }
                    else
                    {
                        Guard(rule);
                    }
                }
                Expect(24);
            }
            else
            {
                SynErr(41);
            }
        }
Esempio n. 3
0
        void Guard(Rule top)
        {
            string     name = null;
            ICondition cond;
            GuardType  gtype = GuardType.Undefined;

            UpdateLocation();

            Expect(17);
            if (la.kind == 1)
            {
                Identifier(out name);
            }
            while (la.kind == 18)
            {
                Get();
                var when = new Rule(top, false);
                if (la.kind == 19)
                {
                    Get();
                    gtype = GuardType.ENTER;
                }
                else if (la.kind == 20)
                {
                    Get();
                    gtype = GuardType.LEAVE;
                }
                else if (la.kind == 1 || la.kind == 28 || la.kind == 29)
                {
                }
                else
                {
                    SynErr(40);
                }
                Condition(out cond);
                when.NestCondition(cond);
                while (la.kind == 21 || la.kind == 22 || la.kind == 23)
                {
                    Action(when);
                }
                when.CreateGuard(SM, name, gtype);
            }
        }
Esempio n. 4
0
 void WhenClause(Rule rule)
 {
     Expect(18);
     ICondition when;
     Condition(out when);
     rule.NestCondition(when);
 }
Esempio n. 5
0
        void Guard(Rule top)
        {
            string name = null;
            ICondition cond;
            GuardType gtype = GuardType.Undefined;

            UpdateLocation();

            Expect(17);
            if (la.kind == 1) {
            Identifier(out name);
            }
            while (la.kind == 18) {
            Get();
            var when = new Rule(top, false);
            if (la.kind == 19) {
                Get();
                gtype = GuardType.ENTER;
            } else if (la.kind == 20) {
                Get();
                gtype = GuardType.LEAVE;
            } else if (la.kind == 1 || la.kind == 28 || la.kind == 29) {
            } else SynErr(40);
            Condition(out cond);
            when.NestCondition(cond);
            while (la.kind == 21 || la.kind == 22 || la.kind == 23) {
                Action(when);
            }
            when.CreateGuard(SM, name, gtype);
            }
        }
Esempio n. 6
0
 void Action(Rule rule)
 {
     string name; ICondition c;
     if (la.kind == 21) {
     Get();
     Identifier(out name);
     rule.AddEffect(new SendEffect(SM, name));
     } else if (la.kind == 22) {
     Get();
     Identifier(out name);
     rule.AddEffect(new CallEffect(SM, name));
     } else if (la.kind == 23) {
     Get();
     while (la.kind == 16 || la.kind == 17 || la.kind == 18) {
         if (la.kind == 18) {
             Get();
             var nested = new Rule(rule, true);
             Condition(out c);
             nested.NestCondition(c);
             while (la.kind == 21 || la.kind == 22 || la.kind == 23) {
                 Action(nested);
             }
             nested.CreateNested(SM);
         } else if (la.kind == 16) {
             Trigger(rule);
         } else {
             Guard(rule);
         }
     }
     Expect(24);
     } else SynErr(41);
 }