Search in sources :

Example 26 with DetailNode

use of com.puppycrawl.tools.checkstyle.api.DetailNode in project checkstyle by checkstyle.

the class JavadocTagContinuationIndentationCheck method getAllNewlineNodes.

/**
     * Finds and collects all NEWLINE nodes inside DESCRIPTION node.
     * @param descriptionNode DESCRIPTION node.
     * @return List with NEWLINE nodes.
     */
private static List<DetailNode> getAllNewlineNodes(DetailNode descriptionNode) {
    final List<DetailNode> textNodes = new ArrayList<>();
    DetailNode node = JavadocUtils.getFirstChild(descriptionNode);
    while (JavadocUtils.getNextSibling(node) != null) {
        if (node.getType() == JavadocTokenTypes.NEWLINE) {
            textNodes.add(node);
        }
        node = JavadocUtils.getNextSibling(node);
    }
    return textNodes;
}
Also used : ArrayList(java.util.ArrayList) DetailNode(com.puppycrawl.tools.checkstyle.api.DetailNode)

Aggregations

DetailNode (com.puppycrawl.tools.checkstyle.api.DetailNode)26 JavadocNodeImpl (com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocNodeImpl)5 Test (org.junit.Test)5 DetailAST (com.puppycrawl.tools.checkstyle.api.DetailAST)4 ParseTree (org.antlr.v4.runtime.tree.ParseTree)3 JavadocDetailNodeParser (com.puppycrawl.tools.checkstyle.JavadocDetailNodeParser)1 ArrayList (java.util.ArrayList)1 ParseCancellationException (org.antlr.v4.runtime.misc.ParseCancellationException)1