Re: how to get left hand side symbol in action

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <[email protected]>
Hi Christian,

CC'd to help-bison FTR.

> Le 7 juin 2020 à 18:17, Christian Schoenebeck <[email protected]> a écrit :
> 
> Hi Akim,
> 
> I just realized that you removed YYTERROR from Bison.

YYTERROR was not a documented feature.  I'm curious: how did you use it?

Bison 3.6 introduce symbol kinds, e.g., for Bison itself:

enum yysymbol_kind_t
{
  YYSYMBOL_YYEMPTY = -2,
  YYSYMBOL_YYEOF = 0,                      /* "end of file"  */
  YYSYMBOL_YYerror = 1,                    /* error  */
  YYSYMBOL_YYUNDEF = 2,                    /* "invalid token"  */
  YYSYMBOL_STRING = 3,                     /* "string"  */
  YYSYMBOL_TSTRING = 4,                    /* "translatable string"  */
  YYSYMBOL_PERCENT_TOKEN = 5,              /* "%token"  */
  YYSYMBOL_PERCENT_NTERM = 6,              /* "%nterm"  */
  YYSYMBOL_PERCENT_TYPE = 7,               /* "%type"  */


so something like this should help supporting both:

#ifndef YYTERROR
# define YYTERROR YYSYMBOL_YYerror
#endif

Unfortunately it sends the present into the past instead of the converse.  Alternatively

#ifdef YYTERROR
# define YYSYMBOL_YYerror YYTERROR
#endif

or something like that, should allow you to use the public interface with earlier versions of Bison.

> As I have to preserve backward compatibility to older Bison versions, that 
> hard change is exactly Bison >= 3.6.0, correct?

Yup.  What is your current requirement?

Cheers!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.