Example #1
0
        public override object VisitStateDefer(PParser.StateDeferContext context)
        {
            // annotationSet? SEMI
            if (context.annotationSet() != null)
            {
                throw new NotImplementedException("event defer annotations");
            }

            // DEFER nonDefaultEventList
            var eventContexts = context.nonDefaultEventList()._events;
            var actions       = new IStateAction[eventContexts.Count];

            for (var i = 0; i < eventContexts.Count; i++)
            {
                var token = eventContexts[i];
                if (!CurrentScope.Lookup(token.GetText(), out PEvent evt))
                {
                    throw Handler.MissingDeclaration(token, "event", token.GetText());
                }
                actions[i] = new EventDefer(token, evt);
            }
            return(actions);
        }
Example #2
0
        public override object VisitStateDefer(PParser.StateDeferContext context)
        {
            if (CurrentMachine.IsSpec)
            {
                throw Handler.DeferredEventInMonitor(context, CurrentMachine);
            }

            // DEFER nonDefaultEventList
            var eventContexts = context.nonDefaultEventList()._events;
            var actions       = new IStateAction[eventContexts.Count];

            for (var i = 0; i < eventContexts.Count; i++)
            {
                var token = eventContexts[i];
                if (!CurrentScope.Lookup(token.GetText(), out PEvent evt))
                {
                    throw Handler.MissingDeclaration(token, "event", token.GetText());
                }
                actions[i] = new EventDefer(token, evt);
            }

            return(actions);
        }