On Thu, Jul 03, 2003 at 11:25:44AM -0600, David Thompson wrote:
> That was my first thought, but then I thought maybe I should actually 
> write the test for it--but after almost finishing that (hitting a few 
> bugs), I think I agree with you--but are there other lexers that 
> don't define yylineno? I guess we'll find out.

We probably would have found out already--they only could've worked so
far together with bison, but not with a native yacc implementation.
Rather unlikely, I think.

Now, the downside of the 'flex -l' approach: it introduces a lot of
compatibility code that decreases performance of the scanner rather
badly, according to the flex docs. We really want option --yylineno, but
that was only added rather late, in version 2.5.6. '%option yylineno'
has been supported as long as option '-l', but other lex implementations
choke on it. So the only alternative as far as I can see is:

configure.ac:

        AC_SUBST(FLEX_OPTION_YYLINENO)
        AC_PROG_LEX
        if test "$LEX" == "flex"; then
            FLEX_OPTION_YYLINENO="%option yylineno"
        fi
        (...)
        AC_CONFIG_FILES([(...) src/uipp/dxuilib/net.lex.in]

Move net.lex to net.lex.in and prepend
        
        @FLEX_OPTION_YYLINENO@

Adds even more geek value to netyacc.c for not only being pre-processed
by cpp, awk, sed, lex, and yacc, but also by configure. ;-) But
seriously, if you don't like the -l approach, this looks like the
correct solution to me. (Okay, we might do the sed'ing ourselves in
local.mk, but that's merely a detail.)

Regards,

Daniel.

Reply via email to