docs: public int tokenize(String string, char delim) {
      tokens = new ArrayList<String>();
  
      // nest holds how many levels we are in the current token.
      // if this is > 0 then we don't split a token when delim is matched.
      //
      // The Geometric datatypes use this, because often a type may have others
      // (usualls PGpoint) imbedded within a token.
      //
      // Peter 1998 Jan 6 - Added < and > to the nesting rules
      int nest = 0;
      int p;
      int s;
      boolean skipChar = false;
      boolean nestedDoubleQuote = false;
  
      for (p = 0, s = 0; p < string.length(); p++) {
        char c = string.charAt(p);
  
        // increase nesting if an open character is found
        if (c == '(' || c == '[' || c == '<' || (!nestedDoubleQuote && !skipChar && c == '"')) {
          nest++;
          if (c == '"') {
            nestedDoubleQuote = true;
            skipChar = true;
          }
        }
  
        // decrease nesting if a close character is found
        if (c == ')' || c == ']' || c == '>' || (nestedDoubleQuote && !skipChar && c == '"')) {
          nest--;
          if (c == '"') {
            nestedDoubleQuote = false;
          }
        }
  
        skipChar = c == '\\';
  
        if (nest == 0 && c == delim) {
          tokens.add(string.substring(s, p));
          s = p + 1; // +1 to skip the delimiter
        }
  
      }
  
      // Don't forget the last token ;-)
  
  
      if (s < string.length()) {
        tokens.add(string.substring(s));
      }
  
      return tokens.size();
    }