fortran-lang / fprettify

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

fprettify misunderstands Unary operator (`+` and `-`) in `WRITE` statement as Binary #125

Open e-kwsm opened 2 years ago

e-kwsm commented 2 years ago

Consider the following code:

PROGRAM UNARY
   IMPLICIT NONE
   INTEGER :: a, b
   a = -42
   b = -a
   WRITE (*, '(2I6)') -a, -b
END PROGRAM

Here all the occurrence of - is unary operator, but fprettify 0.3.7 adds a space as follows:

@@ -6 +6 @@
-   WRITE (*, '(2I6)') -a, -b
+   WRITE (*, '(2I6)') - a, -b