help-flex
[Top][All Lists]
Advanced

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

Re: yylineno


From: Hans-Bernhard Broeker
Subject: Re: yylineno
Date: Mon, 18 Jun 2001 18:13:36 +0200 (MET DST)

On Sat, 16 Jun 2001, Bill Fenlason wrote:

> overhead.  I'd like to find out if others have handled this problem in a
> different (hopefully better) way than I have.

About the only other possibility would be to make sure that all patterns
in your flex source have a fixed number of \n's in them --- zero, or one.
Best to have them all at the start or end of your match, too. Then you can
run your own my_yylineno and keep track of it in the individual rules. As
to a column/character counter within each line: it may help to make use of
yymore() extensively, so the whole line of input stays in yytext[] until
you encounter a rule that ends with a \n.

I.e. to do this efficiently, you have to add intelligence to the scanner
source by hand. Generally available methods to be made available by flex
at large can't be that efficient.

-- 
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.




reply via email to

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