ford
ford copied to clipboard
Can not start a new line in Fortran with "&"
Hi,
I am getting the following error: Warning: Error parsing src/main.f90. Can not start a new line in Fortran with "&": & world &
As far as I know, this is standard Fortran syntax for line continuation of strings. https://stackoverflow.com/questions/16776270/line-continuation-of-strings-in-fortran
Is this something that can be fixed?
Thanks!
Oh dear, this definitely should work!
This looks like it should only happen if we think the previous line didn't end with an &. Do you have a full example I can check?
It does look like we don't actually have any tests for this, which is a mistake!
It seems to be my comment that is throwing things. Would be nice if this worked.
write(11, ' &
&( &
! row col day year sysTime sysRate cpuTime
& I0, A, I0, A, I0, A, I0, A, I0, A, I0, A, f13.6, A &
&)' &
)
Thanks! Ah, that is quite painful: there's a comment in the middle of the string literal. Valid Fortran, but quite difficult to parse.
This might take me a little bit of time to get to, so one workaround would be to move the comment out of the string. You could put a & at the end of the comment instead
Yes, that works as a fairly pain-free workaround. Thanks!