protected bool ParseScanSet(TextParser input, FormatSpecifier spec)
{
// Parse characters
int start = input.Position;
if (!spec.ScanSetExclude)
{
while (spec.ScanSet.Contains(input.Peek().ToString()))
input.MoveAhead();
}
else
{
while (!input.EndOfText && !spec.ScanSet.Contains(input.Peek().ToString()))
input.MoveAhead();
}
// Don't exceed field width
if (spec.Width > 0)
{
int count = input.Position - start;
if (spec.Width < count)
input.MoveAhead(spec.Width - count);
}
// Extract token
if (input.Position > start)
{
if (!spec.NoResult)
Results.Add(input.Extract(start, input.Position));
return true;
}
return false;
}