Пример #1
0
        public override void EnterTypeBody(ExpressParser.TypeBodyContext context)
        {
            var name = context.typeDef().SimpleId().GetText();

            TypeData td = null;

            if (context.typeSel().collectionType() != null)
            {
                td = new SimpleType(name, generator, testGenerator);
                ((SimpleType)td).IsCollectionType = true;
            }
            else if (context.typeSel().simpleType() != null)
            {
                td = new SimpleType(name, generator, testGenerator);
                // The wrapped type will be discerned on exit so we can
                // get it for collection types as well.
            }
            else if (context.typeSel().namedType() != null)
            {
                td = new SimpleType(name, generator, testGenerator);
                // The wrapped type will be discerned on exit so we can
                // get it for collection types as well.
            }
            else if (context.typeSel().enumType() != null)
            {
                td = new EnumType(name, generator, testGenerator);
                ((EnumType)td).Values = context.typeSel().enumType().enumValues().GetText().Split(',');
            }
            else if (context.typeSel().selectType() != null)
            {
                td = new SelectType(name, generator, testGenerator);
                ((SelectType)td).Values = context.typeSel().selectType().selectValues().GetText().Split(',');
            }

            currTypeData = td;
            typeGraph.Add(name, td);
        }
Пример #2
0
        // TYPE
        public override void EnterTypeBody(ExpressParser.TypeBodyContext context)
        {
            var name = context.typeDef().SimpleId().GetText();

            TypeData td   = null;
            int      rank = 0;
            bool     returnsCollection = false;
            var      isGeneric         = false;

            if (context.typeSel().collectionType() != null)
            {
                var wrappedType = ParseCollectionType(context.typeSel().collectionType(), ref rank, ref returnsCollection, ref isGeneric);
                td = new WrapperType(name, wrappedType, generator, returnsCollection, rank);
            }
            else if (context.typeSel().simpleType() != null)
            {
                var wrappedType = ParseSimpleType(context.typeSel().simpleType());
                td = new WrapperType(name, wrappedType, generator, returnsCollection, rank);
            }
            else if (context.typeSel().namedType() != null)
            {
                var wrappedType = ParseNamedType(context.typeSel().namedType());
                td = new WrapperType(name, wrappedType, generator, returnsCollection, rank);
            }
            else if (context.typeSel().enumType() != null)
            {
                var values = context.typeSel().enumType().enumValues().GetText().Split(',');
                td = new EnumType(name, generator, values);
            }
            else if (context.typeSel().selectType() != null)
            {
                var values = context.typeSel().selectType().selectValues().GetText().Split(',');
                td = new SelectType(name, generator, values);
            }

            typeData.Add(name, td);
        }