private void calculateAlignments(List<ASTNode> children, boolean classLevel) {
    List<GrStatement> currentGroup = null;
    boolean spock = true;
    for (ASTNode child : children) {
      PsiElement psi = child.getPsi();
      if (psi instanceof GrLabeledStatement) {
        if (((GrLabeledStatement)psi).getLabel().getText().equals("where")) {
          alignGroup(currentGroup, spock, classLevel);
          currentGroup = new ArrayList<>();
          spock = true;
        }
      }
      else if (currentGroup != null && spock && isTablePart(psi)) {
        currentGroup.add((GrStatement)psi);
      }
      else if (psi instanceof GrVariableDeclaration) {
        GrVariable[] variables = ((GrVariableDeclaration)psi).getVariables();
        if (variables.length > 0) {
          if (!classLevel || currentGroup == null || fieldGroupEnded(psi) || spock) {
            alignGroup(currentGroup, spock, classLevel);
            currentGroup = new ArrayList<>();
            spock = false;
          }
          currentGroup.add((GrStatement)psi);
        }
      }
      else {
        if (shouldSkip(classLevel, psi)) continue;
        alignGroup(currentGroup, spock, classLevel);
        currentGroup = psi instanceof GrReferenceExpression && Pattern.matches("^__+$", psi.getText()) ? new ArrayList<>() : null;
      }
    }

    if (currentGroup != null) {
      alignGroup(currentGroup, spock, classLevel);
    }
  }
private void calculateAlignments(List<ASTNode> children, boolean classLevel)