@Override public final T getNext() { if (iterator.hasNext()) { T item = iterator.next(); if (predicate.matches(item)) { return item; } } return finished(); }
@Override public String toString() { return predicate.toString(); }
@Override public Result<Character> parse(final Segment<Character> characters) { if (characters.isEmpty()) return fail(predicate, "[EOF]"); Character c = characters.head(); return predicate.matches(c) ? success(c, characters.tail()) : fail(predicate, c); }