mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-20 01:33:03 +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:
47
src/output.c
47
src/output.c
@@ -137,26 +137,12 @@ string_output (FILE *out, char const *string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------.
|
/*----------------------------.
|
||||||
| Prepare the muscles related to the symbols: translate, tname, and |
|
| Prepare the symbols names. |
|
||||||
| toknum. |
|
`----------------------------*/
|
||||||
`------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
static void
|
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. */
|
/* We assume that the table will be output starting at column 2. */
|
||||||
int j = 2;
|
int j = 2;
|
||||||
@@ -187,9 +173,32 @@ prepare_symbols (void)
|
|||||||
obstack_sgrow (&format_obstack, " ]b4_null[");
|
obstack_sgrow (&format_obstack, " ]b4_null[");
|
||||||
|
|
||||||
/* Finish table and store. */
|
/* 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. */
|
/* Output YYTOKNUM. */
|
||||||
{
|
{
|
||||||
int *values = xnmalloc (ntokens, sizeof *values);
|
int *values = xnmalloc (ntokens, sizeof *values);
|
||||||
|
|||||||
Reference in New Issue
Block a user