fortran-src icon indicating copy to clipboard operation
fortran-src copied to clipboard

Reprinter deletes commentaries in multiline declaration

Open foxtran opened this issue 5 years ago • 1 comments

I have tried to reprint the following code:

      program main
      integer, parameter :: &
      minimum = 10, & !< minimum
      maximum = 20    !< maximum
      end

and it produces the following output without any commentaries:

program main
  integer, parameter :: minimum = 10, maximum = 20
end program main

Is it possible to save commentaries in this context?

foxtran avatar Jan 10 '20 11:01 foxtran

Yeah, we know about this. It was mentioned in #45. Basically, this is incredibly difficult in Fortran because you can write a comment in the middle of a keyword or an identifier as well. So it is not clear where to associate the comment in the AST.

That said there is a reprinting algo in camfort/camfort that doesn't touch the untransformed bits of the AST so they remain identical to the original source code. If that' what you need, that might be your best bet.

madgen avatar Jan 10 '20 11:01 madgen