本文整理汇总了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();
}
示例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,
};
}
示例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,
};
}
示例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;
}
示例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;
}