[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to get left hand side symbol in action
From: |
Akim Demaille |
Subject: |
Re: how to get left hand side symbol in action |
Date: |
Mon, 8 Jun 2020 07:46:27 +0200 |
Hi Christian,
CC'd to help-bison FTR.
> Le 7 juin 2020 à 18:17, Christian Schoenebeck <schoenebeck@crudebyte.com> 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!
- Re: how to get left hand side symbol in action,
Akim Demaille <=