bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: header guards in lalr1.cc (bison 2.3)


From: Hans Aberg
Subject: Re: header guards in lalr1.cc (bison 2.3)
Date: Wed, 2 Aug 2006 08:51:22 +0200


On 1 Aug 2006, at 16:06, Alexandre Duret-Lutz wrote:

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.

My guess is that these header guards ought to include the %name- prefix name somehow.

Similarly, %name-prefix name ought to be used to create a suitable C+ + 'namespace'.

That would resolve your problem, wouldn't it?

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]