mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-27 13:13:04 +00:00
style: isolate the creation of tname in a function
* src/output.c (prepare_symbol_names): New. Use it.
This commit is contained in:
49
src/output.c
49
src/output.c
@@ -137,27 +137,13 @@ string_output (FILE *out, char const *string)
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------.
|
||||
| Prepare the muscles related to the symbols: translate, tname, and |
|
||||
| toknum. |
|
||||
`------------------------------------------------------------------*/
|
||||
/*----------------------------.
|
||||
| Prepare the symbols names. |
|
||||
`----------------------------*/
|
||||
|
||||
static void
|
||||
prepare_symbols (void)
|
||||
prepare_symbol_names (char const *muscle_name)
|
||||
{
|
||||
MUSCLE_INSERT_INT ("tokens_number", ntokens);
|
||||
MUSCLE_INSERT_INT ("nterms_number", nvars);
|
||||
MUSCLE_INSERT_INT ("symbols_number", nsyms);
|
||||
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->content->number);
|
||||
MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number);
|
||||
|
||||
muscle_insert_symbol_number_table ("translate",
|
||||
token_translations,
|
||||
token_translations[0],
|
||||
1, max_user_token_number + 1);
|
||||
|
||||
/* tname -- token names. */
|
||||
{
|
||||
/* We assume that the table will be output starting at column 2. */
|
||||
int j = 2;
|
||||
struct quoting_options *qo = clone_quoting_options (0);
|
||||
@@ -187,8 +173,31 @@ prepare_symbols (void)
|
||||
obstack_sgrow (&format_obstack, " ]b4_null[");
|
||||
|
||||
/* Finish table and store. */
|
||||
muscle_insert ("tname", obstack_finish0 (&format_obstack));
|
||||
}
|
||||
muscle_insert (muscle_name, obstack_finish0 (&format_obstack));
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------.
|
||||
| Prepare the muscles related to the symbols: translate, tname, and |
|
||||
| toknum. |
|
||||
`------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
prepare_symbols (void)
|
||||
{
|
||||
MUSCLE_INSERT_INT ("tokens_number", ntokens);
|
||||
MUSCLE_INSERT_INT ("nterms_number", nvars);
|
||||
MUSCLE_INSERT_INT ("symbols_number", nsyms);
|
||||
MUSCLE_INSERT_INT ("undef_token_number", undeftoken->content->number);
|
||||
MUSCLE_INSERT_INT ("user_token_number_max", max_user_token_number);
|
||||
|
||||
muscle_insert_symbol_number_table ("translate",
|
||||
token_translations,
|
||||
token_translations[0],
|
||||
1, max_user_token_number + 1);
|
||||
|
||||
/* tname -- token names. */
|
||||
prepare_symbol_names ("tname");
|
||||
|
||||
/* Output YYTOKNUM. */
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user