mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 15:23:02 +00:00
add LR(0) output
This should not be used to generate parsers. My point is actually to facilitate debugging (when tweaking the generation of the LR(0) automaton for instance, not carying -yet- about lookaheads). * src/reader.c (prepare_percent_define_front_end_variables): Add lr(0). * src/conflicts.c (set_conflicts): Be robust to reds not having lookaheads at all. * src/ielr.c (LrType, lr_type_get): Adjust. (ielr): Implement support for LR(0). * src/lalr.c (lalr_free): Don't free LA when it's not computed.
This commit is contained in:
@@ -369,13 +369,16 @@ set_conflicts (state *s, symbol **errors)
|
||||
s->solved_conflicts_xml = obstack_finish0 (&solved_conflicts_xml_obstack);
|
||||
|
||||
/* Loop over all rules which require lookahead in this state. Check
|
||||
for conflicts not resolved above. */
|
||||
for (int i = 0; i < reds->num; ++i)
|
||||
{
|
||||
if (!bitset_disjoint_p (reds->lookahead_tokens[i], lookahead_set))
|
||||
conflicts[s->number] = 1;
|
||||
bitset_or (lookahead_set, lookahead_set, reds->lookahead_tokens[i]);
|
||||
}
|
||||
for conflicts not resolved above.
|
||||
|
||||
reds->lookahead_tokens can be NULL if the LR type is LR(0). */
|
||||
if (reds->lookahead_tokens)
|
||||
for (int i = 0; i < reds->num; ++i)
|
||||
{
|
||||
if (!bitset_disjoint_p (reds->lookahead_tokens[i], lookahead_set))
|
||||
conflicts[s->number] = 1;
|
||||
bitset_or (lookahead_set, lookahead_set, reds->lookahead_tokens[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user