mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 07:43:03 +00:00
traces: always print the reduced grammar and fix it
* src/gram.c (grammar_dump): Print the effective number first instead of last. And fix it (remove the incorrect "+1"). Use t/f for Booleans. * src/reduce.c: When asked, always print the reduced grammar, even if there was nothing useless. * tests/sets.at (Reduced Grammar): Check that.
This commit is contained in:
30
src/reduce.c
30
src/reduce.c
@@ -378,23 +378,23 @@ reduce_grammar (void)
|
||||
inaccessable_symbols ();
|
||||
|
||||
/* Did we reduce something? */
|
||||
if (!nuseless_nonterminals && !nuseless_productions)
|
||||
return;
|
||||
if (nuseless_nonterminals || nuseless_productions)
|
||||
{
|
||||
reduce_print ();
|
||||
|
||||
reduce_print ();
|
||||
if (!bitset_test (N, accept->content->number - ntokens))
|
||||
complain (&startsymbol_location, fatal,
|
||||
_("start symbol %s does not derive any sentence"),
|
||||
startsymbol->tag);
|
||||
|
||||
if (!bitset_test (N, accept->content->number - ntokens))
|
||||
complain (&startsymbol_location, fatal,
|
||||
_("start symbol %s does not derive any sentence"),
|
||||
startsymbol->tag);
|
||||
|
||||
/* First reduce the nonterminals, as they renumber themselves in the
|
||||
whole grammar. If you change the order, nonterms would be
|
||||
renumbered only in the reduced grammar. */
|
||||
if (nuseless_nonterminals)
|
||||
nonterminals_reduce ();
|
||||
if (nuseless_productions)
|
||||
reduce_grammar_tables ();
|
||||
/* First reduce the nonterminals, as they renumber themselves in the
|
||||
whole grammar. If you change the order, nonterms would be
|
||||
renumbered only in the reduced grammar. */
|
||||
if (nuseless_nonterminals)
|
||||
nonterminals_reduce ();
|
||||
if (nuseless_productions)
|
||||
reduce_grammar_tables ();
|
||||
}
|
||||
|
||||
if (trace_flag & trace_grammar)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user