private static void addMapItems(ParsableString s, WeightedSetItem out) {
        s.pass('{');
        while (s.peek() != '}') {
            String key;
            if (s.passOptional('\'')) {
                key = s.stringTo(s.position('\''));
                s.pass('\'');
            }
            else if (s.passOptional('"')) {
                key = s.stringTo(s.position('"'));
                s.pass('"');
            }
            else {
                key = s.stringTo(s.position(':')).trim();
            }
            s.pass(':');
            int value = s.intTo(s.position(',','}'));
            out.addToken(key, value);
            s.passOptional(',');
            if (s.atEnd()) throw new IllegalArgumentException("Expected a map ending by '}'");
        }
        s.pass('}');
    }
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