private string CaptureWord(bool captureGeneric)
{
StringBuilder read = new StringBuilder();
EatLineContinuation(read);
EatWhiteSpace(WhiteSpaceTypes.SpaceAndTab);
StringBuilder word = new StringBuilder(DefaultWordLength);
if (read.Length > 0 && read[read.Length - 1] == VBSymbol.LineContinuation)
{
//
// This is the scenario where the identifier starts
// with an underscore.
//
word.Append(VBSymbol.LineContinuation);
}
char nextChar = NextChar;
while (nextChar != EmptyChar)
{
if (captureGeneric && nextChar == VBSymbol.BeginParameterList)
{
TryReadChar();
word.Append(CurrentChar);
EatWhiteSpace();
if (char.ToLower(NextChar) == char.ToLower(VBKeyword.Of[0]))
{
TryReadChar();
word.Append(CurrentChar);
if (char.ToLower(NextChar) == char.ToLower(VBKeyword.Of[1]))
{
TryReadChar();
word.Append(CurrentChar);
word.Append(' ');
word.Append(ParseNestedText(
VBSymbol.BeginParameterList, VBSymbol.EndParameterList, false, true));
word.Append(VBSymbol.EndParameterList);
}
}
else if (NextChar == VBSymbol.EndParameterList)
{
TryReadChar();
word.Append(CurrentChar);
}
}
else if (IsWhiteSpace(nextChar) || IsAliasBreak(nextChar))
{
break;
}
else
{
TryReadChar();
word.Append(CurrentChar);
}
nextChar = NextChar;
}
return word.ToString();
}