From eeeb962b2f91531436baf45f95c9338eaef086c9 Mon Sep 17 00:00:00 2001 From: Marc Autret Date: Tue, 27 Nov 2001 20:30:13 +0000 Subject: [PATCH] * src/bison.simple: Remove YYERROR_VERBOSE using. Use %%error_verbose. (yyparse): Likewise. * src/output.c (prepare): Give its final value. * src/muscle_tab.c (muscle_init): Init new muscle 'error_verbose'. * src/getargs.h: Add its extern declaration. * src/getargs.c (error_verbose_flag): New int. (getargs): Update to catch new case. * src/options.c (option_table): 'error-verbose' is a new option. (shortopts): Update. --- ChangeLog | 13 +++++++++++++ TODO | 8 ++++++++ src/bison.simple | 13 +++---------- src/getargs.c | 5 +++++ src/getargs.h | 1 + src/muscle_tab.c | 1 + src/options.c | 7 ++++--- src/output.c | 1 + 8 files changed, 36 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23eb2352..6dc2aac4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2001-11-26 Marc Autret + + * src/bison.simple: Remove YYERROR_VERBOSE using. + Use %%error_verbose. + (yyparse): Likewise. + * src/output.c (prepare): Give its final value. + * src/muscle_tab.c (muscle_init): Init new muscle 'error_verbose'. + * src/getargs.h: Add its extern declaration. + * src/getargs.c (error_verbose_flag): New int. + (getargs): Update to catch new case. + * src/options.c (option_table): 'error-verbose' is a new option. + (shortopts): Update. + 2001-11-27 Akim Demaille * src/system.h: Use intl/libgettext.h. diff --git a/TODO b/TODO index b4ad2b6f..4bda68c1 100644 --- a/TODO +++ b/TODO @@ -22,3 +22,11 @@ Find the best graph parameters. [] Update informations about ERROR_VERBOSE. [] Add explainations about skeleton muscles. [] Add explainations about %skeleton. [] + +* testsuite. +** tests/calc.at +Remove --yyerror-verbose. [] +** tests/torture.at +Remove --yyerror-verbose. [] +** tests/calc.at +Test --error-verbose. [] \ No newline at end of file diff --git a/src/bison.simple b/src/bison.simple index 9b627b1c..4a3ca508 100644 --- a/src/bison.simple +++ b/src/bison.simple @@ -149,13 +149,6 @@ typedef struct yyltype # define YYLTYPE %%ltype #endif -#ifndef YYERROR_VERBOSE -# define YYERROR_VERBOSE %%verbose -#else -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#endif - /* Tokens. */ %%tokendef @@ -197,7 +190,7 @@ static const short yyrline[] = }; #endif -#if YYDEBUG || YYERROR_VERBOSE +#if %%error_verbose /* YYTNME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ static const char *const yytname[] = { @@ -826,7 +819,7 @@ yyerrlab: { ++yynerrs; -#if YYERROR_VERBOSE +#if %%error_verbose yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) @@ -869,7 +862,7 @@ yyerrlab: yyerror ("parse error; also virtual memory exhausted"); } else -#endif /* YYERROR_VERBOSE */ +#endif /* %%ERROR_VERBOSE */ yyerror ("parse error"); } goto yyerrlab1; diff --git a/src/getargs.c b/src/getargs.c index eee6314f..0951e581 100644 --- a/src/getargs.c +++ b/src/getargs.c @@ -34,6 +34,7 @@ int no_lines_flag = 0; int no_parser_flag = 0; int token_table_flag = 0; int verbose_flag = 0; +int error_verbose_flag = 0; int yacc_flag = 0; /* for -y */ int graph_flag = 0; int trace_flag = 0; @@ -165,6 +166,10 @@ getargs (int argc, char *argv[]) verbose_flag = 1; break; + case 'e': + error_verbose_flag = 1; + break; + case 'S': skeleton = optarg; break; diff --git a/src/getargs.h b/src/getargs.h index 5eef6404..f97e9b58 100644 --- a/src/getargs.h +++ b/src/getargs.h @@ -34,6 +34,7 @@ extern int no_lines_flag; /* for -l */ extern int no_parser_flag; /* for -n */ extern int token_table_flag; /* for -k */ extern int verbose_flag; /* for -v */ +extern int error_verbose_flag; /* for -e */ extern int graph_flag; /* for -g */ extern int yacc_flag; /* for -y */ extern int trace_flag; diff --git a/src/muscle_tab.c b/src/muscle_tab.c index 7dffbbd5..d1d2c0a2 100644 --- a/src/muscle_tab.c +++ b/src/muscle_tab.c @@ -87,6 +87,7 @@ muscle_init (void) muscle_insert ("maxtok", "0"); muscle_insert ("ntbase", "0"); muscle_insert ("verbose", "0"); + muscle_insert ("error_verbose", "0"); muscle_insert ("prefix", "yy"); /* Default #line formatting. */ muscle_insert ("linef", "#line %d %s\n"); diff --git a/src/options.c b/src/options.c index a3db8968..add764b2 100644 --- a/src/options.c +++ b/src/options.c @@ -30,7 +30,7 @@ #include "options.h" /* Shorts options. */ -const char *shortopts = "yvgdhrltknVo:b:p:S:"; +const char *shortopts = "yvegdhrltknVo:b:p:S:"; /* Long options. */ struct option *longopts = NULL; @@ -102,8 +102,9 @@ const struct option_table_struct option_table[] = the same, the char `-'. */ /* Output. */ - {opt_both, "defines", optional_argument, &defines_flag, tok_intopt, 'd'}, - {opt_both, "verbose", no_argument, &verbose_flag, tok_intopt, 'v'}, + {opt_both, "defines", optional_argument, &defines_flag, tok_intopt, 'd'}, + {opt_both, "verbose", no_argument, &verbose_flag, tok_intopt, 'v'}, + {opt_both, "error-verbose", no_argument,&error_verbose_flag, tok_intopt, 'e'}, /* Operation modes. */ {opt_both, "fixed-output-files", no_argument, &yacc_flag, tok_intopt, 'y'}, diff --git a/src/output.c b/src/output.c index a24441cb..9f2b9b5e 100644 --- a/src/output.c +++ b/src/output.c @@ -1053,6 +1053,7 @@ prepare (void) MUSCLE_INSERT_INT ("maxtok", max_user_token_number); MUSCLE_INSERT_INT ("ntbase", ntokens); MUSCLE_INSERT_INT ("verbose", 0); + MUSCLE_INSERT_INT ("error_verbose", error_verbose_flag); MUSCLE_INSERT_INT ("nnts", nvars); MUSCLE_INSERT_INT ("nrules", nrules); -- 2.45.2