[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple lex scanners? How?
From: |
Bob Proulx |
Subject: |
Re: Multiple lex scanners? How? |
Date: |
Wed, 17 Jan 2007 21:54:32 -0700 |
User-agent: |
Mutt/1.5.9i |
Nicolas Joly wrote:
> Bob Proulx wrote:
> > What is the best practice for organizing a program that includes
> > multiple lex generated scanners?
>
> I encountered the same problem ... and made the following constructs
> that did the trick (at least for me).
>
> AUTOMAKE_OPTIONS = subdir-objects
>
> AM_YFLAGS = -d -p `basename $* | sed 's,y$$,,'`
> AM_LFLAGS = -s -P`basename $* | sed 's,l$$,,'` -olex.yy.c
That is very clever. I like it. The -P option solves the renames
completely but flex renames the output file but the -o solves that
problem. Very nice!
In my case I might need to generate a mapping from filename to symbol
name (instead of your case using sed) because the legacy code I am
dealing with does not use the filenames for the symbol names. In my
case the filenames are long and the symbols are short. But I can deal
with that reasonably enough.
So for the mail archive my case might be:
AM_LFLAGS = -s -P`basename $* | sed 's|ascscan|asc_|;s|gdsscan|gds_|'`
-olex.yy.c
I expect that mapping to be very filename and symbol name specific.
> Hope this helps,
Very much so. I think there might be room for improvement in some way
to make this easier but I am not sure what to suggest.
Thanks!
Bob