abstract sclass CharacterClassIterator { // move method (go to next character) // callee can assume that c is compatible with canAcceptChar // return value can be this or follow-up iterator abstract CharacterClassIterator acceptChar(char c); // query methods about next character abstract bool canEndHere(); abstract bool canAcceptChar(char c); // This character range must contain all the characters that // are accepted by canAcceptChar at the current position. // character range should be interpreted in a way compatible with an agreed-on char comparator. // Method can return null if no chars are accepted at this position. abstract CharRange acceptedCharRange(); }