public static void addStringTokensFromString(String string, StringInItem out) {
        if (string == null) {
            return;
        }
        var s = new ParsableString(string);
        while (!s.atEnd()) {
            String token;
            if (s.passOptional('\'')) {
                token = s.stringTo(s.position('\''));
                s.pass('\'');
            }
            else if (s.passOptional('"')) {
                token = s.stringTo(s.position('"'));
                s.pass('"');
            }
            else {
                token = s.stringTo(s.positionOrEnd(',')).trim();
            }
            out.addToken(token);
            s.passOptional(',');
        }
    }
Parser of parameter lists on the form {key:value, key:value} or [[key,value], [key,value], ...]

@author bratseth
container-search/src/main/java/com/yahoo/search/yql/ParameterListParser.java