From: Akim Demaille Date: Thu, 2 Aug 2012 12:24:15 +0000 (+0200) Subject: skeletons: b4_args -> b4_join to prepare forthcoming changes X-Git-Tag: v2.7.90~363 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/710c4a65711d48674ce330ac140d00f6338fa863 skeletons: b4_args -> b4_join to prepare forthcoming changes * data/bison.m4 (b4_args, _b4_args): Rename as... (b4_join, _b4_join): these. * data/c++.m4, data/lalr1.cc, data/variant.hh: Adjust. --- diff --git a/data/bison.m4 b/data/bison.m4 index f2126ef4..42a548da 100644 --- a/data/bison.m4 +++ b/data/bison.m4 @@ -206,23 +206,23 @@ m4_define([b4_subtract], [m4_eval([$1 - $2])], [($1) - ($2)])]) -# b4_args(ARG1, ...) -# _b4_args(ARG1, ...) +# b4_join(ARG1, ...) +# _b4_join(ARG1, ...) # ------------------- # Join with comma, skipping empty arguments. -# b4_args calls itself recursively until it sees the first non-empty -# argument, then calls _b4_args which prepends each non-empty argument +# b4_join calls itself recursively until it sees the first non-empty +# argument, then calls _b4_join which prepends each non-empty argument # with a comma. -m4_define([b4_args], +m4_define([b4_join], [m4_if([$#$1], [1], [], [m4_ifval([$1], [$1[]_$0(m4_shift($@))], [$0(m4_shift($@))])])]) -# _b4_args(ARGS1, ...) +# _b4_join(ARGS1, ...) # -------------------- -m4_define([_b4_args], +m4_define([_b4_join], [m4_if([$#$1], [1], [], [m4_ifval([$1], [, $1])[]$0(m4_shift($@))])]) diff --git a/data/c++.m4 b/data/c++.m4 index 62374be1..4a7169c3 100644 --- a/data/c++.m4 +++ b/data/c++.m4 @@ -158,7 +158,7 @@ m4_define([b4_public_types_declare], /// Constructor.]b4_locations_if([ inline symbol_base_type (const location_type& l)])[; - inline symbol_base_type (]b4_args( + inline symbol_base_type (]b4_join( [const semantic_type& v], b4_locations_if([const location_type& l]))[); @@ -186,12 +186,12 @@ m4_define([b4_public_types_declare], inline symbol_type (); /// Constructor for tokens with semantic value. - inline symbol_type (]b4_args([token_type t], + inline symbol_type (]b4_join([token_type t], [const semantic_type& v], b4_locations_if([const location_type& l]))[); /// Constructor for valueless tokens. - inline symbol_type (]b4_args([token_type t], + inline symbol_type (]b4_join([token_type t], b4_locations_if([const location_type& l]))[); /// The symbol type. @@ -235,7 +235,7 @@ m4_define([b4_public_types_define], template inline - ]b4_parser_class_name[::symbol_base_type::symbol_base_type (]b4_args( + ]b4_parser_class_name[::symbol_base_type::symbol_base_type (]b4_join( [const semantic_type& v], b4_locations_if([const location_type& l]))[) : value(v)]b4_locations_if([ @@ -276,7 +276,7 @@ m4_define([b4_public_types_define], } inline - ]b4_parser_class_name[::symbol_type::symbol_type (]b4_args( + ]b4_parser_class_name[::symbol_type::symbol_type (]b4_join( [token_type t], b4_locations_if([const location_type& l]))[) : super_type (]b4_locations_if([l])[) @@ -285,7 +285,7 @@ m4_define([b4_public_types_define], } inline - ]b4_parser_class_name[::symbol_type::symbol_type (]b4_args( + ]b4_parser_class_name[::symbol_type::symbol_type (]b4_join( [token_type t], [const semantic_type& v], b4_locations_if([const location_type& l]))[) diff --git a/data/lalr1.cc b/data/lalr1.cc index 8cf20430..b3e46e95 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -269,7 +269,7 @@ b4_location_define])])])[ inline stack_symbol_type (); /// Constructor. - inline stack_symbol_type (]b4_args([state_type s], + inline stack_symbol_type (]b4_join([state_type s], [const semantic_type& v], b4_locations_if([const location_type& l]))[); @@ -509,7 +509,7 @@ m4_if(b4_prefix, [yy], [], { } - ]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (]b4_args( + ]b4_parser_class_name[::stack_symbol_type::stack_symbol_type (]b4_join( [state_type s], [const semantic_type& v], b4_locations_if([const location_type& l]))[) @@ -575,13 +575,13 @@ m4_if(b4_prefix, [yy], [], if (m) YY_SYMBOL_PRINT (m, sym); ]b4_variant_if( -[[ yystack_.push (stack_symbol_type (]b4_args( +[[ yystack_.push (stack_symbol_type (]b4_join( [s], [semantic_type()], b4_locations_if([sym.location]))[)); ]b4_symbol_variant([[yystos_[s]]], [[yystack_[0].value]], [build], [sym.value])], -[[ yystack_.push (stack_symbol_type (]b4_args( +[[ yystack_.push (stack_symbol_type (]b4_join( [s], [sym.value], b4_locations_if([sym.location]))[));]])[ @@ -593,7 +593,7 @@ m4_if(b4_prefix, [yy], [], if (m) YY_SYMBOL_PRINT (m, s); ]b4_variant_if( -[[ yystack_.push (stack_symbol_type (]b4_args( +[[ yystack_.push (stack_symbol_type (]b4_join( [s.state], [semantic_type()], b4_locations_if([s.location]))[)); @@ -852,7 +852,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ if (!yyerrstatus_) { ++yynerrs_; - error (]b4_args(b4_locations_if([yyla.location]), + error (]b4_join(b4_locations_if([yyla.location]), [[yysyntax_error_ (yystack_[0].state, yyempty ? yyempty_ : yyla.type)]])[); } @@ -967,7 +967,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[ void ]b4_parser_class_name[::error (const syntax_error& yyexc) { - error (]b4_args(b4_locations_if([yyexc.location]), + error (]b4_join(b4_locations_if([yyexc.location]), [[yyexc.what()]])[); } diff --git a/data/variant.hh b/data/variant.hh index 5895b297..65f0026e 100644 --- a/data/variant.hh +++ b/data/variant.hh @@ -233,7 +233,7 @@ m4_define([b4_symbol_constructor_declare_], [ static inline symbol_type make_[]b4_symbol_([$1], [id]) (dnl -b4_args(b4_symbol_if([$1], [has_type], +b4_join(b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]), b4_locations_if([const location_type& l]))); @@ -257,11 +257,11 @@ m4_define([b4_symbol_constructor_define_], [b4_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id], [ b4_parser_class_name::symbol_type b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl -b4_args(b4_symbol_if([$1], [has_type], +b4_join(b4_symbol_if([$1], [has_type], [const b4_symbol([$1], [type])& v]), b4_locations_if([const location_type& l]))) { - return symbol_type (b4_args([token::b4_symbol([$1], [id])], + return symbol_type (b4_join([token::b4_symbol([$1], [id])], b4_symbol_if([$1], [has_type], [v]), b4_locations_if([l]))); }