mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
cex: display the rule numbers
From
Example: "if" expr "then" "if" expr "then" stmt • "else" stmt
Shift derivation
if_stmt
↳ "if" expr "then" stmt
↳ if_stmt
↳ "if" expr "then" stmt • "else" stmt
Reduce derivation
if_stmt
↳ "if" expr "then" stmt "else" stmt
↳ if_stmt
↳ "if" expr "then" stmt •
to
Example: "if" expr "then" "if" expr "then" stmt • "else" stmt
Shift derivation
if_stmt
↳ 3: "if" expr "then" stmt
↳ 2: if_stmt
↳ 4: "if" expr "then" stmt • "else" stmt
Example: "if" expr "then" "if" expr "then" stmt • "else" stmt
Reduce derivation
if_stmt
↳ 4: "if" expr "then" stmt "else" stmt
↳ 2: if_stmt
↳ 3: "if" expr "then" stmt •
* src/state-item.h, src/state-item.c (state_item_rule): New.
* src/derivation.h, src/derivation.c (struct derivation): Add a rule
member.
Adjust dependencies.
* src/counterexample.c, src/parse-simulation.c: Pass the rule to
derivation_new.
* src/derivation.c (fprintf_if): New.
(derivation_width, derivation_print_tree_impl): Take the rule number
into account.
* tests/conflicts.at, tests/counterexample.at, tests/diagnostics.at,
* tests/report.at: Adjust.
* doc/bison.texi: Adjust.
This commit is contained in:
@@ -288,7 +288,8 @@ expand_to_conflict (state_item_number start, symbol_number conflict_sym)
|
||||
derivation_list_append (result, derivation_new_leaf (*i));
|
||||
symbol_number lhs =
|
||||
rules[item_number_as_rule_number (*i)].lhs->number;
|
||||
derivation *deriv = derivation_new (lhs, result);
|
||||
derivation *deriv = derivation_new (lhs, result,
|
||||
state_item_rule (si));
|
||||
result = derivation_list_new ();
|
||||
derivation_list_append (result, deriv);
|
||||
}
|
||||
@@ -422,7 +423,7 @@ complete_diverging_example (symbol_number conflict_sym,
|
||||
derivation_list_prepend (result, derivation_new_leaf (*i));
|
||||
}
|
||||
// completing the derivation
|
||||
derivation *new_deriv = derivation_new (r->lhs->number, result);
|
||||
derivation *new_deriv = derivation_new (r->lhs->number, result, r);
|
||||
result = derivation_list_new ();
|
||||
derivation_list_append (result, new_deriv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user