/// <summary>
        /// Parses and returns an indexer.
        /// </summary>
        /// <param name="parent">The parent of the element.</param>
        /// <param name="elementReference">A reference to the element being created.</param>
        /// <param name="unsafeCode">Indicates whether the code is marked as unsafe.</param>
        /// <param name="generated">Indicates whether the code is marked as generated code.</param>
        /// <param name="xmlHeader">The element's documentation header.</param>
        /// <param name="attributes">The attributes on the element.</param>
        /// <returns>Returns the element.</returns>
        private Indexer ParseIndexer(
            CsElement parent,
            Reference<ICodePart> elementReference,
            bool unsafeCode,
            bool generated,
            XmlHeader xmlHeader,
            ICollection<Attribute> attributes)
        {
            Param.AssertNotNull(parent, "parent");
            Param.AssertNotNull(elementReference, "elementReference");
            Param.Ignore(unsafeCode);
            Param.Ignore(generated);
            Param.Ignore(xmlHeader);
            Param.Ignore(attributes);

            Node<CsToken> previousTokenNode = this.tokens.Last;

            // Get the modifiers and access.
            AccessModifierType accessModifier = AccessModifierType.Private;

            // Indexers within interfaces always have the access of the parent interface.
            Interface parentInterface = parent as Interface;
            if (parentInterface != null)
            {
                accessModifier = parentInterface.AccessModifier;
            }

            // Get declared modifiers.
            Dictionary<CsTokenType, CsToken> modifiers = this.GetElementModifiers(elementReference, ref accessModifier, IndexerModifiers);

            unsafeCode |= modifiers.ContainsKey(CsTokenType.Unsafe);

            // Get the return type.
            TypeToken returnType = this.GetTypeToken(elementReference, unsafeCode, true);
            this.tokens.Add(returnType);

            // Get the name of the indexer.
            CsToken name = this.GetElementNameToken(elementReference, unsafeCode);
            this.tokens.Add(name);

            // Get the parameter list.
            IList<Parameter> parameters = this.ParseParameterList(elementReference, unsafeCode, SymbolType.OpenSquareBracket);

            // Create the declaration.
            Node<CsToken> firstTokenNode = previousTokenNode == null ? this.tokens.First : previousTokenNode.Next;
            CsTokenList declarationTokens = new CsTokenList(this.tokens, firstTokenNode, this.tokens.Last);
            Declaration declaration = new Declaration(
                declarationTokens, name.Text, ElementType.Indexer, accessModifier, modifiers);

            Indexer indexer = new Indexer(
                this.document,
                parent,
                xmlHeader,
                attributes,
                declaration,
                returnType,
                parameters,
                unsafeCode,
                generated);
            elementReference.Target = indexer;

            // Parse the body of the indexer.
            this.ParseElementContainer(indexer, elementReference, null, unsafeCode);

            return indexer;
        }
 private Indexer ParseIndexer(CsElement parent, bool unsafeCode, bool generated, XmlHeader xmlHeader, ICollection<Microsoft.StyleCop.CSharp.Attribute> attributes)
 {
     Microsoft.StyleCop.Node<CsToken> last = this.tokens.Last;
     AccessModifierType @private = AccessModifierType.Private;
     Interface interface2 = parent as Interface;
     if (interface2 != null)
     {
         @private = interface2.AccessModifier;
     }
     Dictionary<CsTokenType, CsToken> elementModifiers = this.GetElementModifiers(ref @private, IndexerModifiers);
     unsafeCode |= elementModifiers.ContainsKey(CsTokenType.Unsafe);
     TypeToken typeToken = this.GetTypeToken(unsafeCode, true);
     this.tokens.Add(typeToken);
     CsToken elementNameToken = this.GetElementNameToken(unsafeCode);
     this.tokens.Add(elementNameToken);
     IList<Parameter> parameters = this.ParseParameterList(unsafeCode, SymbolType.OpenSquareBracket);
     Microsoft.StyleCop.Node<CsToken> firstItemNode = (last == null) ? this.tokens.First : last.Next;
     CsTokenList tokens = new CsTokenList(this.tokens, firstItemNode, this.tokens.Last);
     Declaration declaration = new Declaration(tokens, elementNameToken.Text, ElementType.Indexer, @private, elementModifiers);
     Indexer element = new Indexer(this.document, parent, xmlHeader, attributes, declaration, typeToken, parameters, unsafeCode, generated);
     this.ParseElementContainer(element, null, unsafeCode);
     return element;
 }