fortran-lang / fprettify

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

Recommit support for submodules. #76

Closed han190 closed 4 years ago

han190 commented 4 years ago

Hi, it took me a while to figure out how to revert to the previous commit... Hopefully it's good now. Just to be clear, this commit is for the support of submodules. The indentation should look like something as follows:

submodule (module_1) submodule_1
    ! There might or might not be a space
    ! between 'submodule' and '(module_1)'
    ! but there usually is a space between 
    ! '(module_1)' and 'submodule_1'
    real, parameter :: submodule_param = 1.0
contains
    module subroutine sub_1(a, b)
        ! An interface in the main module is required
        real, intent(in) :: a 
        real, intent(out) :: b 
    end subroutine sub_1

    subroutine sub_2(a, b)
        ! Cannot be used by other submodules
        real, intent(in) :: a 
        real, intent(out) :: b 
    end subroutine sub_2
end submodule submodule_1

Best, Han

pseewald commented 4 years ago

There is something wrong now with the syntax. If you're struggling with git, I can make a commit with your proposed changes, just let me know if you prefer this solution.

han190 commented 4 years ago

Sure thing. Please do so!

pseewald commented 4 years ago

I committed your suggested change for submodule.