fortran-lang / fprettify

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

Feature Request: add optional double colon `::` #150

Open e-kwsm opened 1 year ago

e-kwsm commented 1 year ago

Consider the following file:

module mymod
   use, intrinsic :: iso_c_binding

   public mytype

   type mytype
   contains
      final destruct
   end type

   enum, bind(C)
      enumerator one
   end enum

   interface myinterface
      module procedure foo
   end interface

contains

   subroutine foo(arg)
      integer arg
      allocatable arg(:)
   end subroutine

   subroutine destruct(self)
      type(mytype) self
   end subroutine
end module

Is it possible to modify it like below?

@@ -3,7 +3,7 @@

-   public mytype
+   public :: mytype

-   type mytype
+   type :: mytype
    contains
-      final destruct
+      final :: destruct
    end type
@@ -11,3 +11,3 @@
    enum, bind(C)
-      enumerator one
+      enumerator :: one
    end enum
@@ -15,3 +15,3 @@
    interface myinterface
-      module procedure foo
+      module procedure :: foo
    end interface
@@ -21,4 +21,4 @@
    subroutine foo(arg)
-      integer arg
-      allocatable arg(:)
+      integer :: arg
+      allocatable :: arg(:)
    end subroutine
@@ -26,3 +26,3 @@
    subroutine destruct(self)
-      type(mytype) self
+      type(mytype) :: self
    end subroutine

Here double colons are not necessary, though.