Ejemplo n.º 1
0
 private void wordIsColon(final Tokens tokens, final Token t) {
   // check we can get a previous and next word to merge together
   if (!currentSentence.isEmpty() && tokens.hasNext()) {
     // if the colon does not have a space on either side
     if (!isSpaceChar(lastChar(tokens.peekPrev().text))
         && !isSpaceChar(initChar(tokens.peekNext().text))) {
       // try to merge the 3 tokens back together again
       final int prevWordIndex = currentSentence.size() - 1;
       final Token prevSentenceWord = currentSentence.get(prevWordIndex);
       mergeWordsIntoSentence(prevSentenceWord, t, tokens.next(), prevWordIndex);
     } else currentSentence.add(t);
   } else currentSentence.add(t);
 }