public IList<ILink> Parse(Uri baseUrl, string linkHeader)
{
BaseUrl = baseUrl;
InputString = linkHeader;
InputPos = 0;
IList<ILink> links = new List<ILink>();
while (true)
{
try
{
GetNextToken();
if (NextToken.Type == TokenType.Url)
links.Add(ParseLink());
else if (NextToken.Type == TokenType.EOF)
break;
else
Error(string.Format("Unexpected token '{0}' (expected URL)", NextToken.Type));
if (NextToken.Type == TokenType.Comma)
continue;
else if (NextToken.Type == TokenType.EOF)
break;
else
Error(string.Format("Unexpected token '{0}' (expected comma)", NextToken.Type));
}
catch (FormatException)
{
while (NextToken.Type != TokenType.Comma && NextToken.Type != TokenType.EOF)
{
try
{
GetNextToken();
}
catch (FormatException)
{
}
}
}
}
return links;
}