[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
header guards in lalr1.cc (bison 2.3)
From: |
Alexandre Duret-Lutz |
Subject: |
header guards in lalr1.cc (bison 2.3) |
Date: |
Tue, 01 Aug 2006 16:06:54 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
Hi folks!
The library I'm working on contains several lalr1.cc parsers
calling each others. Each parser has its own, unique, %name-prefix.
In the current implementation, using %name-prefix sets the
namespace for the classes location and position as well as the
for parser itself.
My problem is that one of my parser needs to handle the
locations of another parser as well as its own. So
basically it should include the "location.hh" generated by
Bison for the two parsers. Unfortunately both files start with
the same guard :
| #ifndef BISON_LOCATION_HH
| # define BISON_LOCATION_HH
Likewise for position.hh. So I have to insert some unpleasant
"#undefine BISON_LOCATION_HH" and "#undefine BISON_POSITION_HH"
at some point between the two inclusions. Yuck.
I'd like to suggest two ways to improve bison in this area :
1) Do not use hard-coded headers.
Any reason all these guards can't use b4_namespace?
2) Provide a way to control the namespace in which the classes
position and location are defined. Since all these classes
are identical, I see no reason to define them in different
namespaces. It looks like a waste of memory, and more
importantly it makes mixing locations from different parsers
a lot harder.
--
Alexandre Duret-Lutz
- header guards in lalr1.cc (bison 2.3),
Alexandre Duret-Lutz <=