Example #1
0
        public override object VisitEventDecl(PParser.EventDeclContext context)
        {
            // EVENT name=Iden
            var pEvent = (PEvent)nodesToDeclarations.Get(context);

            // cardinality?
            var hasAssume   = context.cardinality()?.ASSUME() != null;
            var hasAssert   = context.cardinality()?.ASSERT() != null;
            var cardinality = int.Parse(context.cardinality()?.IntLiteral().GetText() ?? "-1");

            pEvent.Assume = hasAssume ? cardinality : -1;
            pEvent.Assert = hasAssert ? cardinality : -1;

            // (COLON type)?
            pEvent.PayloadType = ResolveType(context.type());

            // annotationSet?
            if (context.annotationSet() != null)
            {
                throw new NotImplementedException("event annotations");
            }

            // SEMI
            return(pEvent);
        }
Example #2
0
        public override object VisitEventDecl(PParser.EventDeclContext context)
        {
            // EVENT name=Iden
            PEvent pEvent = (PEvent)nodesToDeclarations.Get(context);

            // cardinality?
            bool hasAssume   = context.cardinality()?.ASSUME() != null;
            bool hasAssert   = context.cardinality()?.ASSERT() != null;
            int  cardinality = int.Parse(context.cardinality()?.IntLiteral().GetText() ?? "-1");

            pEvent.Assume = hasAssume ? cardinality : -1;
            pEvent.Assert = hasAssert ? cardinality : -1;

            // (COLON type)?
            pEvent.PayloadType = ResolveType(context.type());

            // SEMI
            return(pEvent);
        }