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.
This commit is contained in:
Akim Demaille
2012-08-02 14:24:15 +02:00
parent 86027be930
commit 710c4a6571
4 changed files with 23 additions and 23 deletions

View File

@@ -206,23 +206,23 @@ m4_define([b4_subtract],
[m4_eval([$1 - $2])], [m4_eval([$1 - $2])],
[($1) - ($2)])]) [($1) - ($2)])])
# b4_args(ARG1, ...) # b4_join(ARG1, ...)
# _b4_args(ARG1, ...) # _b4_join(ARG1, ...)
# ------------------- # -------------------
# Join with comma, skipping empty arguments. # Join with comma, skipping empty arguments.
# b4_args calls itself recursively until it sees the first non-empty # b4_join calls itself recursively until it sees the first non-empty
# argument, then calls _b4_args which prepends each non-empty argument # argument, then calls _b4_join which prepends each non-empty argument
# with a comma. # with a comma.
m4_define([b4_args], m4_define([b4_join],
[m4_if([$#$1], [m4_if([$#$1],
[1], [], [1], [],
[m4_ifval([$1], [m4_ifval([$1],
[$1[]_$0(m4_shift($@))], [$1[]_$0(m4_shift($@))],
[$0(m4_shift($@))])])]) [$0(m4_shift($@))])])])
# _b4_args(ARGS1, ...) # _b4_join(ARGS1, ...)
# -------------------- # --------------------
m4_define([_b4_args], m4_define([_b4_join],
[m4_if([$#$1], [m4_if([$#$1],
[1], [], [1], [],
[m4_ifval([$1], [, $1])[]$0(m4_shift($@))])]) [m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])

View File

@@ -158,7 +158,7 @@ m4_define([b4_public_types_declare],
/// Constructor.]b4_locations_if([ /// Constructor.]b4_locations_if([
inline symbol_base_type (const location_type& l)])[; inline symbol_base_type (const location_type& l)])[;
inline symbol_base_type (]b4_args( inline symbol_base_type (]b4_join(
[const semantic_type& v], [const semantic_type& v],
b4_locations_if([const location_type& l]))[); b4_locations_if([const location_type& l]))[);
@@ -186,12 +186,12 @@ m4_define([b4_public_types_declare],
inline symbol_type (); inline symbol_type ();
/// Constructor for tokens with semantic value. /// 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], [const semantic_type& v],
b4_locations_if([const location_type& l]))[); b4_locations_if([const location_type& l]))[);
/// Constructor for valueless tokens. /// 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]))[); b4_locations_if([const location_type& l]))[);
/// The symbol type. /// The symbol type.
@@ -235,7 +235,7 @@ m4_define([b4_public_types_define],
template <typename Exact> template <typename Exact>
inline inline
]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (]b4_args( ]b4_parser_class_name[::symbol_base_type<Exact>::symbol_base_type (]b4_join(
[const semantic_type& v], [const semantic_type& v],
b4_locations_if([const location_type& l]))[) b4_locations_if([const location_type& l]))[)
: value(v)]b4_locations_if([ : value(v)]b4_locations_if([
@@ -276,7 +276,7 @@ m4_define([b4_public_types_define],
} }
inline inline
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args( ]b4_parser_class_name[::symbol_type::symbol_type (]b4_join(
[token_type t], [token_type t],
b4_locations_if([const location_type& l]))[) b4_locations_if([const location_type& l]))[)
: super_type (]b4_locations_if([l])[) : super_type (]b4_locations_if([l])[)
@@ -285,7 +285,7 @@ m4_define([b4_public_types_define],
} }
inline inline
]b4_parser_class_name[::symbol_type::symbol_type (]b4_args( ]b4_parser_class_name[::symbol_type::symbol_type (]b4_join(
[token_type t], [token_type t],
[const semantic_type& v], [const semantic_type& v],
b4_locations_if([const location_type& l]))[) b4_locations_if([const location_type& l]))[)

View File

@@ -269,7 +269,7 @@ b4_location_define])])])[
inline stack_symbol_type (); inline stack_symbol_type ();
/// Constructor. /// Constructor.
inline stack_symbol_type (]b4_args([state_type s], inline stack_symbol_type (]b4_join([state_type s],
[const semantic_type& v], [const semantic_type& v],
b4_locations_if([const location_type& l]))[); 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], [state_type s],
[const semantic_type& v], [const semantic_type& v],
b4_locations_if([const location_type& l]))[) b4_locations_if([const location_type& l]))[)
@@ -575,13 +575,13 @@ m4_if(b4_prefix, [yy], [],
if (m) if (m)
YY_SYMBOL_PRINT (m, sym); YY_SYMBOL_PRINT (m, sym);
]b4_variant_if( ]b4_variant_if(
[[ yystack_.push (stack_symbol_type (]b4_args( [[ yystack_.push (stack_symbol_type (]b4_join(
[s], [s],
[semantic_type()], [semantic_type()],
b4_locations_if([sym.location]))[)); b4_locations_if([sym.location]))[));
]b4_symbol_variant([[yystos_[s]]], [[yystack_[0].value]], ]b4_symbol_variant([[yystos_[s]]], [[yystack_[0].value]],
[build], [sym.value])], [build], [sym.value])],
[[ yystack_.push (stack_symbol_type (]b4_args( [[ yystack_.push (stack_symbol_type (]b4_join(
[s], [s],
[sym.value], [sym.value],
b4_locations_if([sym.location]))[));]])[ b4_locations_if([sym.location]))[));]])[
@@ -593,7 +593,7 @@ m4_if(b4_prefix, [yy], [],
if (m) if (m)
YY_SYMBOL_PRINT (m, s); YY_SYMBOL_PRINT (m, s);
]b4_variant_if( ]b4_variant_if(
[[ yystack_.push (stack_symbol_type (]b4_args( [[ yystack_.push (stack_symbol_type (]b4_join(
[s.state], [s.state],
[semantic_type()], [semantic_type()],
b4_locations_if([s.location]))[)); b4_locations_if([s.location]))[));
@@ -852,7 +852,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
if (!yyerrstatus_) if (!yyerrstatus_)
{ {
++yynerrs_; ++yynerrs_;
error (]b4_args(b4_locations_if([yyla.location]), error (]b4_join(b4_locations_if([yyla.location]),
[[yysyntax_error_ (yystack_[0].state, [[yysyntax_error_ (yystack_[0].state,
yyempty ? yyempty_ : yyla.type)]])[); yyempty ? yyempty_ : yyla.type)]])[);
} }
@@ -967,7 +967,7 @@ m4_ifdef([b4_lex_param], [, ]b4_lex_param)));])[
void void
]b4_parser_class_name[::error (const syntax_error& yyexc) ]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()]])[); [[yyexc.what()]])[);
} }

View File

@@ -233,7 +233,7 @@ m4_define([b4_symbol_constructor_declare_],
[ static inline [ static inline
symbol_type symbol_type
make_[]b4_symbol_([$1], [id]) (dnl 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]), [const b4_symbol([$1], [type])& v]),
b4_locations_if([const location_type& l]))); 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_symbol_if([$1], [is_token], [b4_symbol_if([$1], [has_id],
[ b4_parser_class_name::symbol_type [ b4_parser_class_name::symbol_type
b4_parser_class_name::make_[]b4_symbol_([$1], [id]) (dnl 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]), [const b4_symbol([$1], [type])& v]),
b4_locations_if([const location_type& l]))) 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_symbol_if([$1], [has_type], [v]),
b4_locations_if([l]))); b4_locations_if([l])));
} }