mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 16:23:04 +00:00
style: split large function
* src/print.c (print_grammar): Split into... (print_terminal_symbols, print_nonterminal_symbols): these. Adjust dependencies.
This commit is contained in:
15
src/print.c
15
src/print.c
@@ -402,13 +402,11 @@ print_state (FILE *out, state *s)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_grammar (FILE *out)
|
print_terminal_symbols (FILE *out)
|
||||||
{
|
{
|
||||||
symbol_number i;
|
symbol_number i;
|
||||||
char buffer[90];
|
char buffer[90];
|
||||||
|
|
||||||
grammar_rules_print (out);
|
|
||||||
|
|
||||||
/* TERMINAL (type #) : rule #s terminal is on RHS */
|
/* TERMINAL (type #) : rule #s terminal is on RHS */
|
||||||
fprintf (out, "%s\n\n", _("Terminals, with rules where they appear"));
|
fprintf (out, "%s\n\n", _("Terminals, with rules where they appear"));
|
||||||
for (i = 0; i < max_user_token_number + 1; i++)
|
for (i = 0; i < max_user_token_number + 1; i++)
|
||||||
@@ -435,8 +433,15 @@ print_grammar (FILE *out)
|
|||||||
fprintf (out, "%s\n", buffer);
|
fprintf (out, "%s\n", buffer);
|
||||||
}
|
}
|
||||||
fputs ("\n\n", out);
|
fputs ("\n\n", out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_nonterminal_symbols (FILE *out)
|
||||||
|
{
|
||||||
|
symbol_number i;
|
||||||
|
char buffer[90];
|
||||||
|
|
||||||
fprintf (out, "%s\n\n", _("Nonterminals, with rules where they appear"));
|
fprintf (out, "%s\n\n", _("Nonterminals, with rules where they appear"));
|
||||||
for (i = ntokens; i < nsyms; i++)
|
for (i = ntokens; i < nsyms; i++)
|
||||||
{
|
{
|
||||||
@@ -513,7 +518,9 @@ print_results (void)
|
|||||||
rule_useless_in_parser_p);
|
rule_useless_in_parser_p);
|
||||||
conflicts_output (out);
|
conflicts_output (out);
|
||||||
|
|
||||||
print_grammar (out);
|
grammar_rules_print (out);
|
||||||
|
print_terminal_symbols (out);
|
||||||
|
print_nonterminal_symbols (out);
|
||||||
|
|
||||||
/* If the whole state item sets, not only the kernels, are wanted,
|
/* If the whole state item sets, not only the kernels, are wanted,
|
||||||
'closure' will be run, which needs memory allocation/deallocation. */
|
'closure' will be run, which needs memory allocation/deallocation. */
|
||||||
|
|||||||
Reference in New Issue
Block a user