ng: ensure that only match states have reports

Ensure (and assert) that vertices without an edge to {accept, acceptEod}
do not have reports set.
This commit is contained in:
Justin Viiret
2016-07-18 12:41:31 +10:00
committed by Matthew Barr
parent 3d9a60d023
commit 4ce268af47
10 changed files with 70 additions and 20 deletions

View File

@@ -31,14 +31,15 @@
#include "grey.h"
#include "compiler/compiler.h"
#include "nfagraph/ng.h"
#include "nfagraph/ng_limex.h"
#include "nfagraph/ng_restructuring.h"
#include "nfa/limex_context.h"
#include "nfa/limex_internal.h"
#include "nfa/nfa_api.h"
#include "nfa/nfa_api_util.h"
#include "nfa/nfa_internal.h"
#include "nfagraph/ng.h"
#include "nfagraph/ng_limex.h"
#include "nfagraph/ng_restructuring.h"
#include "nfagraph/ng_util.h"
#include "util/alloc.h"
#include "util/target_info.h"
@@ -76,6 +77,7 @@ protected:
ParsedExpression parsed(0, expr.c_str(), flags, 0);
unique_ptr<NGWrapper> g = buildWrapper(rm, cc, parsed);
ASSERT_TRUE(g != nullptr);
clearReports(*g);
rm.setProgramOffset(0, MATCH_REPORT);
@@ -310,10 +312,12 @@ protected:
ParsedExpression parsed(0, expr.c_str(), flags, 0);
unique_ptr<NGWrapper> g = buildWrapper(rm, cc, parsed);
ASSERT_TRUE(g != nullptr);
clearReports(*g);
// Reverse the graph and add some reports on the accept vertices.
NGHolder g_rev(NFA_REV_PREFIX);
reverseHolder(*g, g_rev);
clearReports(g_rev);
for (NFAVertex v : inv_adjacent_vertices_range(g_rev.accept, g_rev)) {
g_rev[v].reports.insert(0);
}
@@ -367,6 +371,7 @@ protected:
ReportManager rm(cc.grey);
unique_ptr<NGWrapper> g = buildWrapper(rm, cc, parsed);
ASSERT_TRUE(g != nullptr);
clearReports(*g);
rm.setProgramOffset(0, MATCH_REPORT);