Java Code Examples for com.sun.source.doctree.AttributeTree.ValueKind#SINGLE

The following examples show how to use com.sun.source.doctree.AttributeTree.ValueKind#SINGLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DocCommentParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read a series of HTML attributes, terminated by {@literal > }.
 * Each attribute is of the form {@literal identifier[=value] }.
 * "value" may be unquoted, single-quoted, or double-quoted.
 */
protected List<DCTree> htmlAttrs() {
    ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
    skipWhitespace();

    loop:
    while (isIdentifierStart(ch)) {
        int namePos = bp;
        Name name = readIdentifier();
        skipWhitespace();
        List<DCTree> value = null;
        ValueKind vkind = ValueKind.EMPTY;
        if (ch == '=') {
            ListBuffer<DCTree> v = new ListBuffer<DCTree>();
            nextChar();
            skipWhitespace();
            if (ch == '\'' || ch == '"') {
                vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
                char quote = ch;
                nextChar();
                textStart = bp;
                while (bp < buflen && ch != quote) {
                    if (newline && ch == '@') {
                        attrs.add(erroneous("dc.unterminated.string", namePos));
                        // No point trying to read more.
                        // In fact, all attrs get discarded by the caller
                        // and superseded by a malformed.html node because
                        // the html tag itself is not terminated correctly.
                        break loop;
                    }
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
                nextChar();
            } else {
                vkind = ValueKind.UNQUOTED;
                textStart = bp;
                while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
            }
            skipWhitespace();
            value = v.toList();
        }
        DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
        attrs.add(attr);
    }

    return attrs.toList();
}
 
Example 2
Source File: DocCommentParser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read a series of HTML attributes, terminated by {@literal > }.
 * Each attribute is of the form {@literal identifier[=value] }.
 * "value" may be unquoted, single-quoted, or double-quoted.
 */
protected List<DCTree> htmlAttrs() {
    ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
    skipWhitespace();

    loop:
    while (isIdentifierStart(ch)) {
        int namePos = bp;
        Name name = readIdentifier();
        skipWhitespace();
        List<DCTree> value = null;
        ValueKind vkind = ValueKind.EMPTY;
        if (ch == '=') {
            ListBuffer<DCTree> v = new ListBuffer<DCTree>();
            nextChar();
            skipWhitespace();
            if (ch == '\'' || ch == '"') {
                vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
                char quote = ch;
                nextChar();
                textStart = bp;
                while (bp < buflen && ch != quote) {
                    if (newline && ch == '@') {
                        attrs.add(erroneous("dc.unterminated.string", namePos));
                        // No point trying to read more.
                        // In fact, all attrs get discarded by the caller
                        // and superseded by a malformed.html node because
                        // the html tag itself is not terminated correctly.
                        break loop;
                    }
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
                nextChar();
            } else {
                vkind = ValueKind.UNQUOTED;
                textStart = bp;
                while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
            }
            skipWhitespace();
            value = v.toList();
        }
        DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
        attrs.add(attr);
    }

    return attrs.toList();
}
 
Example 3
Source File: DocCommentParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read a series of HTML attributes, terminated by {@literal > }.
 * Each attribute is of the form {@literal identifier[=value] }.
 * "value" may be unquoted, single-quoted, or double-quoted.
 */
protected List<DCTree> htmlAttrs() {
    ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
    skipWhitespace();

    loop:
    while (isIdentifierStart(ch)) {
        int namePos = bp;
        Name name = readIdentifier();
        skipWhitespace();
        List<DCTree> value = null;
        ValueKind vkind = ValueKind.EMPTY;
        if (ch == '=') {
            ListBuffer<DCTree> v = new ListBuffer<DCTree>();
            nextChar();
            skipWhitespace();
            if (ch == '\'' || ch == '"') {
                vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
                char quote = ch;
                nextChar();
                textStart = bp;
                while (bp < buflen && ch != quote) {
                    if (newline && ch == '@') {
                        attrs.add(erroneous("dc.unterminated.string", namePos));
                        // No point trying to read more.
                        // In fact, all attrs get discarded by the caller
                        // and superseded by a malformed.html node because
                        // the html tag itself is not terminated correctly.
                        break loop;
                    }
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
                nextChar();
            } else {
                vkind = ValueKind.UNQUOTED;
                textStart = bp;
                while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
            }
            skipWhitespace();
            value = v.toList();
        }
        DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
        attrs.add(attr);
    }

    return attrs.toList();
}
 
Example 4
Source File: DocCommentParser.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Read a series of HTML attributes, terminated by {@literal > }.
 * Each attribute is of the form {@literal identifier[=value] }.
 * "value" may be unquoted, single-quoted, or double-quoted.
 */
protected List<DCTree> htmlAttrs() {
    ListBuffer<DCTree> attrs = new ListBuffer<>();
    skipWhitespace();

    loop:
    while (isIdentifierStart(ch)) {
        int namePos = bp;
        Name name = readAttributeName();
        skipWhitespace();
        List<DCTree> value = null;
        ValueKind vkind = ValueKind.EMPTY;
        if (ch == '=') {
            ListBuffer<DCTree> v = new ListBuffer<>();
            nextChar();
            skipWhitespace();
            if (ch == '\'' || ch == '"') {
                vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
                char quote = ch;
                nextChar();
                textStart = bp;
                while (bp < buflen && ch != quote) {
                    if (newline && ch == '@') {
                        attrs.add(erroneous("dc.unterminated.string", namePos));
                        // No point trying to read more.
                        // In fact, all attrs get discarded by the caller
                        // and superseded by a malformed.html node because
                        // the html tag itself is not terminated correctly.
                        break loop;
                    }
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
                nextChar();
            } else {
                vkind = ValueKind.UNQUOTED;
                textStart = bp;
                while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
            }
            skipWhitespace();
            value = v.toList();
        }
        DCAttribute attr = m.at(namePos).newAttributeTree(name, vkind, value);
        attrs.add(attr);
    }

    return attrs.toList();
}
 
Example 5
Source File: DocCommentParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read a series of HTML attributes, terminated by {@literal > }.
 * Each attribute is of the form {@literal identifier[=value] }.
 * "value" may be unquoted, single-quoted, or double-quoted.
 */
protected List<DCTree> htmlAttrs() {
    ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
    skipWhitespace();

    loop:
    while (isIdentifierStart(ch)) {
        int namePos = bp;
        Name name = readIdentifier();
        skipWhitespace();
        List<DCTree> value = null;
        ValueKind vkind = ValueKind.EMPTY;
        if (ch == '=') {
            ListBuffer<DCTree> v = new ListBuffer<DCTree>();
            nextChar();
            skipWhitespace();
            if (ch == '\'' || ch == '"') {
                vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
                char quote = ch;
                nextChar();
                textStart = bp;
                while (bp < buflen && ch != quote) {
                    if (newline && ch == '@') {
                        attrs.add(erroneous("dc.unterminated.string", namePos));
                        // No point trying to read more.
                        // In fact, all attrs get discarded by the caller
                        // and superseded by a malformed.html node because
                        // the html tag itself is not terminated correctly.
                        break loop;
                    }
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
                nextChar();
            } else {
                vkind = ValueKind.UNQUOTED;
                textStart = bp;
                while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
            }
            skipWhitespace();
            value = v.toList();
        }
        DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
        attrs.add(attr);
    }

    return attrs.toList();
}
 
Example 6
Source File: DocCommentParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read a series of HTML attributes, terminated by {@literal > }.
 * Each attribute is of the form {@literal identifier[=value] }.
 * "value" may be unquoted, single-quoted, or double-quoted.
 */
protected List<DCTree> htmlAttrs() {
    ListBuffer<DCTree> attrs = new ListBuffer<>();
    skipWhitespace();

    loop:
    while (isIdentifierStart(ch)) {
        int namePos = bp;
        Name name = readAttributeName();
        skipWhitespace();
        List<DCTree> value = null;
        ValueKind vkind = ValueKind.EMPTY;
        if (ch == '=') {
            ListBuffer<DCTree> v = new ListBuffer<>();
            nextChar();
            skipWhitespace();
            if (ch == '\'' || ch == '"') {
                vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
                char quote = ch;
                nextChar();
                textStart = bp;
                while (bp < buflen && ch != quote) {
                    if (newline && ch == '@') {
                        attrs.add(erroneous("dc.unterminated.string", namePos));
                        // No point trying to read more.
                        // In fact, all attrs get discarded by the caller
                        // and superseded by a malformed.html node because
                        // the html tag itself is not terminated correctly.
                        break loop;
                    }
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
                nextChar();
            } else {
                vkind = ValueKind.UNQUOTED;
                textStart = bp;
                while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
            }
            skipWhitespace();
            value = v.toList();
        }
        DCAttribute attr = m.at(namePos).newAttributeTree(name, vkind, value);
        attrs.add(attr);
    }

    return attrs.toList();
}
 
Example 7
Source File: DocCommentParser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read a series of HTML attributes, terminated by {@literal > }.
 * Each attribute is of the form {@literal identifier[=value] }.
 * "value" may be unquoted, single-quoted, or double-quoted.
 */
protected List<DCTree> htmlAttrs() {
    ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
    skipWhitespace();

    loop:
    while (isIdentifierStart(ch)) {
        int namePos = bp;
        Name name = readIdentifier();
        skipWhitespace();
        List<DCTree> value = null;
        ValueKind vkind = ValueKind.EMPTY;
        if (ch == '=') {
            ListBuffer<DCTree> v = new ListBuffer<DCTree>();
            nextChar();
            skipWhitespace();
            if (ch == '\'' || ch == '"') {
                vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
                char quote = ch;
                nextChar();
                textStart = bp;
                while (bp < buflen && ch != quote) {
                    if (newline && ch == '@') {
                        attrs.add(erroneous("dc.unterminated.string", namePos));
                        // No point trying to read more.
                        // In fact, all attrs get discarded by the caller
                        // and superseded by a malformed.html node because
                        // the html tag itself is not terminated correctly.
                        break loop;
                    }
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
                nextChar();
            } else {
                vkind = ValueKind.UNQUOTED;
                textStart = bp;
                while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
            }
            skipWhitespace();
            value = v.toList();
        }
        DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
        attrs.add(attr);
    }

    return attrs.toList();
}
 
Example 8
Source File: DocCommentParser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read a series of HTML attributes, terminated by {@literal > }.
 * Each attribute is of the form {@literal identifier[=value] }.
 * "value" may be unquoted, single-quoted, or double-quoted.
 */
protected List<DCTree> htmlAttrs() {
    ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
    skipWhitespace();

    loop:
    while (isIdentifierStart(ch)) {
        int namePos = bp;
        Name name = readIdentifier();
        skipWhitespace();
        List<DCTree> value = null;
        ValueKind vkind = ValueKind.EMPTY;
        if (ch == '=') {
            ListBuffer<DCTree> v = new ListBuffer<DCTree>();
            nextChar();
            skipWhitespace();
            if (ch == '\'' || ch == '"') {
                vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
                char quote = ch;
                nextChar();
                textStart = bp;
                while (bp < buflen && ch != quote) {
                    if (newline && ch == '@') {
                        attrs.add(erroneous("dc.unterminated.string", namePos));
                        // No point trying to read more.
                        // In fact, all attrs get discarded by the caller
                        // and superseded by a malformed.html node because
                        // the html tag itself is not terminated correctly.
                        break loop;
                    }
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
                nextChar();
            } else {
                vkind = ValueKind.UNQUOTED;
                textStart = bp;
                while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
            }
            skipWhitespace();
            value = v.toList();
        }
        DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
        attrs.add(attr);
    }

    return attrs.toList();
}
 
Example 9
Source File: DocCommentParser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Read a series of HTML attributes, terminated by {@literal > }.
 * Each attribute is of the form {@literal identifier[=value] }.
 * "value" may be unquoted, single-quoted, or double-quoted.
 */
protected List<DCTree> htmlAttrs() {
    ListBuffer<DCTree> attrs = new ListBuffer<DCTree>();
    skipWhitespace();

    loop:
    while (isIdentifierStart(ch)) {
        int namePos = bp;
        Name name = readIdentifier();
        skipWhitespace();
        List<DCTree> value = null;
        ValueKind vkind = ValueKind.EMPTY;
        if (ch == '=') {
            ListBuffer<DCTree> v = new ListBuffer<DCTree>();
            nextChar();
            skipWhitespace();
            if (ch == '\'' || ch == '"') {
                vkind = (ch == '\'') ? ValueKind.SINGLE : ValueKind.DOUBLE;
                char quote = ch;
                nextChar();
                textStart = bp;
                while (bp < buflen && ch != quote) {
                    if (newline && ch == '@') {
                        attrs.add(erroneous("dc.unterminated.string", namePos));
                        // No point trying to read more.
                        // In fact, all attrs get discarded by the caller
                        // and superseded by a malformed.html node because
                        // the html tag itself is not terminated correctly.
                        break loop;
                    }
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
                nextChar();
            } else {
                vkind = ValueKind.UNQUOTED;
                textStart = bp;
                while (bp < buflen && !isUnquotedAttrValueTerminator(ch)) {
                    attrValueChar(v);
                }
                addPendingText(v, bp - 1);
            }
            skipWhitespace();
            value = v.toList();
        }
        DCAttribute attr = m.at(namePos).Attribute(name, vkind, value);
        attrs.add(attr);
    }

    return attrs.toList();
}