public static AssociatedTypeDeclaration FromXElement(XElement elem)
        {
            var assocType = new AssociatedTypeDeclaration();

            assocType.Name = NameAttribute(elem);

            var superClassElem = elem.Element("superclass");

            if (superClassElem != null)
            {
                var superClassName = NameAttribute(superClassElem);
                if (superClassName != null)
                {
                    assocType.SuperClass = TypeSpecParser.Parse(superClassName);
                }
            }
            var defaultDefn = elem.Attribute("defaulttype");

            if (defaultDefn != null)
            {
                assocType.DefaultType = TypeSpecParser.Parse((string)defaultDefn);
            }

            if (elem.Element("conformingprotocols") != null)
            {
                var conforming = from conform in elem.Element("conformingprotocols").Elements()
                                 select TypeSpecParser.Parse(NameAttribute (conform)) as NamedTypeSpec;

                assocType.ConformingProtocols.AddRange(conforming);
            }

            return(assocType);
        }
        public TypeSpec WithInOutSet()
        {
            var theSpec = TypeSpecParser.Parse(this.ToString());

            theSpec.IsInOut = true;
            return(theSpec);
        }
        public static TypeSpec Parse(string typeName)
        {
            TypeSpecParser parser = new TypeSpecParser(new StringReader(typeName));

            return(parser.Parse());
        }