fprettify icon indicating copy to clipboard operation
fprettify copied to clipboard

Numbered do loop end not properly indented

Open meteokid opened this issue 6 years ago • 0 comments
trafficstars

Old Fortran construct for numbered do loops are not properly "de-dented" This construct is still supported in more modern Fortran as far as I know.

Example 1, the end statement match the do loop

$ cat test.F90
subroutine a()
do 3 i=1,4
print *,i
3 continue
end

$ fprettify.py -s --strict-indent -- test.F90
subroutine a()
   do 3 i = 1, 4
      print *, i
3     continue
   end

Example 2, it never match the end of the ````do``` loop

$ cat test.F90
subroutine a()
do 3 i=1,4
print *,i
3 continue
end subroutine a

$ fprettify.py -s --strict-indent -- test.F90
subroutine a()
   do 3 i = 1, 4
      print *, i
3     continue
      end subroutine a

Expected result

subroutine a()
   do 3 i = 1, 4
      print *, i
3     continue
 end subroutine a

If the numbered do loop construct is not to be supported, it would be nice to throw an error/warning message.

meteokid avatar Jun 20 '19 16:06 meteokid