This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: comments in Fortran
- To: toon at moene dot indiv dot nluug dot nl
- Subject: Re: comments in Fortran
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Mon, 10 Jan 2000 19:08:57 -0800
- Cc: gcc at gcc dot gnu dot org
- References: <20000110215915Z99178-140+2@wolery.cumb.org>
On Mon, Jan 10, 2000 at 09:59:19PM +0000, toon@moene.indiv.nluug.nl wrote:
> Zack Weinberg wrote:
>
> > At the moment I am only interested in the limited problem of
> > reliably detecting Fortran comments. cpplib as it is today doesn't
> > recognize them at all, which is fine because the front end handles
> > that, except that people *will* put ' and " in comments, and that
> > confuses cpplib to the point of rejecting the code as ill-formed.
>
> Yep, that's definitely a problem - not in the least because Fortran
> programmers will be completely baffled by the error message they get :-)
I have now implemented a vaguely respectable kluge which should do well
for the time being. There is a -lang-fortran switch which causes all
string constants, '' or "", to be silently terminated at end of line.
It doesn't make any effort to recognize true fortran comments, but it
does strip /* */ comments and process #directives. // is left alone.
This should serve fine for the time being; whoever's in charge of fortran
these days could maybe consider if we still need to use -traditional
with Fortran. It should cope fine with your Hollerith constant example.
Longer term, we could maybe look into swapping out cpplib's lexical
analyzer for something more suited to Fortran. This would be the only
way to go if you wanted to use the cpp library within f771 instead of
a separate executable.
zw