NArrange.VisualBasic.VBParser.ParseEvent C# (CSharp) Method

ParseEvent() private method

Parses an event.
private ParseEvent ( CodeAccess access, MemberModifiers memberAttributes, bool isCustom ) : EventElement
access CodeAccess The event access.
memberAttributes MemberModifiers The member attributes.
isCustom bool Whether or not the event is custom.
return NArrange.Core.CodeElements.EventElement
        private EventElement ParseEvent(
			CodeAccess access, MemberModifiers memberAttributes, bool isCustom)
        {
            EventElement eventElement = new EventElement();
            string name = CaptureWord();
            eventElement.Name = name;
            eventElement.Access = access;
            eventElement.MemberModifiers = memberAttributes;

            EatWhiteSpace(WhiteSpaceTypes.SpaceAndTab);
            if (NextChar == VBSymbol.BeginParameterList)
            {
                eventElement.Parameters = ParseNestedText(
                    VBSymbol.BeginParameterList, VBSymbol.EndParameterList, true, true);
            }
            else
            {
                EatWord(VBKeyword.As);

                string eventType = CaptureTypeName();
                if (string.IsNullOrEmpty(eventType))
                {
                    this.OnParseError("Expected type identifier");
                }
                eventElement.Type = eventType;
            }

            string[] implements;
            string blockTemp = TryParseImplements(out implements);
            foreach (string implementation in implements)
            {
                InterfaceReference interfaceReference =
                    new InterfaceReference(implementation, InterfaceReferenceType.Interface);
                eventElement.AddImplementation(interfaceReference);
            }

            if (isCustom)
            {
                eventElement.BodyText = (blockTemp + this.ParseBlock(VBKeyword.Event)).Trim();
            }

            return eventElement;
        }