Pp = bitset_create (nrules, BITSET_FIXED);
/* If the start symbol isn't useful, then nothing will be useful. */
- if (bitset_test (N, axiom->number - ntokens))
+ if (bitset_test (N, accept->number - ntokens))
{
- bitset_set (V, axiom->number);
+ bitset_set (V, accept->number);
while (1)
{
V = Vp;
/* Tokens 0, 1, and 2 are internal to Bison. Consider them useful. */
- bitset_set (V, eoftoken->number); /* end-of-input token */
+ bitset_set (V, endtoken->number); /* end-of-input token */
bitset_set (V, errtoken->number); /* error token */
bitset_set (V, undeftoken->number); /* some undefined token */
{
rule_number_t r;
for (r = 0; r < nrules; r++)
- {
- rules[r].useful = bitset_test (P, r);
- if (!rules[r].useful)
- {
- LOCATION_PRINT (stderr, rules[r].location);
- fprintf (stderr, ": %s: %s: ", _("warning"), _("useless rule"));
- rule_print (&rules[r], stderr);
- }
- }
+ rules[r].useful = bitset_test (P, r);
+ grammar_rules_never_reduced_report (_("useless rule"));
}
/* Map the nonterminals to their new index: useful first, useless
if (ISVAR (*rhsp))
*rhsp = symbol_number_as_item_number (nontermmap[*rhsp]);
}
- axiom->number = nontermmap[axiom->number];
+ accept->number = nontermmap[accept->number];
}
nsyms -= nuseless_nonterminals;
if (nuseless_nonterminals > 0)
{
int i;
- fprintf (out, "%s\n\n", _("Useless nonterminals:"));
+ fprintf (out, "%s\n\n", _("Useless nonterminals"));
for (i = 0; i < nuseless_nonterminals; ++i)
fprintf (out, " %s\n", symbols[nsyms + i]->tag);
fputs ("\n\n", out);
if (!bitset_test (V, i) && !bitset_test (V1, i))
{
if (!b)
- fprintf (out, "%s\n\n", _("Terminals which are not used:"));
+ fprintf (out, "%s\n\n", _("Terminals which are not used"));
b = TRUE;
fprintf (out, " %s\n", symbols[i]->tag);
}
if (nuseless_productions > 0)
grammar_rules_partial_print (out, _("Useless rules"),
- nrules,
- nrules + nuseless_productions);
+ rule_useless_p);
}
\f
reduce_print ();
- if (!bitset_test (N, axiom->number - ntokens))
- fatal (_("Start symbol %s does not derive any sentence"),
- symbols[axiom->number]->tag);
+ if (!bitset_test (N, accept->number - ntokens))
+ fatal_at (startsymbol_location,
+ _("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
if (nuseless_productions > 0)
reduce_grammar_tables ();
- if (trace_flag)
+ if (trace_flag & trace_grammar)
{
grammar_dump (stderr, "Reduced Grammar");