* data/bison.c++: Make the user able to add members to the generated

parser by subclassing.
This commit is contained in:
Robert Anisko
2002-03-09 14:31:16 +00:00
parent e69bfebb45
commit af27eacb6a
2 changed files with 29 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
2002-03-09 Robert Anisko <robert@lrde.epita.fr>
* data/bison.c++: Make the user able to add members to the generated
parser by subclassing.
2002-03-05 Robert Anisko <robert@lrde.epita.fr> 2002-03-05 Robert Anisko <robert@lrde.epita.fr>
* src/reader.c (read_additionnal_code): `c' should be an integer, not * src/reader.c (read_additionnal_code): `c' should be an integer, not

View File

@@ -25,6 +25,24 @@ m4_define_default([b4_header_guard],
[m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name), [m4_bpatsubst(m4_toupper([BISON_]b4_output_header_name),
[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])]) [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]], [_])])
m4_define([b4_inherit],
[m4_ifdef([b4_root],
[: public b4_root
],
[])])
m4_define([b4_param],
[m4_ifdef([b4_root],
[,
const Param& param],
[])])
m4_define([b4_constructor],
[m4_ifdef([b4_root],
[b4_root (param),
],
[])])
m4_define([b4_copyright], m4_define([b4_copyright],
[/* -*- C++ -*- */ [/* -*- C++ -*- */
/* A Bison parser, made from b4_filename, /* A Bison parser, made from b4_filename,
@@ -126,7 +144,7 @@ namespace yy
namespace yy namespace yy
{ {
class b4_name class b4_name b4_inherit
{ {
public: public:
@@ -140,10 +158,12 @@ namespace yy
#if YYLSP_NEEDED #if YYLSP_NEEDED
b4_name (bool debug, b4_name (bool debug,
LocationType initlocation) : debug_ (debug), LocationType initlocation[]b4_param) :
b4_constructor[]debug_ (debug),
initlocation_ (initlocation) initlocation_ (initlocation)
#else #else
b4_name (bool debug) : debug_ (debug) b4_name (bool debug[]b4_param) :
b4_constructor[]debug_ (debug)
#endif #endif
{ {
} }