Generalize TokenIterator.