public static int calcBaseIndent(ASTNode chameleon) {
    final ASTNode prevLeaf = TreeUtil.prevLeaf(chameleon, true);
    if (prevLeaf == null) {
      return 0;
    }

    final CharSequence text = prevLeaf.getChars();
    int offset = text.length();

    int answer = 0;

    while (--offset >= 0) {
      final char c = text.charAt(offset);
      if (c == '\n') {
        break;
      }
      if (c != ' ' && c != '\t') {
        answer = 0;
        break;
      }
      answer++;
    }
    return answer;
  }
public static int calcBaseIndent(ASTNode chameleon)