public Token nextWord(){
  if (!hasNextWord())   throw new IllegalStateException("No more words found!");
  int indexOfSpace=Math.min(remaining.indexOf(' '),remaining.indexOf('\n'));
  if (indexOfSpace == -1) {
    indexOfSpace=content.length() - currentPosition;
  }
  Token token=new Token(this,currentPosition,currentPosition + indexOfSpace);
  stepForward(indexOfSpace + 1);
  return token;
}

public Token nextWord ( ) { if ( ! hasNextWord ( ) ) throw new IllegalStateException ( "No more words found!" ) ; int indexOfSpace = Math . min ( remaining . indexOf ( ' ' ) , remaining . indexOf ( '\n' ) ) ; if ( indexOfSpace == - 1 ) { indexOfSpace = content . length ( ) - currentPosition ; } Token token = new Token ( this , currentPosition , currentPosition + indexOfSpace ) ; stepForward ( indexOfSpace + 1 ) ; return token ; }
returns the next word , stepping forward the tokenizer to the next non - space character . a word is delimited by a space .
