summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-05-08 09:06:12 +0200
committerAkim Demaille <akim.demaille@gmail.com>2019-05-08 13:36:47 +0200
commit0269c6fb030f6abcfb3c5d808fba86b8e02000ea (patch)
treea90a5a9dac8c67698bce9ca8e2fd4c3c26eff963
parent23e536af498ac6ecb42cb00a0bd09bf34835126f (diff)
downloadbison-0269c6fb030f6abcfb3c5d808fba86b8e02000ea.tar.gz
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.
-rw-r--r--src/complain.c4
-rw-r--r--src/getargs.c15
-rw-r--r--src/getargs.h2
-rw-r--r--tests/diagnostics.at2
4 files changed, 13 insertions, 10 deletions
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