indent-region: unexpected result (Fortran2003)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

indent-region: unexpected result (Fortran2003)

zimoun
Dear,

From the standard example [1], the function `f90-indent-subprogram'
(C-M-q) returns this unexpected output:

--8<---------------cut here---------------start------------->8---
Indenting module points...
END function does not match module.
Indenting module points...done
--8<---------------cut here---------------end--------------->8---


My guess is that it comes from the internal parser -- the entry point
is the function `f90-indent-region' -- which does not support the
Fortran 2003 norm; from my understanding.


Moreover, this snippet:

--8<---------------cut here---------------start------------->8---
submodule (singleton) sons
contains

 module procedure print_son
   print *,"son print ",this%child_num,count
 end procedure

 end submodule sons
--8<---------------cut here---------------end--------------->8---

is transformed, when applying C-M-q, into:

--8<---------------cut here---------------start------------->8---
submodule (singleton) sons
contains

  module procedure print_son
  print *,"son_ print ",this%child_num,count
end submodule sons

end submodule sons
--8<---------------cut here---------------end--------------->8---


The block detection is wrong. Is it a "feature" or a real bug?


Thank you in advance for any comments.

All the best,
simon



[1] http://fortranwiki.org/fortran/show/Submodules

--8<---------------cut here---------------start------------->8---
module points
  type :: point
     real :: x, y
  end type point

  interface
     module function point_dist(a, b) result(distance)
       type(point), intent(in) :: a, b
       real :: distance
     end function point_dist
  end interface
end module points

submodule (points) points_a
contains
  module function point_dist(a, b) result(distance)
    type(point), intent(in) :: a, b
    real :: distance
    distance = sqrt((a%x - b%x)**2 + (a%y - b%y)**2)
  end function point_dist
end submodule points_a
--8<---------------cut here---------------end--------------->8---