private IEnumerator <object> Grouper(IEnumerator iter, object curKey) { while (PythonContext.Equal(GetKey(iter.Current), curKey)) { yield return(iter.Current); if (!MoveNextHelper(iter)) { _fFinished = true; yield break; } } }
private IEnumerator <object> Yielder(IEnumerator iter) { object curKey = _starterKey; if (MoveNextHelper(iter)) { while (!_fFinished) { while (PythonContext.Equal(GetKey(iter.Current), curKey)) { if (!MoveNextHelper(iter)) { _fFinished = true; yield break; } } curKey = GetKey(iter.Current); yield return(PythonTuple.MakeTuple(curKey, Grouper(iter, curKey))); } } }