bug-bison
[Top][All Lists]
Advanced

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

api.location.type is unsupported for C parsers


From: Scheidler , Balázs
Subject: api.location.type is unsupported for C parsers
Date: Thu, 18 Apr 2019 21:06:58 +0200

Hi,

I was trying to migrate to using the new directives of bison 3.3. My
use-case is somewhat special, in the sense that we generate dozens of
parsers using bison, which all use the same YYLTYPE and YYSTYPE.

Previously we used %name-prefix, which didn't rename those typedefs and
always used YYLTYPE/YYSTYPE which although pretty limited, worked for us.

Now, %api.prefix rightfully renames these too. However I'd like to define
these to the same typedefs.

I've found %api.value.type and %api.location.type, the first one seems to
work, but %api.location.type is not supported by the C backend, and we get
the following error:

/build/modules/date/date-grammar.y:51.9-25: error: %define variable
'api.location.type' is not used
 %define api.location.type {MAIN_STYPE}
         ^^^^^^^^^^^^^^^^^

I guess this should be modified in c.m4 somehow, but I am not versed enough
in the m4 macro magic to submit a patch:

# b4_location_type_define
# -----------------------
m4_define([b4_location_type_define],
[[/* Location type.  */
#if ! defined ]b4_api_PREFIX[LTYPE && ! defined
]b4_api_PREFIX[LTYPE_IS_DECLARED
typedef struct ]b4_api_PREFIX[LTYPE ]b4_api_PREFIX[LTYPE;
struct ]b4_api_PREFIX[LTYPE
{
  int first_line;
  int first_column;
  int last_line;
  int last_column;
};
# define ]b4_api_PREFIX[LTYPE_IS_DECLARED 1
# define ]b4_api_PREFIX[LTYPE_IS_TRIVIAL 1
#endif
]])

Is this something that is worth considering?
Thanks in advance
Bazsi


reply via email to

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