parseaut: better merge of multiple initial states
If an initial states without incoming transition has to be merged into another one, its outgoing edges can be reused by just changing their source. * spot/parseaut/parseaut.yy (fix_initial_state): Implement this here. * tests/core/522.test: Add more tests. * tests/core/readsave.test: Adjust one expected output. * doc/org/hoa.org: Mention the completeness change. * NEWS: Mention the new feature.
This commit is contained in:
parent
daf797b9d4
commit
396009c014
5 changed files with 72 additions and 15 deletions
|
|
@ -2671,12 +2671,30 @@ static void fix_initial_state(result_& r)
|
|||
for (auto& pp: start)
|
||||
{
|
||||
unsigned p = pp.front();
|
||||
if (p != init)
|
||||
// FIXME: If p has no incoming we should be able to
|
||||
// change the source of the edges of p instead of
|
||||
// adding new edges.
|
||||
for (auto& t: aut->out(p))
|
||||
aut->new_edge(init, t.dst, t.cond);
|
||||
if (p == init)
|
||||
continue;
|
||||
if (!has_incoming[p])
|
||||
{
|
||||
// If p has no incoming edge, we can simply take
|
||||
// out its outgoing edges and "re-source" them on init.
|
||||
// This will avoid creating new edges.
|
||||
for (auto& t: aut->out(p))
|
||||
t.src = init;
|
||||
auto& gr = aut->get_graph();
|
||||
auto& ps = gr.state_storage(p);
|
||||
auto& is = gr.state_storage(init);
|
||||
gr.edge_storage(is.succ_tail).next_succ = ps.succ;
|
||||
is.succ_tail = ps.succ_tail;
|
||||
ps.succ = ps.succ_tail = 0;
|
||||
// we just created a state without successors
|
||||
aut->prop_complete(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// duplicate all edges
|
||||
for (auto& t: aut->out(p))
|
||||
aut->new_edge(init, t.dst, t.cond);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue