The location tracking mechanism is precious for parse error

messages.  Nevertheless, it is enabled only when `@n' is used in
the grammar, which is a different issue (you can use it in error
message, but not in the grammar per se).  Therefore, there should
be another means to enable it.
* src/getargs.c (getargs): Support `--locations'.
(usage): Report it.
* src/getargs.h (locationsflag): Export it.
* src/lex.c (percent_table): Support `%locations'.
* src/reader.c (yylsp_needed): Remove this variable, now replaced
with `locationsflag'.
* doc/bison.texinfo: Document `--locations' and `%locations'.
Sort the options.
* tests/calc.m4: Test it.
For regularity of the names, replace each
(nolineflag, toknumflag, rawtokenumflag, noparserflag): with...
(no_lineflag, token_tableflag, rawflag, no_parserflag): this.
In addition replace each `flag' with `_flag'.
This commit is contained in:
Akim Demaille
2000-10-02 10:20:59 +00:00
parent d6c2cba06d
commit 89cab50df1
13 changed files with 377 additions and 251 deletions

View File

@@ -483,7 +483,7 @@ dump_grammar (void)
static void
print_notices (void)
{
if (yaccflag && nuseless_productions)
if (yacc_flag && nuseless_productions)
fprintf (stderr, _("%d rules never reduced\n"), nuseless_productions);
fprintf (stderr, _("%s contains "), infile);
@@ -523,7 +523,7 @@ reduce_grammar (void)
reduced = (bool) (nuseless_nonterminals + nuseless_productions > 0);
if (verboseflag)
if (verbose_flag)
print_results ();
if (reduced == FALSE)
@@ -537,14 +537,14 @@ reduce_grammar (void)
reduce_grammar_tables ();
#if 0
if (verboseflag)
if (verbose_flag)
{
fprintf (foutput, "REDUCED GRAMMAR\n\n");
dump_grammar ();
}
#endif
if (statisticsflag)
if (statistics_flag)
fprintf (stderr, _("reduced %s defines %d terminal%s, %d nonterminal%s\
, and %d production%s.\n"),
infile,