bison-patches
[Top][All Lists]
Advanced

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

diagnostics: rename --style=debug as --color=debug


From: Akim Demaille
Subject: diagnostics: rename --style=debug as --color=debug
Date: Wed, 8 May 2019 16:33:58 +0200

commit 0269c6fb030f6abcfb3c5d808fba86b8e02000ea
Author: Akim Demaille <address@hidden>
Date:   Wed May 8 09:06:12 2019 +0200

    diagnostics: rename --style=debug as --color=debug
    
    It is more consistent with --color=html, --color=test, etc.
    
    * src/getargs.h, src/getargs.c (style_debug): Rename as...
    (color_debug): this.
    (getargs_colors): Rename --style=debug as --color=debug.
    Adjust dependencies.

diff --git a/src/complain.c b/src/complain.c
index b6412441..04d7bebd 100644
--- a/src/complain.c
+++ b/src/complain.c
@@ -72,7 +72,7 @@ begin_use_class (const char *s, FILE *out)
 {
   if (out == stderr)
     {
-      if (style_debug)
+      if (color_debug)
         fprintf (out, "<%s>", s);
       else
         {
@@ -87,7 +87,7 @@ end_use_class (const char *s, FILE *out)
 {
   if (out == stderr)
     {
-      if (style_debug)
+      if (color_debug)
         fprintf (out, "</%s>", s);
       else
         {
diff --git a/src/getargs.c b/src/getargs.c
index 080ef352..4fbc3d9c 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -45,7 +45,7 @@ bool no_lines_flag = false;
 bool token_table_flag = false;
 location yacc_loc = EMPTY_LOCATION_INIT;
 bool update_flag = false; /* for -u */
-bool style_debug = false; /* --style=debug. */
+bool color_debug = false; /* --style=debug. */
 
 bool nondeterministic_parser = false;
 bool glr_parser = false;
@@ -596,14 +596,17 @@ getargs_colors (int argc, char *argv[])
     {
       const char *arg = argv[i];
       if (STRPREFIX_LIT ("--color=", arg))
-        handle_color_option (arg + strlen ("--color="));
+        {
+          const char *color = arg + strlen ("--color=");
+          if (STREQ (color, "debug"))
+            color_debug = true;
+          else
+            handle_color_option (color);
+        }
       else if (STRPREFIX_LIT ("--style=", arg))
         {
           const char *style = arg + strlen ("--style=");
-          if (STREQ (style, "debug"))
-            style_debug = true;
-          else
-            handle_style_option (style);
+          handle_style_option (style);
         }
     }
   complain_init_color ();
diff --git a/src/getargs.h b/src/getargs.h
index 27fb0fad..0cc4daed 100644
--- a/src/getargs.h
+++ b/src/getargs.h
@@ -41,7 +41,7 @@ extern bool no_lines_flag;              /* for -l */
 extern bool token_table_flag;           /* for -k */
 extern location yacc_loc;               /* for -y */
 extern bool update_flag;                /* for -u */
-extern bool style_debug;                /* --style=debug. */
+extern bool color_debug;                /* --color=debug. */
 /* GLR_PARSER is true if the input file says to use the GLR
    (Generalized LR) parser, and to output some additional information
    used by the GLR algorithm.  */
diff --git a/tests/diagnostics.at b/tests/diagnostics.at
index 80e85af2..fb24fbcf 100644
--- a/tests/diagnostics.at
+++ b/tests/diagnostics.at
@@ -45,7 +45,7 @@ AT_CHECK([perl -p -e 's{</?\w+>}{}g' <experr.orig >experr])
 AT_CHECK([LC_ALL=en_US.UTF-8 bison -fcaret -Wall input.y], [$3], [], [experr])
 
 AT_CHECK([cp experr.orig experr])
-AT_CHECK([LC_ALL=en_US.UTF-8 bison -fcaret --style=debug -Wall input.y], [$3], 
[], [experr])
+AT_CHECK([LC_ALL=en_US.UTF-8 bison -fcaret --color=debug -Wall input.y], [$3], 
[], [experr])
 
 AT_BISON_OPTION_POPDEFS
 




reply via email to

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