fortran-lang / fprettify

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

fprettify is not idempotent if labeled statement has line continuation with leading `&` #102

Open e-kwsm opened 3 years ago

e-kwsm commented 3 years ago

Consider the following file:

program main
   integer :: x = 1
   integer :: f

   f = ((1*x + 2)*x &
        + 3)

100 f = ((1*x + 2)*x &
        + 3)

   f = ((1*x + 2)*x &
      & + 3)

200 f = ((1*x + 2)*x &
      & + 3)
end program

If fprettify is run, the file is modified as:

@@ -14,3 +14,3 @@ program main
 200 f = ((1*x + 2)*x &
-      & + 3)
+     & + 3)
 end program

A space is removed by each execution, and consequently the file becomes:

@@ -14,3 +14,3 @@ program main
 200 f = ((1*x + 2)*x &
-      & + 3)
+& + 3)
 end program