@Nullable
  protected List<Match> addLegacyMatches(List <Match> existingSugMatches, String messageStr,
      boolean inMessage) {
    List<Match> sugMatch = new ArrayList<>();
    int pos = 0;
    int ind = 0;
    int matchCounter = 0;
    while (pos != -1) {
      pos = messageStr.indexOf('\\', ind);
      if (pos != -1 && messageStr.length() > pos && Character.isDigit(messageStr.charAt(pos + 1))) {
        if (pos == 0 || messageStr.charAt(pos - 1) != '\u0001') {
          Match mWorker = new Match(null, null, false, null,
              null, Match.CaseConversion.NONE, false, false, Match.IncludeRange.NONE);
          mWorker.setInMessageOnly(true);
          sugMatch.add(mWorker);
        } else if (messageStr.charAt(pos - 1) == '\u0001') { // real suggestion marker
          sugMatch.add(existingSugMatches.get(matchCounter));
          if (inMessage) {
            message.deleteCharAt(pos - 1 - matchCounter);
          } else {
            suggestionsOutMsg.deleteCharAt(pos - 1 - matchCounter);
          }
          matchCounter++;
        }
      }
      ind = pos + 1;
    }

    if (sugMatch.isEmpty()) {
      return existingSugMatches;
    }
    return sugMatch;
  }
@ Nullable protected List < Match > addLegacyMatches ( List < Match > existingSugMatches , String messageStr , boolean inMessage ) { List < Match > sugMatch = new ArrayList < > ( ) ; int pos = 0 ; int ind = 0 ; int matchCounter = 0 ; while ( pos != - 1 ) { pos = messageStr . indexOf ( '\\' , ind ) ; if ( pos != - 1 && messageStr . length ( ) > pos && Character . isDigit ( messageStr . charAt ( pos + 1 ) ) ) { if ( pos == 0 || messageStr . charAt ( pos - 1 ) != '' ) { Match mWorker = new Match ( null , null , false , null , null , Match . CaseConversion . NONE , false , false , Match . IncludeRange . NONE ) ; mWorker . setInMessageOnly ( true ) ; sugMatch . add ( mWorker ) ; } else if ( messageStr . charAt ( pos - 1 ) == '' ) { sugMatch . add ( existingSugMatches . get ( matchCounter ) ) ; if ( inMessage ) { message . deleteCharAt ( pos - 1 - matchCounter ) ; } else { suggestionsOutMsg . deleteCharAt ( pos - 1 - matchCounter ) ; } matchCounter ++ ; } } ind = pos + 1 ; } if ( sugMatch . isEmpty ( ) ) { return existingSugMatches ; } return sugMatch ; }
Adds Match objects for all references to tokens
(including '\1' and the like).