help-bison
[Top][All Lists]
Advanced

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

Re: Name clash with token type BEGIN


From: Joel E. Denny
Subject: Re: Name clash with token type BEGIN
Date: Tue, 29 Dec 2009 15:28:53 -0500 (EST)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Tue, 29 Dec 2009, August Karlstrom wrote:

> Joel E. Denny wrote:
> > I'm guessing your parser.h is included in a scanner generated by Flex, which
> > defines the macro BEGIN.
> 
> Yes, that's the case. Do you know if there is there a way around this or do I
> have to add a prefix to the token (or all tokens for sake of consistency)?

I think you'll have to change the name somehow.

Bison 2.6 should provide api.tokens.prefix to do this automatically, but 
it's going to be a while before 2.6 is released.

> Obviously, the recommendation in the Bison manual of using the same name for a
> reserved words and its corresponding tokens cannot be followed in the general
> case when using Flex and Bison in tandem.
>
> I guess Flex is to blame here -
> BEGIN should have been named something like YY_BEGIN.

I agree.  Of course, we're probably a few decades too late to change the 
default Flex behavior, which is inherited from Lex and specified by POSIX.  
However, it would be nice if Flex provided an option to avoid namespace 
pollution.  (If there's something already, I missed it in the manual.)




reply via email to

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