help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Locations suggest


From: Hans Aberg
Subject: Re: Locations suggest
Date: Fri, 4 Jan 2002 11:13:45 +0100

At 17:25 -0800 2002/01/03, John W. Millaway wrote:
>> The idea was otherwise just that if the file C/C++ file structure already
>> keeps track of the position, one can use that, and compute the column
>> number from that. This might be faster than trying to keep track of the
>> column number.
>
>Probably the same speed. This:
>
>    col = ftell(yyin) - last_newline;
>
>compared to this:
>
>    col = last_column + last_yyleng;
>
>The benefit of the second one is that it works for string buffers without
>conditional code.

My point was only: How do you compute the column numbers? Do you have a
variable that is set to zero whenever a newline is seen, and then
incremented for every character. If so, one may avoid doing that by
recording the position numbers of the newlines only, and compute the
difference at need.

  Hans Aberg





reply via email to

[Prev in Thread] Current Thread [Next in Thread]