private Name ParseName() { Name signature = null; while (true) { if (CurrentToken.Kind != TokenKind.Identifier) { throw InvalidSignature(); } var name = EatToken().Text; signature = new QualifiedName(signature, name); if (CurrentToken.Kind == TokenKind.LessThan) { var typeParameters = ParseTypeParameters(); signature = new GenericName((QualifiedName)signature, typeParameters); } if (CurrentToken.Kind != TokenKind.Dot) { return signature; } EatToken(); } }
private Name ParseName() { Name signature = null; while (true) { switch (CurrentToken.Kind) { case TokenKind.Identifier: break; case TokenKind.Keyword: if (signature == null) { throw InvalidSignature(); } break; default: throw InvalidSignature(); } var name = EatToken().Text; signature = new QualifiedName(signature, name); if (IsStartOfTypeArguments()) { var typeParameters = ParseTypeParameters(); signature = new GenericName((QualifiedName)signature, typeParameters); } if (CurrentToken.Kind != TokenKind.Dot) { return signature; } EatToken(); } }