rose_build_exclusive: clean up use of vertex indices

This commit is contained in:
Justin Viiret 2017-08-03 15:52:25 +10:00 committed by Matthew Barr
parent d55e8fdf94
commit 8eb55d4242

View File

@ -219,29 +219,29 @@ bool isExclusive(const NGHolder &h,
const auto &cr1 = role1.cr; const auto &cr1 = role1.cr;
if (overlaps(cr1, role2.last_cr)) { if (overlaps(cr1, role2.last_cr)) {
CharReach cr = cr1 | role1.prefix_cr; CharReach cr = cr1 | role1.prefix_cr;
flat_set<NFAVertex> states;
for (const auto &lit : triggers2) { for (const auto &lit : triggers2) {
auto lit1 = findStartPos(cr, lit); auto lit1 = findStartPos(cr, lit);
if (lit1.empty()) { if (lit1.empty()) {
continue; continue;
} }
u32 lower_bound = 0;
if (lit1.size() < lit.size()) {
lower_bound = ~0U;
}
flat_set<NFAVertex> states; states.clear();
for (const auto &v : vertices_range(h)) {
if (h[v].index >= lower_bound || h[v].index < 2) { if (lit1.size() < lit.size()) {
states.insert(v); // Only starts.
} states.insert(h.start);
states.insert(h.startDs);
} else {
// All vertices.
insert(&states, vertices(h));
} }
auto activeStates = execute_graph(h, lit1, states); auto activeStates = execute_graph(h, lit1, states);
// Check if has only literal states are on // Check if only literal states are on
for (const auto &s : activeStates) { for (const auto &s : activeStates) {
u32 stateId = h[s].index; if ((!is_any_start(s, h) && h[s].index <= num) ||
if ((stateId > 1 && stateId <= num) || contains(tailId, h[s].index)) {
contains(tailId, stateId)) {
skipList[id2].insert(id1); skipList[id2].insert(id1);
return false; return false;
} }