bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/4] style: split large function


From: Akim Demaille
Subject: [PATCH 2/4] style: split large function
Date: Mon, 18 Jun 2018 07:33:20 +0200

* 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.   */
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]