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.
This commit is contained in:
Akim Demaille
2019-05-08 09:06:12 +02:00
parent 23e536af49
commit 0269c6fb03
4 changed files with 13 additions and 10 deletions

View File

@@ -72,7 +72,7 @@ begin_use_class (const char *s, FILE *out)
{ {
if (out == stderr) if (out == stderr)
{ {
if (style_debug) if (color_debug)
fprintf (out, "<%s>", s); fprintf (out, "<%s>", s);
else else
{ {
@@ -87,7 +87,7 @@ end_use_class (const char *s, FILE *out)
{ {
if (out == stderr) if (out == stderr)
{ {
if (style_debug) if (color_debug)
fprintf (out, "</%s>", s); fprintf (out, "</%s>", s);
else else
{ {

View File

@@ -45,7 +45,7 @@ bool no_lines_flag = false;
bool token_table_flag = false; bool token_table_flag = false;
location yacc_loc = EMPTY_LOCATION_INIT; location yacc_loc = EMPTY_LOCATION_INIT;
bool update_flag = false; /* for -u */ bool update_flag = false; /* for -u */
bool style_debug = false; /* --style=debug. */ bool color_debug = false; /* --style=debug. */
bool nondeterministic_parser = false; bool nondeterministic_parser = false;
bool glr_parser = false; bool glr_parser = false;
@@ -596,14 +596,17 @@ getargs_colors (int argc, char *argv[])
{ {
const char *arg = argv[i]; const char *arg = argv[i];
if (STRPREFIX_LIT ("--color=", arg)) 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)) else if (STRPREFIX_LIT ("--style=", arg))
{ {
const char *style = arg + strlen ("--style="); const char *style = arg + strlen ("--style=");
if (STREQ (style, "debug")) handle_style_option (style);
style_debug = true;
else
handle_style_option (style);
} }
} }
complain_init_color (); complain_init_color ();

View File

@@ -41,7 +41,7 @@ extern bool no_lines_flag; /* for -l */
extern bool token_table_flag; /* for -k */ extern bool token_table_flag; /* for -k */
extern location yacc_loc; /* for -y */ extern location yacc_loc; /* for -y */
extern bool update_flag; /* for -u */ 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 /* GLR_PARSER is true if the input file says to use the GLR
(Generalized LR) parser, and to output some additional information (Generalized LR) parser, and to output some additional information
used by the GLR algorithm. */ used by the GLR algorithm. */

View File

@@ -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([LC_ALL=en_US.UTF-8 bison -fcaret -Wall input.y], [$3], [], [experr])
AT_CHECK([cp experr.orig 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 AT_BISON_OPTION_POPDEFS