mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
Stop storing rules from 1 to nrules + 1.
* src/LR0.c, src/closure.c, src/derives.c, src/gram.c, src/lalr.c * src/nullable.c, src/output.c, src/print.c, src/reader.c * src/reduce.c: Allocate and free from &rules[0], not &rules[1]. Iterate from 0 to nrules. Use rule_number_as_item_number and item_number_as_rule_number. Adjust to `derive' now containing possibly 0. * src/gram.h (rule_number_as_item_number, item_number_as_rule_number): Handle the `- 1' part in rule numbers from/to item numbers. * src/conflicts.c (log_resolution): Fix the message which reversed shift and reduce. * src/output.c (action_row): Initialize default_rule to -1. (token_actions): Adjust. * tests/sets.at (Nullable, Firsts): Fix the previously bogus expected output. * tests/conflicts.at (Resolved SR Conflicts): Likewise.
This commit is contained in:
@@ -264,7 +264,7 @@ build_relations (void)
|
||||
symbol_number_t symbol1 = states[to_state[i]]->accessing_symbol;
|
||||
rule_number_t *rulep;
|
||||
|
||||
for (rulep = derives[symbol1]; *rulep > 0; rulep++)
|
||||
for (rulep = derives[symbol1]; *rulep >= 0; rulep++)
|
||||
{
|
||||
int done;
|
||||
int length = 1;
|
||||
@@ -438,7 +438,7 @@ lookaheads_print (FILE *out)
|
||||
{
|
||||
fprintf (out, " on %d (%s) -> rule %d\n",
|
||||
k, symbols[k]->tag,
|
||||
states[i]->lookaheads_rule[j]->number - 1);
|
||||
states[i]->lookaheads_rule[j]->number);
|
||||
};
|
||||
}
|
||||
fprintf (out, "Lookaheads: END\n");
|
||||
|
||||
Reference in New Issue
Block a user