public IEnumerable<ParseStep> GetParseSteps(Func<ParseStep, bool> excludePredicate = null)
{
if (excludePredicate == null)
{
excludePredicate = step => false;
}
var enumerator = _getParseSteps().GetEnumerator();
while (true)
{
Exception error = null;
try
{
if (!enumerator.MoveNext())
{
yield break;
}
}
catch (Exception ex)
{
error = ex;
}
if (error != null)
{
yield return ParseStep.Error(error);
yield break;
}
if (excludePredicate(enumerator.Current))
{
continue;
}
yield return enumerator.Current;
}
}