sclass CCI_Substring extends CharacterClassIterator { S s; int i, l; CharacterClassIterator next; *() {} *(S *s, int start, int end, CharacterClassIterator *next) { i = start; l = end; } // no check because of method contract CharacterClassIterator acceptChar(char c) { ret ++i >= l && next != null ? next : this; } bool canEndHere() { ret i >= l; } bool canAcceptChar(char c) { ret i < l && s.charAt(i) == c; } Cl acceptedChars() { ret i >= l ? null : ll(s.charAt(i)); } CharRange acceptedCharRange() { ret i >= l ? null : singletonCharRange(s.charAt(i)); } CharacterClassIterator cloneCCI() { ret new CCI_Substring(s, i, l, next); } }