本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.FOR_ITERATOR属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.FOR_ITERATOR属性的具体用法?Java TokenTypes.FOR_ITERATOR怎么用?Java TokenTypes.FOR_ITERATOR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.FOR_ITERATOR属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRequiredTokens
@Override
public int[] getRequiredTokens() {
return new int[] {
TokenTypes.OBJBLOCK,
TokenTypes.LITERAL_FOR,
TokenTypes.FOR_ITERATOR,
TokenTypes.FOR_EACH_CLAUSE,
TokenTypes.ASSIGN,
TokenTypes.PLUS_ASSIGN,
TokenTypes.MINUS_ASSIGN,
TokenTypes.STAR_ASSIGN,
TokenTypes.DIV_ASSIGN,
TokenTypes.MOD_ASSIGN,
TokenTypes.SR_ASSIGN,
TokenTypes.BSR_ASSIGN,
TokenTypes.SL_ASSIGN,
TokenTypes.BAND_ASSIGN,
TokenTypes.BXOR_ASSIGN,
TokenTypes.BOR_ASSIGN,
TokenTypes.INC,
TokenTypes.POST_INC,
TokenTypes.DEC,
TokenTypes.POST_DEC,
};
}
示例2: visitToken
@Override
public void visitToken(DetailAST ast) {
switch (ast.getType()) {
case TokenTypes.SEMI:
checkIfSemicolonIsInDifferentLineThanPrevious(ast);
break;
case TokenTypes.FOR_ITERATOR:
forStatementEnd = ast.getLineNo();
break;
case TokenTypes.LAMBDA:
isInLambda = true;
countOfSemiInLambda.push(0);
break;
default:
inForHeader = true;
break;
}
}
示例3: leaveToken
@Override
public void leaveToken(DetailAST ast) {
switch (ast.getType()) {
case TokenTypes.SEMI:
lastStatementEnd = ast.getLineNo();
forStatementEnd = -1;
lambdaStatementEnd = -1;
break;
case TokenTypes.FOR_ITERATOR:
inForHeader = false;
break;
case TokenTypes.LAMBDA:
countOfSemiInLambda.pop();
if (countOfSemiInLambda.isEmpty()) {
isInLambda = false;
}
lambdaStatementEnd = ast.getLineNo();
break;
default:
break;
}
}
示例4: visitToken
@Override
public void visitToken(DetailAST ast) {
switch (ast.getType()) {
case TokenTypes.OBJBLOCK:
enterBlock();
break;
case TokenTypes.LITERAL_FOR:
case TokenTypes.FOR_ITERATOR:
case TokenTypes.FOR_EACH_CLAUSE:
//we need that Tokens only at leaveToken()
break;
case TokenTypes.ASSIGN:
case TokenTypes.PLUS_ASSIGN:
case TokenTypes.MINUS_ASSIGN:
case TokenTypes.STAR_ASSIGN:
case TokenTypes.DIV_ASSIGN:
case TokenTypes.MOD_ASSIGN:
case TokenTypes.SR_ASSIGN:
case TokenTypes.BSR_ASSIGN:
case TokenTypes.SL_ASSIGN:
case TokenTypes.BAND_ASSIGN:
case TokenTypes.BXOR_ASSIGN:
case TokenTypes.BOR_ASSIGN:
case TokenTypes.INC:
case TokenTypes.POST_INC:
case TokenTypes.DEC:
case TokenTypes.POST_DEC:
checkIdent(ast);
break;
default:
throw new IllegalStateException(ILLEGAL_TYPE_OF_TOKEN + ast);
}
}
示例5: getRequiredTokens
@Override
public int[] getRequiredTokens() {
return new int[] {
TokenTypes.SEMI,
TokenTypes.FOR_INIT,
TokenTypes.FOR_ITERATOR,
TokenTypes.LAMBDA,
};
}
示例6: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final EmptyForIteratorPadCheck checkObj = new EmptyForIteratorPadCheck();
final int[] expected = {TokenTypes.FOR_ITERATOR};
assertArrayEquals("Default required tokens are invalid",
expected, checkObj.getRequiredTokens());
}
示例7: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final EmptyForIteratorPadCheck emptyForIteratorPadCheckObj = new EmptyForIteratorPadCheck();
final int[] actual = emptyForIteratorPadCheckObj.getAcceptableTokens();
final int[] expected = {
TokenTypes.FOR_ITERATOR,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例8: leaveToken
@Override
public void leaveToken(DetailAST ast) {
switch (ast.getType()) {
case TokenTypes.FOR_ITERATOR:
leaveForIter(ast.getParent());
break;
case TokenTypes.FOR_EACH_CLAUSE:
if (!skipEnhancedForLoopVariable) {
final DetailAST paramDef = ast.findFirstToken(TokenTypes.VARIABLE_DEF);
leaveForEach(paramDef);
}
break;
case TokenTypes.LITERAL_FOR:
if (!getCurrentVariables().isEmpty()) {
leaveForDef(ast);
}
break;
case TokenTypes.OBJBLOCK:
exitBlock();
break;
case TokenTypes.ASSIGN:
case TokenTypes.PLUS_ASSIGN:
case TokenTypes.MINUS_ASSIGN:
case TokenTypes.STAR_ASSIGN:
case TokenTypes.DIV_ASSIGN:
case TokenTypes.MOD_ASSIGN:
case TokenTypes.SR_ASSIGN:
case TokenTypes.BSR_ASSIGN:
case TokenTypes.SL_ASSIGN:
case TokenTypes.BAND_ASSIGN:
case TokenTypes.BXOR_ASSIGN:
case TokenTypes.BOR_ASSIGN:
case TokenTypes.INC:
case TokenTypes.POST_INC:
case TokenTypes.DEC:
case TokenTypes.POST_DEC:
//we need that Tokens only at visitToken()
break;
default:
throw new IllegalStateException(ILLEGAL_TYPE_OF_TOKEN + ast);
}
}
示例9: getRequiredTokens
@Override
public int[] getRequiredTokens() {
return new int[] {TokenTypes.FOR_ITERATOR};
}