private static int handleCharacterLiteral(@NotNull String criteria, int index, @NotNull StringBuilder pattern) {
    final int length = criteria.length();
    if (index + 1 < length && criteria.charAt(index + 1) == '\'') {
      // ignore next '
      pattern.append('\'');
      return index + 1;
    }
    else if (index + 2 < length && criteria.charAt(index + 2) == '\'') {
      // eat simple character
      pattern.append(criteria, index, index + 3);
      return index + 2;
    }
    else if (index + 3 < length && criteria.charAt(index + 1) == '\\' && criteria.charAt(index + 3) == '\'') {
      // eat simple escape character
      pattern.append(criteria, index, index + 4);
      return index + 3;
    }
    else if (index + 7 < length &&
             criteria.charAt(index + 1) == '\\' &&
             criteria.charAt(index + 2) == 'u' &&
             criteria.charAt(index + 7) == '\'') {
      // eat unicode escape character
      pattern.append(criteria, index, index + 8);
      return index + 7;
    }
    return index;
  }
private static int handleCharacterLiteral(@NotNull String criteria, int index, @NotNull StringBuilder pattern)