fortran-lang / fprettify

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

F2008 features #75

Closed han190 closed 4 years ago

han190 commented 4 years ago

Hi, this is my first pull request so bare with me if this pull request is too wordy...

The feature I am trying to add is the indentation of "submodule". A submodule looks like the following

submodule (module_1) submodule_1
    ! There are 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
contains
    module subroutine sub_1(a, b)
       ! module subroutine
       ! interface required in the main module 
        real, intent(in) :: a
        real, intent(out) :: b
    end subroutine sub_1

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

And therefore I added two regex expressions for SMOD_RE and ENDSMOD_RE in __init__.py.

Best, Han

pseewald commented 4 years ago

Thanks a lot! There are accidental changes to files in .travis, can you revert those?