[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
multiple lalr1.cc scanners
From: |
Alexandre Duret-Lutz |
Subject: |
multiple lalr1.cc scanners |
Date: |
11 Jun 2003 11:03:53 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.3 |
I'm working on a C++ project where
1) I'd like to use the lalr1.cc skeleton
2) I need to use many scanner
Unfortunately, these two points seem contradictory presently.
The lalr1.cc skelton will always output yy::Position,
yy::Location, yy::Stack, and yy::Parser classes, and it will
always call yylex().
%name-prefix is ignored, but it's unclear what it's action would
be. I think it should rename yylex(), but changing the yy::
namespace sounds unwanted: that would cause needless duplication
of yy::Position, yy::Location, and yy::Stack. From the
yy::Traits code is suspect the intent is to allow several
parsers with different name to share the same namespace.
Does this means another %option is needed to renamed the Parser?
Since I need it, I'm willing to work on it (provided someone else
can fix the present test suite failures first), but I just don't
know which way you want to go.
FWIW, I'm playing the following trick by the meantime:
namespace tgbayy
{
using namespace yy;
}
#define yy tgbayy
#define yylex tgbayylex
the above is inserted in a way that just the parser appears in
a separate namespace. yy::Position, yy::Location, and yy::Stack
remain in namespace yy. Yes, it's ugly.
--
Alexandre Duret-Lutz
- multiple lalr1.cc scanners,
Alexandre Duret-Lutz <=