Package com.puppycrawl.tools.checkstyle.api

Examples of com.puppycrawl.tools.checkstyle.api.DetailNode


        final List<DetailNode> textNodes = getAllNewlineNodes(aAst);
        if (isInlineDescription(aAst)) {
            return;
        }
        for (DetailNode newlineNode : textNodes) {
            final DetailNode textNode = JavadocUtils.getNextSibling(JavadocUtils
                    .getNextSibling(newlineNode));
            if (textNode != null && textNode.getType() == JavadocTokenTypes.TEXT
                    && textNode.getChildren().length > 1)
            {
                final DetailNode whitespace = JavadocUtils.getFirstChild(textNode);
                if (whitespace.getType() == JavadocTokenTypes.WS
                        && whitespace.getText().length() - 1 < mOffset)
                {
                    log(textNode.getLineNumber(), "tag.continuation.indent", mOffset);
                }
            }
        }
View Full Code Here


     * @return Some javadoc.
     */
    private List<DetailNode> getAllNewlineNodes(DetailNode aDescriptionNode)
    {
        final List<DetailNode> textNodes = new ArrayList<DetailNode>();
        DetailNode node = JavadocUtils.getFirstChild(aDescriptionNode);
        while (JavadocUtils.getNextSibling(node) != null) {
            if (node.getType() == JavadocTokenTypes.NEWLINE) {
                textNodes.add(node);
            }
            node = JavadocUtils.getNextSibling(node);
        }
        return textNodes;
View Full Code Here

     * @param aDescription Some javadoc.
     * @return Some javadoc.
     */
    private boolean isInlineDescription(DetailNode aDescription)
    {
        DetailNode inlineTag = aDescription.getParent();
        while (inlineTag != null) {
            if (inlineTag.getType() == JavadocTokenTypes.JAVADOC_INLINE_TAG) {
                return true;
            }
            inlineTag = inlineTag.getParent();
        }
        return false;
    }
View Full Code Here

     * @param aTagNode Some javadoc.
     * @return Some javadoc.
     */
    private boolean isEmptyTag(DetailNode aTagNode)
    {
        final DetailNode tagDescription =
                JavadocUtils.findFirstToken(aTagNode, JavadocTokenTypes.DESCRIPTION);
        return tagDescription == null;
    }
View Full Code Here

     * Some javadoc.
     * @param aNewline Some javadoc.
     */
    private void checkEmptyLine(DetailNode aNewline)
    {
        final DetailNode nearestToken = getNearestNode(aNewline);
        if (!isLastEmptyLine(aNewline) && nearestToken != null
                && nearestToken.getType() == JavadocTokenTypes.TEXT
                && nearestToken.getChildren().length > 1)
        {
            log(aNewline.getLineNumber(), "javadoc.paragraph.tag.after");
        }
    }
View Full Code Here

     * Some javadoc.
     * @param aTag Some javadoc.
     */
    private void checkParagraphTag(DetailNode aTag)
    {
        final DetailNode newLine = getNearestEmptyLine(aTag);
        if (isFirstParagraph(aTag)) {
            log(aTag.getLineNumber(), "javadoc.paragraph.redundant.paragraph");
        }
        else if (newLine == null || aTag.getLineNumber() - newLine.getLineNumber() != 1) {
            log(aTag.getLineNumber(), "javadoc.paragraph.line.before");
        }
    }
View Full Code Here

     * @param aNode Some javadoc.
     * @return Some javadoc.
     */
    private DetailNode getNearestNode(DetailNode aNode)
    {
        DetailNode tag = JavadocUtils.getNextSibling(aNode);
        while (tag != null && (tag.getType() == JavadocTokenTypes.LEADING_ASTERISK
                || tag.getType() == JavadocTokenTypes.NEWLINE))
        {
            tag = JavadocUtils.getNextSibling(tag);
        }
        return tag;
    }
View Full Code Here

            mErrorListener.setOffset(aBlockCommentAst.getLineNo() - 1);

            try {
                final ParseTree parseTree = parseJavadoc(javadocComment);

                final DetailNode node = convertParseTree2DetailNode(parseTree);

                processTree(node);
            }
            catch (IOException e) {
                // Antlr can not initiate its ANTLRInputStream
View Full Code Here

        if (defaultTokenTypes == null) {
            return;
        }

        DetailNode curNode = aRoot;
        while (curNode != null) {
            final boolean waitsFor = Ints.contains(defaultTokenTypes, curNode.getType());

            if (waitsFor) {
                visitJavadocToken(curNode);
            }
            DetailNode toVisit = JavadocUtils.getFirstChild(curNode);
            while ((curNode != null) && (toVisit == null)) {

                if (waitsFor) {
                    leaveJavadocToken(curNode);
                }
View Full Code Here

     * @param aNewLine Some javadoc.
     * @return Some javadoc.
     */
    private boolean isEmptyLine(DetailNode aNewLine)
    {
        DetailNode previousSibling = JavadocUtils.getPreviousSibling(aNewLine);
        if (previousSibling == null
                || previousSibling.getParent().getType() != JavadocTokenTypes.JAVADOC)
        {
            return false;
        }
        if (previousSibling.getType() == JavadocTokenTypes.TEXT
                && previousSibling.getChildren().length == 1)
        {
            previousSibling = JavadocUtils.getPreviousSibling(previousSibling);
        }
        return previousSibling != null
                && previousSibling.getType() == JavadocTokenTypes.LEADING_ASTERISK;
    }
View Full Code Here

TOP

Related Classes of com.puppycrawl.tools.checkstyle.api.DetailNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.