private static List<String> processTokens(List<Token> tokens) {
    final List<String> splits = new ArrayList<>();
    for (int i = 0; i < tokens.size(); i++) {
      Token token = tokens.get(i);
      switch (token.getTokenType()) {
        case DOUBLE_QUOTED:
        case SINGLE_QUOTED:
          if (i + 1 < tokens.size() && tokens.get(i + 1).getTokenType() != TokenType.DELIMITER) {
            int illegalPosition = tokens.get(i + 1).getPosition() - 1;
            throw new IllegalArgumentException(
                "Could not split string. Illegal quoting at position: " + illegalPosition);
          }
          splits.add(token.getString());
          break;
        case UNQUOTED:
          splits.add(token.getString());
          break;
        case DELIMITER:
          if (i + 1 < tokens.size() && tokens.get(i + 1).getTokenType() == TokenType.DELIMITER) {
            splits.add("");
          }
          break;
      }
    }

    return splits;
  }
Escapes the given string with single quotes, if the input string contains a double quote or any
of the given {@code charsToEscape}. Any single quotes in the input string will be escaped by
doubling.

<p>Given that the escapeChar is (;)

<p>Examples:

<ul>
  <li>A,B,C,D => A,B,C,D
  <li>A'B'C'D => 'A''B''C''D'
  <li>A;BCD => 'A;BCD'
  <li>AB"C"D => 'AB"C"D'
  <li>AB'"D:B => 'AB''"D:B'
</ul>

@param string a string which needs to be escaped
@param charsToEscape escape chars for the escape conditions
@return escaped string by single quote
amoro-common/src/main/java/org/apache/amoro/config/StructuredOptionsSplitter.java