Subject: Re: bug#10154: ylwrap error:

From: Joe Chen <[email-masked]>
Date: Mon, 28 Nov 2011 15:17:21 -0700

On Mon, Nov 28, 2011 at 12:32 PM, Stefano Lattarini
<[email-masked]> wrote:
> tags 10154 notabug
> thanks
>
> On Monday 28 November 2011, Joe Chen wrote:
>> Hi,
>>
> Hi Joe, thanks for the report.
>
>> I am using automake for compile flex input file.  The flex command
>> line option --prefix=<STRING> or -P<STRING> works with the direct
>> invoking of flex, buy ylwrap gets error all the time for me:
>>
>> /bin/bash ../build-aux/ylwrap configf_lexer.l lex.yy.c configf_lexer.c
>> -- flex  --case-insensitive --prefix=configf_yy
>> make[4]: *** [configf_lexer.c] Error 1
>>
>>
>> Is this a known issue?
>>
> This is not an issue in ylwrap, but rather and usage error.  Let's see
> again the help screen from ylwrap:
>
>  Usage: ylwrap INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
>
>  Wrapper for lex/yacc invocations, renaming files as desired.
>
>   INPUT is the input file
>   OUTPUT is one file PROG generates
>   DESIRED is the file we actually want instead of OUTPUT
>   PROGRAM is program to run
>   ARGS are passed to PROG
>
>  Any number of OUTPUT,DESIRED pairs may be used.
>
> This suggests that, instead of using `--prefix' to modify the name of
> the generated `.c' file, you should simply use the DESIRED argument:
>
>  ylwrap configf_lexer.l lex.yy.c configf_lexer.c \
>        -- flex --case-insensitive
>
> Or, if you have other reasons to want to stick with the `--prefix'
> option (whose exact effects and semantics I don't pretend to know),
> you must inform `ylwrap' of the different expected OUTPUT filename:
>
>  ylwrap configf_lexer.l lex.configf_yy.c configf_lexer.c \
>        -- flex --case-insensitive --prefix=configf_yy

THANKS! This format of ylwrap no longer gets the error, and works for
my purpose:
>  ylwrap configf_lexer.l lex.configf_yy.c configf_lexer.c \>        -- flex --case-insensitive --prefix=configf_yy
Could you point to me how to compose my files of "configure.ac" and/or
"Makefile.am" to let "ylwrap" takes the exact OUTPUT and DESIRED that
I want?

Very often, I have multiple pairs of *.y and *.l files to be linked
together and this --prefix=<STRING> makes it possible.  And thus I
have a need to flexibly specify the OUTPUT and DESIRED as needed.

BTW, --prefix=<STRING> lets flex to generate "<STRING>text" in place
of "yytext" in the generated file.

-- Joe
----------------------------------
Joseph Chen