[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fortran
From: |
Hans Aberg |
Subject: |
Re: Fortran |
Date: |
Thu, 27 Feb 2003 11:21:57 +0100 |
At 23:19 -0500 2003/02/17, John R. Levine wrote:
>Lexing Fortran isn't very hard once you realize that you have to make a
>prepass over
>each statement to figure out whether it's an assignment or something else.
>Once you
>know that, the token boundaries are easy to find, but flex is definitely
>the wrong
>tool for the job.
It strikes me that one might attempt to tweak Flex by first pick down the
statement prepass, and when one knows it is an assignment or something
else, one sets an appropriate start condition and then puts the scanned
characters back into the stream. A similar approach might be used to figure
out the token boundaries, scanning as long is necessary, letting a special
function determine the first token boundary, and then putting back the
remaining characters.
Hans Aberg