private static void addArrayItems(ParsableString s, WeightedSetItem out) {
        s.pass('[');
        while (s.peek() != ']') {
            s.pass('[');
            long key = s.longTo(s.position(','));
            s.pass(',');
            int value = s.intTo(s.position(']'));
            s.pass(']');
            out.addToken(key, value);
            s.passOptional(',');
            if (s.atEnd()) throw new IllegalArgumentException("Expected an array 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