From 6dde1c82cd2961df2fcb508b694d64b4d485f279 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 27 Sep 2004 07:45:09 +0000 Subject: [PATCH] * data/lalr1.cc (b4_parse_param_decl_1): New. (b4_parse_param_decl): Use it to have different names bw attribute and argument names. (b4_cc_constructor_call): Likewise. --- ChangeLog | 7 +++++++ data/lalr1.cc | 19 ++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e61781c7..8b8c125e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-09-27 Akim Demaille + + * data/lalr1.cc (b4_parse_param_decl_1): New. + (b4_parse_param_decl): Use it to have different names bw attribute + and argument names. + (b4_cc_constructor_call): Likewise. + 2004-09-24 Akim Demaille * src/parse-gram.y (add_param): Strip the leading and trailing diff --git a/data/lalr1.cc b/data/lalr1.cc index 8ff462a9..00090e7a 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -83,13 +83,22 @@ m4_define([b4_constructor], # b4_parse_param_decl # ------------------- -# Constructor's extra arguments. +# Extra formal arguments of the constructor. +# Change the parameter names from "foo" into "foo_yyarg", so that +# there is no collision bw the user chosen attribute name, and the +# argument name in the constructor. m4_define([b4_parse_param_decl], - [m4_ifset([b4_parse_param], [, b4_c_ansi_formals(b4_parse_param)])]) +[m4_ifset([b4_parse_param], + [, m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])]) + +m4_define([b4_parse_param_decl_1], +[$1_yyarg]) + + # b4_parse_param_cons # ------------------- -# constructor's extra initialisations. +# Extra initialisations of the constructor. m4_define([b4_parse_param_cons], [m4_ifset([b4_parse_param], [, @@ -98,11 +107,11 @@ m4_define([b4_cc_constructor_calls], [m4_map_sep([b4_cc_constructor_call], [, ], [$@])]) m4_define([b4_cc_constructor_call], - [$2($2)]) + [$2 ($2_yyarg)]) # b4_parse_param_vars # ------------------- -# Extra instance variables. +# Extra instance variables. m4_define([b4_parse_param_vars], [m4_ifset([b4_parse_param], [ -- 2.45.2