Examples of DetailAST


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

    /**
     * Check the indentation level of the conditional expression.
     */
    private void checkCondExpr()
    {
        final DetailAST condAst = (DetailAST)
            getMainAst().findFirstToken(TokenTypes.LPAREN).getNextSibling();
        checkExpressionSubtree(condAst, getLevel(), false, false);
    }
View Full Code Here

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

     * Collects references made by IDENT.
     * @param aAST the IDENT node to process
     */
    private void processIdent(DetailAST aAST)
    {
        final DetailAST parent = aAST.getParent();
        final int parentType = parent.getType();
        if (((parentType != TokenTypes.DOT)
            && (parentType != TokenTypes.METHOD_DEF))
            || ((parentType == TokenTypes.DOT)
                && (aAST.getNextSibling() != null)))
        {
View Full Code Here

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

    }

    @Override
    public void visitToken(DetailAST aAST)
    {
        final DetailAST mid = aAST.findFirstToken(TokenTypes.IDENT);
        final String methodName = mid.getText();

        if (mMethodName.equals(methodName)) {

            final DetailAST params = aAST.findFirstToken(TokenTypes.PARAMETERS);
            final boolean hasEmptyParamList =
                !params.branchContains(TokenTypes.PARAMETER_DEF);

            if (hasEmptyParamList) {
                log(aAST.getLineNo(), mErrorKey);
            }
        }
View Full Code Here

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

    /**
     * Check the indentation of the method name.
     */
    private void checkIdent()
    {
        final DetailAST ident = getMainAst().findFirstToken(TokenTypes.IDENT);
        final int columnNo = expandedTabsColumnNo(ident);
        if (startsLine(ident) && !getLevel().accept(columnNo)) {
            logError(ident, "", columnNo);
        }
    }
View Full Code Here

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

    /**
     * Check the indentation of the throws clause.
     */
    private void checkThrows()
    {
        final DetailAST throwsAst =
            getMainAst().findFirstToken(TokenTypes.LITERAL_THROWS);
        if (throwsAst == null) {
            return;
        }

View Full Code Here

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

     */
    private boolean emptyBlockCheck(DetailAST aAST, int aParentType, int aMatch)
    {
        final int type = aAST.getType();
        if (type == TokenTypes.RCURLY) {
            final DetailAST grandParent = aAST.getParent().getParent();
            return (aParentType == TokenTypes.SLIST)
                && (grandParent.getType() == aMatch);
        }

        return (type == TokenTypes.SLIST)
            && (aParentType == aMatch)
            && (aAST.getFirstChild().getType() == TokenTypes.RCURLY);
View Full Code Here

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

    /**
     * Check the indentation of the method type.
     */
    private void checkType()
    {
        final DetailAST type = getMainAst().findFirstToken(TokenTypes.TYPE);
        final DetailAST ident = ExpressionHandler.getFirstToken(type);
        final int columnNo = expandedTabsColumnNo(ident);
        if (startsLine(ident) && !getLevel().accept(columnNo)) {
            logError(ident, "return type", columnNo);
        }
    }
View Full Code Here

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

    /**
     * Check the indentation of the method parameters.
     */
    private void checkParameters()
    {
        final DetailAST params =
            getMainAst().findFirstToken(TokenTypes.PARAMETERS);
        checkExpressionSubtree(params, getLevel(), false, false);
    }
View Full Code Here

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

        final int parentType = aAST.getParent().getType();

        if ((TokenTypes.SLIST == parentType)
            || (TokenTypes.OBJBLOCK == parentType))
        {
            final DetailAST prevSibling = aAST.getPreviousSibling();

            //is countable if no previous sibling is found or
            //the sibling is no COMMA.
            //This is done because multiple assignment on one line are countes
            // as 1
            countable = (prevSibling == null)
                    || (TokenTypes.COMMA != prevSibling.getType());
        }

        return countable;
    }
View Full Code Here

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

    public void checkIndentation()
    {
        final IndentLevel expectedLevel = getChildrenExpectedLevel();

        // check indentation of assign if it starts line
        final DetailAST assign = getMainAst();
        if (startsLine(assign)
            && !expectedLevel.accept(expandedTabsColumnNo(assign)))
        {
            logError(assign, "" , expandedTabsColumnNo(assign), expectedLevel);
        }

        // check indentation of rvalue
        DetailAST child = (DetailAST) assign.getFirstChild();

        // if this is assign in expression then skip first child,
        // because it's lvalue.
        final DetailAST parent = assign.getParent();
        if ((parent != null) && (parent.getType() == TokenTypes.EXPR)) {
            child = (DetailAST) child.getNextSibling();
        }
        if ((parent != null)
            && (parent.getType() == TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR))
        {
            child = (DetailAST) assign.getNextSibling();
        }

        checkExpressionSubtree(child, expectedLevel, false, true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.