fortran-lang / fprettify

auto-formatter for modern fortran source code
https://pypi.python.org/pypi/fprettify
Other
370 stars 76 forks source link

Some limitations (or bugs in some way) #101

Open Jellby opened 3 years ago

Jellby commented 3 years ago

After creating #99 and using it for a while, here are some of the limitations or problems I've found (that are not solved with the PR):

A small sample that contains all these cases:

      subroutine foo(strings,flag)
      use iso_fortran_env, only: int32
      implicit none
      character(LeN=10), intent(In) :: strings(3)                               ! len, in
      integer(KiNd=InT32), intent(iN) :: flag                                   ! kind, in
      integer :: i, err
      select case (flag)
         case (1)
            open(10, IoStAt=err)                                                ! iostat
            if (err /= 0) Go To 100                                             ! go to
            write(10,'("(",a,")(",a,")(",a,")")') (strings(i)(1:10),i=1,3)      ! )(
            close(10)
            write(6,200) 'title',(strings(i)(1:10),i=1,3)                       ! ,(
         case DeFaUlT                                                           ! default
            do 20 i=1,10
              write(6,*) i
            20 continue                                                         ! numbered do
            if (flag < 0) then
               write(6,*) 'Negative'
            elseif (flag > 10) then                                             ! feature request: change "elseif" to "else if"
               write(6,*) 'Large'
            end if
      end select
100   return
200   format (/a &                                                              ! (/ misalignment
              /'(',a,')(',a,')(',a,')')
      end subroutine