private int parseOptions(CharSequence string) {
        Matcher defaultNullMatcher = defaultNullPattern.matcher(string);
        Matcher defaultMatcher = defaultPattern.matcher(string);
        Matcher optionalMatcher = optionalPattern.matcher(string);
        Matcher rangeMatcher = rangePattern.matcher(string);
        Matcher restartMatcher = restartPattern.matcher(string);

        if (defaultNullMatcher.find()) {
            throw new IllegalArgumentException("Null default value is not allowed: " + string.toString());
        } else if (defaultMatcher.find()) {
            String deflt = defaultMatcher.group(1);
            if (deflt.charAt(0) == '"') {
                int begin = defaultMatcher.start(1) + 1;
                deflt = findStringEnd(string, begin);
                if (deflt == null) {
                    throw new IllegalArgumentException(string.toString());
                }
                defaultValue = new DefaultValue(deflt, type);
                return begin + deflt.length() + 1;
            } else {
                defaultValue = new DefaultValue(deflt, type);
            }
            return defaultMatcher.end();
        } else if (optionalMatcher.find()) {
            if ( ! type.name.equals("path"))
                throw new IllegalArgumentException("optional can only be used for 'path'");
            optional = true;
            type.name = "optionalPath";
            return optionalMatcher.end();
        } else if (rangeMatcher.find()) {
            range = rangeMatcher.group(1);
            return rangeMatcher.end();
        } else if (restartMatcher.find()) {
            restart = true;
            return restartMatcher.end();
        } else {
            throw new IllegalArgumentException(string.toString());
        }
    }
Special function that searches through s and returns the index
of the first occurrence of " that is not escaped.
configgen/src/main/java/com/yahoo/config/codegen/DefLine.java