From 4cdcb6f2435fc1582076fede78f6602cb25eaab5 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 17 Jun 2018 18:06:56 +0200 Subject: [PATCH] style: split large function * src/print.c (print_grammar): Split into... (print_terminal_symbols, print_nonterminal_symbols): these. Adjust dependencies. --- src/print.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/print.c b/src/print.c index c41db7aa..99cd629e 100644 --- a/src/print.c +++ b/src/print.c @@ -402,13 +402,11 @@ print_state (FILE *out, state *s) static void -print_grammar (FILE *out) +print_terminal_symbols (FILE *out) { symbol_number i; char buffer[90]; - grammar_rules_print (out); - /* TERMINAL (type #) : rule #s terminal is on RHS */ fprintf (out, "%s\n\n", _("Terminals, with rules where they appear")); for (i = 0; i < max_user_token_number + 1; i++) @@ -435,8 +433,15 @@ print_grammar (FILE *out) fprintf (out, "%s\n", buffer); } 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")); for (i = ntokens; i < nsyms; i++) { @@ -513,7 +518,9 @@ print_results (void) rule_useless_in_parser_p); 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, 'closure' will be run, which needs memory allocation/deallocation. */