private void parseParameterValue()

in src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java [257:322]


        private void parseParameterValue() throws ParseException {
            // true if the value parsing has started, white spaces skipped
            boolean start = false;
            // true if the value parsing is ended, then only white spaces are allowed
            boolean end = false;
            boolean doubleQuoted = false;
            do {
                switch (readNext()) {
                    case '\0':
                        break;
                    case ',':
                    case ';':
                        endParameterValue();
                        return;
                    case '=':
                    case ':':
                        error("Illegal character '" + c + "' in parameter value of " + paramName);
                        // try to recover: ignore that parameter
                        paramName = null;
                        break;
                    case '\"':
                        doubleQuoted = true;
                    case '\'':
                        if (end && paramName != null) {
                            error("Expecting the end of a parameter value");
                            // try to recover: ignore that parameter
                            paramName = null;
                        }
                        if (start) {
                            // quote in the middle of the value, just add it as a quote
                            buffer.append(c);
                        } else {
                            start = true;
                            appendQuoted(doubleQuoted);
                            end = true;
                        }
                        break;
                    case '\\':
                        if (end && paramName != null) {
                            error("Expecting the end of a parameter value");
                            // try to recover: ignore that parameter
                            paramName = null;
                        }
                        start = true;
                        appendEscaped();
                        break;
                    case ' ':
                    case '\t':
                    case '\n':
                    case '\r':
                        if (start) {
                            end = true;
                        }
                        break;
                    default:
                        if (end && paramName != null) {
                            error("Expecting the end of a parameter value");
                            // try to recover: ignore that parameter
                            paramName = null;
                        }
                        start = true;
                        buffer.append(c);
                }
            } while (pos < length);
            endParameterValue();
        }