1 package com.puppycrawl.tools.checkstyle.checks.indentation; 20 21 import com.puppycrawl.tools.checkstyle.api.DetailAST; 22 import com.puppycrawl.tools.checkstyle.api.TokenTypes; 23 24 29 public class LabelHandler extends ExpressionHandler 30 { 31 34 private final int[] mLabelChildren = new int[] { 35 TokenTypes.IDENT, 36 }; 37 38 46 public LabelHandler(IndentationCheck aIndentCheck, 47 DetailAST aExpr, ExpressionHandler aParent) 48 { 49 super(aIndentCheck, "label", aExpr, aParent); 50 } 51 52 57 protected IndentLevel getLevelImpl() 58 { 59 return new IndentLevel(super.getLevelImpl(), -getBasicOffset()); 60 } 61 62 65 private void checkLabel() 66 { 67 checkChildren(getMainAst(), mLabelChildren, getLevel(), true, false); 68 } 69 70 73 public void checkIndentation() 74 { 75 checkLabel(); 76 final DetailAST parent = (DetailAST) 78 getMainAst().getFirstChild().getNextSibling(); 79 80 final IndentLevel expected = 81 new IndentLevel(getLevel(), getBasicOffset()); 82 83 checkExpressionSubtree(parent, expected, true, false); 84 } 85 } 86 | Popular Tags |