private AttributeElement ParseAttribute(ReadOnlyCollection<ICommentElement> comments, bool nested)
{
AttributeElement attributeElement = new AttributeElement();
string typeName = CaptureTypeName(false);
EatLineContinuation();
//
// Check for an attribute target
//
if (TryReadChar(VBSymbol.LineDelimiter))
{
attributeElement.Target = typeName;
typeName = CaptureTypeName(false);
EatLineContinuation();
}
attributeElement.Name = typeName;
if (NextChar == VBSymbol.BeginParameterList)
{
string attributeText = ParseNestedText(
VBSymbol.BeginParameterList, VBSymbol.EndParameterList, true, true);
attributeElement.BodyText = attributeText;
}
EatLineContinuation();
while (!nested && TryReadChar(VBSymbol.AliasSeparator))
{
if (NextChar != VBSymbol.AliasSeparator)
{
AttributeElement childAttributeElement = ParseAttribute(null, true);
if (string.IsNullOrEmpty(childAttributeElement.Target))
{
childAttributeElement.Target = attributeElement.Target;
}
attributeElement.AddChild(childAttributeElement);
}
}
EatLineContinuation();
if (!nested)
{
EatChar(VBSymbol.EndAttribute);
}
if (comments != null && comments.Count > 0)
{
foreach (ICommentElement comment in comments)
{
attributeElement.AddHeaderComment(comment);
}
}
return attributeElement;
}