c++: variants: fuse declarations and definitions

We used to create a short definition of yy::parser with all the
implementations of its member functions outside.  But yy::parser is no
longer short and simple to read.  Maintaining each function twice is
painful: a lot of redundancy but different indentation levels, output
which depends on whether we are in a header or not (see
d132c2d545), etc.

Let's simplify this and put the implementations into the class
definition itself.

Discussed in this monologue:
https://lists.gnu.org/archive/html/bison-patches/2018-12/msg00058.html.

* data/skeletons/c++.m4, data/skeletons/lalr1.cc,
* data/skeletons/variant.hh (b4_basic_symbol_constructor_define)
(_b4_token_constructor_declare, b4_token_constructor_declare)
Merge into...
(b4_basic_symbol_constructor_define, _b4_token_constructor_define)
(b4_token_constructor_define): these.
This commit is contained in:
Akim Demaille
2018-12-26 09:04:07 +01:00
parent 50285ff066
commit 5fb0d276b3
3 changed files with 82 additions and 154 deletions

View File

@@ -180,7 +180,7 @@ m4_define([b4_shared_declarations],
{
public:
]b4_public_types_declare[
]b4_symbol_type_declare[
]b4_symbol_type_define[
/// Build a parser object.
]b4_parser_class_name[ (]b4_parse_param_decl[);
virtual ~]b4_parser_class_name[ ();
@@ -215,7 +215,7 @@ m4_define([b4_shared_declarations],
/// Report a syntax error.
void error (const syntax_error& err);
]b4_token_constructor_declare[
]b4_token_constructor_define[
private:
/// This class is not copyable.