[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Where are there both yytokentype and the corresponding macro definit
From: |
Akim Demaille |
Subject: |
Re: Where are there both yytokentype and the corresponding macro definitions? |
Date: |
Thu, 7 Feb 2019 19:43:55 +0100 |
Hi,
> Le 7 févr. 2019 à 17:43, Peng Yu <address@hidden> a écrit :
>
> Hi,
>
> I see both yytokentype and the corresponding macro definitions in
> y.tab.h. It sounds like just one of them will be sufficient. Why are
> there both of them?
>
> /* Token type. */
> #ifndef YYTOKENTYPE
> # define YYTOKENTYPE
> enum yytokentype
> {
> IF = 258,
>
> /* Tokens. */
> #define IF 258
You don't specify the version of Bison you ran. Let's assume it was an ancient
version, say 2.3 for instance. In which case I read this:
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
IF = 258
};
#endif
/* Tokens. */
#define IF 258
which has some quite explicit comments.
If you take a recent version of Bison, you'll get this:
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
IF = 258
};
#endif
and nothing else.
Cheers.