fortran-lang / fprettify

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

Indentation broken for named select case statements #170

Closed wpbonelli closed 4 months ago

wpbonelli commented 5 months ago

Normal select case statements are formatted properly, e.g.

program test
    character :: c
  c = 'a'
select case (c)
  case ('b')
        print *, c
    case default
    print *, 'default'
  end select
end program test

becomes

program test
   character :: c
   c = 'a'
   select case (c)
   case ('b')
      print *, c
   case default
      print *, 'default'
   end select
end program test

Adding a name breaks the nested indentation so this

program test
    character :: c
  c = 'a'
l: select case (c)
  case ('b')
        print *, c
    case default
    print *, 'default'
  end select l
end program test

becomes

program test
   character :: c
   c = 'a'
   l:select case(c)
   case ('b')
   print *, c
   case default
   print *, 'default'
   end select l
end program test

This does not seem to apply to other named constructs, e.g. named do loops are reformatted properly.

dbroemmel commented 4 months ago

I think this is #152?

wpbonelli commented 4 months ago

sorry @dbroemmel, I missed that issue. Closing this duplicate

dbroemmel commented 4 months ago

No problem at all, simply wanted to avoid duplicate work. Also nice to see that others face similar difficulties as I do.