public MentionToken nextMention(){
  if (!hasNextMention())   throw new IllegalStateException("No more mentions found!");
  Token t=nextRegex(anyMentionPattern);
  final int lessThan=t.getStartIndex();
  final int greaterThan=t.getEndIndex();
  final String matched=t.getContent();
  final char type=matched.charAt(1);
  if (type == '@') {
    if (matched.charAt(2) == '&') {
      return new RoleMentionToken(this,lessThan,greaterThan);
    }
    return new UserMentionToken(this,lessThan,greaterThan);
  }
 else   if (type == '#') {
    return new ChannelMentionToken(this,lessThan,greaterThan);
  }
  throw new IllegalStateException("Couldn't find a mention even though it was found!");
}

public MentionToken nextMention ( ) { if ( ! hasNextMention ( ) ) throw new IllegalStateException ( "No more mentions found!" ) ; Token t = nextRegex ( anyMentionPattern ) ; final int lessThan = t . getStartIndex ( ) ; final int greaterThan = t . getEndIndex ( ) ; final String matched = t . getContent ( ) ; final char type = matched . charAt ( 1 ) ; if ( type == '@' ) { if ( matched . charAt ( 2 ) == '&' ) { return new RoleMentionToken ( this , lessThan , greaterThan ) ; } return new UserMentionToken ( this , lessThan , greaterThan ) ; } else if ( type == '#' ) { return new ChannelMentionToken ( this , lessThan , greaterThan ) ; } throw new IllegalStateException ( "Couldn't find a mention even though it was found!" ) ; }
returns the next mention , stepping forward the tokenizer to the end of the mention ( exclusive ) .
