fortran-lang / fprettify

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

Option to remove trailing semicolons #120

Open tueda opened 2 years ago

tueda commented 2 years ago

It would be nice if unnecessary semicolons at the ends of lines could be automatically removed. Example:

program test
    implicit none; 
    integer :: n; ! semicolon not mandatory
end program

This will help those who use languages that require semicolons (like C) and languages that do not (that is Fortran). As an example in formatters in other languages, Python's black does this job.

vickysharma0812 commented 1 year ago

Also, it would be better to break the inline statement which separates expressions using semicolon. For example,

from

if( 2> 1) then; a = a + 2; else; a = a + 1; endif

to

if( 2> 1) then
  a = a + 2
else
  a = a + 1
endif