当前位置: 首页>>代码示例>>Java>>正文


Java TokenTypes.INDEX_OP属性代码示例

本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.INDEX_OP属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.INDEX_OP属性的具体用法?Java TokenTypes.INDEX_OP怎么用?Java TokenTypes.INDEX_OP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.puppycrawl.tools.checkstyle.api.TokenTypes的用法示例。


在下文中一共展示了TokenTypes.INDEX_OP属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveArrayAccess

private IClass resolveArrayAccess(
    SymTabAST node,
    Scope location,
    IClass context,
    boolean referencePhase) {

    SymTabAST arrayNode = (SymTabAST) (node.getFirstChild());
    SymTabAST exprNode = (SymTabAST) (arrayNode.getNextSibling());

    //resolve index expressions
    while (arrayNode.getType() == TokenTypes.INDEX_OP) {
        resolveExpression(exprNode, location, context, referencePhase);
        arrayNode = (SymTabAST) (arrayNode.getFirstChild());
        exprNode = (SymTabAST) (arrayNode.getNextSibling()); 
    }
    
    ArrayDef array =
        (ArrayDef) resolveExpression(arrayNode,
            location,
            context,
            referencePhase);

    resolveExpression(exprNode, location, context, referencePhase);

    return array.getType();
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:Resolver.java

示例2: getDefaultTokens

@Override
public int[] getDefaultTokens() {
    return new int[] {
        TokenTypes.ARRAY_INIT,
        TokenTypes.AT,
        TokenTypes.INC,
        TokenTypes.DEC,
        TokenTypes.UNARY_MINUS,
        TokenTypes.UNARY_PLUS,
        TokenTypes.BNOT,
        TokenTypes.LNOT,
        TokenTypes.DOT,
        TokenTypes.ARRAY_DECLARATOR,
        TokenTypes.INDEX_OP,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:16,代码来源:NoWhitespaceAfterCheck.java

示例3: getAcceptableTokens

@Override
public int[] getAcceptableTokens() {
    return new int[] {
        TokenTypes.ARRAY_INIT,
        TokenTypes.AT,
        TokenTypes.INC,
        TokenTypes.DEC,
        TokenTypes.UNARY_MINUS,
        TokenTypes.UNARY_PLUS,
        TokenTypes.BNOT,
        TokenTypes.LNOT,
        TokenTypes.DOT,
        TokenTypes.TYPECAST,
        TokenTypes.ARRAY_DECLARATOR,
        TokenTypes.INDEX_OP,
        TokenTypes.LITERAL_SYNCHRONIZED,
        TokenTypes.METHOD_REF,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:19,代码来源:NoWhitespaceAfterCheck.java

示例4: getWhitespaceFollowedNode

/**
 * For a visited ast node returns node that should be checked
 * for not being followed by whitespace.
 * @param ast
 *        , visited node.
 * @return node before ast.
 */
private static DetailAST getWhitespaceFollowedNode(DetailAST ast) {
    final DetailAST whitespaceFollowedAst;
    switch (ast.getType()) {
        case TokenTypes.TYPECAST:
            whitespaceFollowedAst = ast.findFirstToken(TokenTypes.RPAREN);
            break;
        case TokenTypes.ARRAY_DECLARATOR:
            whitespaceFollowedAst = getArrayDeclaratorPreviousElement(ast);
            break;
        case TokenTypes.INDEX_OP:
            whitespaceFollowedAst = getIndexOpPreviousElement(ast);
            break;
        default:
            whitespaceFollowedAst = ast;
    }
    return whitespaceFollowedAst;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:24,代码来源:NoWhitespaceAfterCheck.java

示例5: getIndexOpPreviousElement

/**
 * Gets previous node for {@link TokenTypes#INDEX_OP INDEX_OP} token
 * for usage in getPositionAfter method, it is a simplified copy of
 * getArrayDeclaratorPreviousElement method.
 * @param ast
 *        , {@link TokenTypes#INDEX_OP INDEX_OP} node.
 * @return previous node by text order.
 */
private static DetailAST getIndexOpPreviousElement(DetailAST ast) {
    final DetailAST result;
    final DetailAST firstChild = ast.getFirstChild();
    if (firstChild.getType() == TokenTypes.INDEX_OP) {
        // second or higher array index
        result = firstChild.findFirstToken(TokenTypes.RBRACK);
    }
    else {
        final DetailAST ident = getIdentLastToken(ast);
        if (ident == null) {
            final DetailAST rparen = ast.findFirstToken(TokenTypes.RPAREN);
            // construction like new int[]{1}[0]
            if (rparen == null) {
                final DetailAST lastChild = firstChild.getLastChild();
                result = lastChild.findFirstToken(TokenTypes.RCURLY);
            }
            // construction like ((byte[]) pixels)[0]
            else {
                result = rparen;
            }
        }
        else {
            result = ident;
        }
    }
    return result;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:35,代码来源:NoWhitespaceAfterCheck.java


注:本文中的com.puppycrawl.tools.checkstyle.api.TokenTypes.INDEX_OP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。