com.sun.source.doctree.AttributeTree.ValueKind Java Examples

The following examples show how to use com.sun.source.doctree.AttributeTree.ValueKind. 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 Project: TencentKona-8   Author: Tencent   File: DocPretty.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Void visitStartElement(StartElementTree node, Void p) {
    try {
        print("<");
        print(node.getName());
        List<? extends DocTree> attrs = node.getAttributes();
        if (!attrs.isEmpty()) {
            print(" ");
            print(attrs);
            DocTree last = node.getAttributes().get(attrs.size() - 1);
            if (node.isSelfClosing() && last instanceof AttributeTree
                    && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
                print(" ");
        }
        if (node.isSelfClosing())
            print("/");
        print(">");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example #2
Source Project: jdk8u60   Author: chenghanpeng   File: DocPretty.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Void visitStartElement(StartElementTree node, Void p) {
    try {
        print("<");
        print(node.getName());
        List<? extends DocTree> attrs = node.getAttributes();
        if (!attrs.isEmpty()) {
            print(" ");
            print(attrs);
            DocTree last = node.getAttributes().get(attrs.size() - 1);
            if (node.isSelfClosing() && last instanceof AttributeTree
                    && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
                print(" ");
        }
        if (node.isSelfClosing())
            print("/");
        print(">");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example #3
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: DocPretty.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Void visitStartElement(StartElementTree node, Void p) {
    try {
        print("<");
        print(node.getName());
        List<? extends DocTree> attrs = node.getAttributes();
        if (!attrs.isEmpty()) {
            print(" ");
            print(attrs);
            DocTree last = node.getAttributes().get(attrs.size() - 1);
            if (node.isSelfClosing() && last instanceof AttributeTree
                    && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
                print(" ");
        }
        if (node.isSelfClosing())
            print("/");
        print(">");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example #4
Source Project: lua-for-android   Author: qtiuto   File: DocPretty.java    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitStartElement(StartElementTree node, Void p) {
    try {
        print("<");
        print(node.getName());
        List<? extends DocTree> attrs = node.getAttributes();
        if (!attrs.isEmpty()) {
            print(" ");
            print(attrs);
            DocTree last = node.getAttributes().get(attrs.size() - 1);
            if (node.isSelfClosing() && last instanceof AttributeTree
                    && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
                print(" ");
        }
        if (node.isSelfClosing())
            print("/");
        print(">");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example #5
Source Project: netbeans   Author: apache   File: VeryPretty.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Void visitStartElement(StartElementTree node, Void p) {
    print("<");
    print(node.getName());
    java.util.List<? extends DocTree> attrs = node.getAttributes();
    if (!attrs.isEmpty()) {
        print(" ");
        for (DocTree docTree : attrs) {
            doAccept((DCTree)docTree);
        }
        DocTree last = attrs.get(attrs.size() - 1);
        if (node.isSelfClosing() && last instanceof AttributeTree
                && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
            print(" ");
    }
    if (node.isSelfClosing())
        print("/");
    print(">");
    return null;
}
 
Example #6
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: DocPretty.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Void visitStartElement(StartElementTree node, Void p) {
    try {
        print("<");
        print(node.getName());
        List<? extends DocTree> attrs = node.getAttributes();
        if (!attrs.isEmpty()) {
            print(" ");
            print(attrs);
            DocTree last = node.getAttributes().get(attrs.size() - 1);
            if (node.isSelfClosing() && last instanceof AttributeTree
                    && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
                print(" ");
        }
        if (node.isSelfClosing())
            print("/");
        print(">");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example #7
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: DocPretty.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitStartElement(StartElementTree node, Void p) {
    try {
        print("<");
        print(node.getName());
        List<? extends DocTree> attrs = node.getAttributes();
        if (!attrs.isEmpty()) {
            print(" ");
            print(attrs);
            DocTree last = node.getAttributes().get(attrs.size() - 1);
            if (node.isSelfClosing() && last instanceof AttributeTree
                    && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
                print(" ");
        }
        if (node.isSelfClosing())
            print("/");
        print(">");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example #8
Source Project: hottub   Author: dsrg-uoft   File: DocPretty.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Void visitStartElement(StartElementTree node, Void p) {
    try {
        print("<");
        print(node.getName());
        List<? extends DocTree> attrs = node.getAttributes();
        if (!attrs.isEmpty()) {
            print(" ");
            print(attrs);
            DocTree last = node.getAttributes().get(attrs.size() - 1);
            if (node.isSelfClosing() && last instanceof AttributeTree
                    && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
                print(" ");
        }
        if (node.isSelfClosing())
            print("/");
        print(">");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example #9
Source Project: openjdk-8-source   Author: keerath   File: DocPretty.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Void visitStartElement(StartElementTree node, Void p) {
    try {
        print("<");
        print(node.getName());
        List<? extends DocTree> attrs = node.getAttributes();
        if (!attrs.isEmpty()) {
            print(" ");
            print(attrs);
            DocTree last = node.getAttributes().get(attrs.size() - 1);
            if (node.isSelfClosing() && last instanceof AttributeTree
                    && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
                print(" ");
        }
        if (node.isSelfClosing())
            print("/");
        print(">");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example #10
Source Project: openjdk-8   Author: bpupadhyaya   File: DocPretty.java    License: GNU General Public License v2.0 6 votes vote down vote up
public Void visitStartElement(StartElementTree node, Void p) {
    try {
        print("<");
        print(node.getName());
        List<? extends DocTree> attrs = node.getAttributes();
        if (!attrs.isEmpty()) {
            print(" ");
            print(attrs);
            DocTree last = node.getAttributes().get(attrs.size() - 1);
            if (node.isSelfClosing() && last instanceof AttributeTree
                    && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED)
                print(" ");
        }
        if (node.isSelfClosing())
            print("/");
        print(">");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example #11
Source Project: TencentKona-8   Author: Tencent   File: DocCommentParser.java    License: 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 #12
Source Project: TencentKona-8   Author: Tencent   File: DocTreeMaker.java    License: GNU General Public License v2.0 4 votes vote down vote up
public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) {
    DCAttribute tree = new DCAttribute(name, vkind, value);
    tree.pos = pos;
    return tree;
}
 
Example #13
Source Project: jdk8u60   Author: chenghanpeng   File: DocCommentParser.java    License: 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 #14
Source Project: jdk8u60   Author: chenghanpeng   File: DocTreeMaker.java    License: GNU General Public License v2.0 4 votes vote down vote up
public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) {
    DCAttribute tree = new DCAttribute(name, vkind, value);
    tree.pos = pos;
    return tree;
}
 
Example #15
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: DocCommentParser.java    License: 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 #16
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: DocTreeMaker.java    License: GNU General Public License v2.0 4 votes vote down vote up
public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) {
    DCAttribute tree = new DCAttribute(name, vkind, value);
    tree.pos = pos;
    return tree;
}
 
Example #17
Source Project: lua-for-android   Author: qtiuto   File: DocCommentParser.java    License: 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 #18
Source Project: lua-for-android   Author: qtiuto   File: DocTreeMaker.java    License: BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public DCAttribute newAttributeTree(javax.lang.model.element.Name name, ValueKind vkind, java.util.List<? extends DocTree> value) {
    DCAttribute tree = new DCAttribute(name, vkind, cast(value));
    tree.pos = pos;
    return tree;
}
 
Example #19
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: DocCommentParser.java    License: 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 #20
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: DocTreeMaker.java    License: GNU General Public License v2.0 4 votes vote down vote up
public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) {
    DCAttribute tree = new DCAttribute(name, vkind, value);
    tree.pos = pos;
    return tree;
}
 
Example #21
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: DocCommentParser.java    License: 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 #22
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: DocTreeMaker.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public DCAttribute newAttributeTree(javax.lang.model.element.Name name, ValueKind vkind, java.util.List<? extends DocTree> value) {
    DCAttribute tree = new DCAttribute(name, vkind, cast(value));
    tree.pos = pos;
    return tree;
}
 
Example #23
Source Project: hottub   Author: dsrg-uoft   File: DocCommentParser.java    License: 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 #24
Source Project: hottub   Author: dsrg-uoft   File: DocTreeMaker.java    License: GNU General Public License v2.0 4 votes vote down vote up
public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) {
    DCAttribute tree = new DCAttribute(name, vkind, value);
    tree.pos = pos;
    return tree;
}
 
Example #25
Source Project: openjdk-8-source   Author: keerath   File: DocCommentParser.java    License: 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 #26
Source Project: openjdk-8-source   Author: keerath   File: DocTreeMaker.java    License: GNU General Public License v2.0 4 votes vote down vote up
public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) {
    DCAttribute tree = new DCAttribute(name, vkind, value);
    tree.pos = pos;
    return tree;
}
 
Example #27
Source Project: openjdk-8   Author: bpupadhyaya   File: DocCommentParser.java    License: 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 #28
Source Project: openjdk-8   Author: bpupadhyaya   File: DocTreeMaker.java    License: GNU General Public License v2.0 4 votes vote down vote up
public DCAttribute Attribute(Name name, ValueKind vkind, List<DCTree> value) {
    DCAttribute tree = new DCAttribute(name, vkind, value);
    tree.pos = pos;
    return tree;
}
 
Example #29
Source Project: lua-for-android   Author: qtiuto   File: DocTreeFactory.java    License: BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Create a new {@code AttributeTree} object, to represent an HTML attribute in an HTML tag.
 * @param name  the name of the attribute
 * @param vkind the kind of attribute value
 * @param value the value, if any, of the attribute
 * @return an {@code AttributeTree} object
 */
AttributeTree newAttributeTree(Name name, ValueKind vkind, List<? extends DocTree> value);
 
Example #30
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: DocTreeFactory.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Create a new {@code AttributeTree} object, to represent an HTML attribute in an HTML tag.
 * @param name  the name of the attribute
 * @param vkind the kind of attribute value
 * @param value the value, if any, of the attribute
 * @return an {@code AttributeTree} object
 */
AttributeTree newAttributeTree(Name name, ValueKind vkind, List<? extends DocTree> value);