private int countTerms(PsiExpression expression) {
      if (!isArithmetic(expression)) {
        return 1;
      }
      if (expression instanceof PsiPolyadicExpression poly) {
        int count = 0;
        for (PsiExpression operand : poly.getOperands()) {
          count += countTerms(operand);
        }
        return count;
      }
      else if (expression instanceof PsiPrefixExpression prefixExpression) {
        final PsiExpression operand = prefixExpression.getOperand();
        return countTerms(operand);
      }
      else if (expression instanceof PsiParenthesizedExpression parenthesizedExpression) {
        final PsiExpression contents = parenthesizedExpression.getExpression();
        return countTerms(contents);
      }
      return 1;
    }
private int countTerms(PsiExpression expression)