Hi,

> Le 7 févr. 2019 à 17:43, Peng Yu <pengyu...@gmail.com> 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.
_______________________________________________
help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to