summaryrefslogtreecommitdiff
path: root/src/getargs.c
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-01-12 19:30:21 +0100
committerAkim Demaille <akim.demaille@gmail.com>2019-01-14 19:57:37 +0100
commit41aaa8374cb0a903df8565fdca32a7c1747f496b (patch)
tree2f59760459a1b5fd4328e9c37dd9c76437714e9e /src/getargs.c
parent79e79be29841a9f9a7360ea53b2ad384b082cc71 (diff)
downloadbison-41aaa8374cb0a903df8565fdca32a7c1747f496b.tar.gz
diagnostics: update the grammar file
Let's use the fixits to actually update the grammar files. * src/getargs.h, src/getargs.c (update_flag): New. * src/fixits.h, src/fixits.c (fixits_run): New. * src/main.c (main): Invoke fixits_run when --update is passed. * tests/input.at (Deprecated directives): Check --update.
Diffstat (limited to 'src/getargs.c')
-rw-r--r--src/getargs.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/getargs.c b/src/getargs.c
index 9874c429..83ebcb09 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -36,12 +36,13 @@
#include "quote.h"
#include "uniqstr.h"
-bool defines_flag;
-bool graph_flag;
-bool xml_flag;
-bool no_lines_flag;
-bool token_table_flag;
-bool yacc_flag; /* for -y */
+bool defines_flag = false;
+bool graph_flag = false;
+bool xml_flag = false;
+bool no_lines_flag = false;
+bool token_table_flag = false;
+bool yacc_flag = false; /* for -y */
+bool update_flag = false; /* for -u */
bool nondeterministic_parser = false;
bool glr_parser = false;
@@ -283,7 +284,10 @@ Operation modes:\n\
-h, --help display this help and exit\n\
-V, --version output version information and exit\n\
--print-localedir output directory containing locale-dependent data\n\
+ and exit\n\
--print-datadir output directory containing skeletons and XSLT\n\
+ and exit\n\
+ -u, --update apply fixes to the source grammar file\n\
-y, --yacc emulate POSIX Yacc\n\
-W, --warnings[=CATEGORY] report the warnings falling in CATEGORY\n\
-f, --feature[=FEATURE] activate miscellaneous features\n\
@@ -478,6 +482,7 @@ static char const short_options[] =
"p:"
"r:"
"t"
+ "u" /* --update */
"v"
"x::"
"y"
@@ -499,6 +504,7 @@ static struct option const long_options[] =
{ "version", no_argument, 0, 'V' },
{ "print-localedir", no_argument, 0, PRINT_LOCALEDIR_OPTION },
{ "print-datadir", no_argument, 0, PRINT_DATADIR_OPTION },
+ { "update", no_argument, 0, 'u' },
{ "warnings", optional_argument, 0, 'W' },
/* Parser. */
@@ -684,6 +690,10 @@ getargs (int argc, char *argv[])
MUSCLE_PERCENT_DEFINE_D);
break;
+ case 'u':
+ update_flag = true;
+ break;
+
case 'v':
report_flag |= report_states;
break;