lalr1.cc: rename lex_symbol as api.token.constructor

* data/bison.m4 (b4_lex_symbol_if): Rename as...
(b4_token_ctor_if): this.
Depend upon api.token.constructor.
* data/c++.m4, data/lalr1.cc: Adjust.
* doc/bison.texi: Fix all the occurrences of lex_symbol.
* etc/bench.pl.in: Adjust.
* examples/variant.yy: Likewise.

* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Handle AT_TOKEN_CTOR_IF.
* tests/c++.at: Adjust to using api.token.constructor and AT_TOKEN_CTOR_IF.
Simplify the test of both build call styles.
(AT_CHECK_VARIANTS): Rename as...
(AT_TEST): this.
And undef when done.
This commit is contained in:
Akim Demaille
2012-11-01 17:54:13 +01:00
parent 0b3287025d
commit e36ec1f41f
8 changed files with 112 additions and 116 deletions

View File

@@ -796,10 +796,10 @@ m4_percent_define_default([[api.token.prefix]], [[]])
# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
# b4_lex_symbol_if([IF-YYLEX-RETURNS-A-COMPLETE-SYMBOL], [IF-NOT])
# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
# ----------------------------------------------
b4_percent_define_if_define([lex_symbol])
b4_percent_define_if_define([token_ctor], [api.token.constructor])
b4_percent_define_if_define([locations]) # Whether locations are tracked.
b4_percent_define_if_define([parse.assert])
b4_percent_define_if_define([parse.trace])

View File

@@ -300,7 +300,7 @@ m4_define([b4_public_types_define],
{
return type;
}
]b4_lex_symbol_if([[
]b4_token_ctor_if([[
inline
]b4_parser_class_name[::token_type
]b4_parser_class_name[::symbol_type::token () const
@@ -335,7 +335,7 @@ m4_define([b4_symbol_constructor_define], [])
m4_define([b4_yytranslate_define],
[[ // Symbol number corresponding to token number t.
]b4_parser_class_name[::token_number_type
]b4_parser_class_name[::yytranslate_ (]b4_lex_symbol_if([token_type],
]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
[int])[ t)
{
static

View File

@@ -239,7 +239,7 @@ b4_location_define])])])[
#endif // ]b4_api_PREFIX[DEBUG
/// Convert a scanner token number \a t to a symbol number.
static inline token_number_type yytranslate_ (]b4_lex_symbol_if([token_type], [int])[ t);
static inline token_number_type yytranslate_ (]b4_token_ctor_if([token_type], [int])[ t);
#if ]b4_api_PREFIX[DEBUG
/// \brief Display a symbol type, value and location.
@@ -320,7 +320,7 @@ b4_location_define])])])[
]b4_parse_param_vars[
};
]b4_lex_symbol_if([b4_yytranslate_define
]b4_token_ctor_if([b4_yytranslate_define
b4_public_types_define])[
]b4_namespace_close[
@@ -500,7 +500,7 @@ m4_if(b4_prefix, [yy], [],
| Symbol types. |
`---------------*/
]b4_lex_symbol_if([], [b4_public_types_define])[
]b4_token_ctor_if([], [b4_public_types_define])[
// stack_symbol_type.
]b4_parser_class_name[::stack_symbol_type::stack_symbol_type ()
@@ -726,7 +726,7 @@ b4_dollar_popdef])[]dnl
YYCDEBUG << "Reading a token: ";
try
{
]b4_lex_symbol_if(
]b4_token_ctor_if(
[ yyla = b4_function_call([yylex], [symbol_type],
m4_ifdef([b4_lex_param], b4_lex_param));],
[ yyla.type = yytranslate_ (b4_function_call([yylex], [int],
@@ -1138,7 +1138,7 @@ b4_error_verbose_if([state_type yystate, int yytoken],
}
#endif // ]b4_api_PREFIX[DEBUG
]b4_lex_symbol_if([], [b4_yytranslate_define])[
]b4_token_ctor_if([], [b4_yytranslate_define])[
]b4_namespace_close[
]b4_epilogue[]dnl
m4_divert_pop(0)