mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-19 18:44:24 +03:00
Introduce custom adjacency-list based graph
This commit is contained in:
@@ -101,7 +101,7 @@ vector<NFAEdge> getAsserts(const NGHolder &g) {
|
||||
|
||||
static
|
||||
void addToSplit(const NGHolder &g, NFAVertex v, map<u32, NFAVertex> *to_split) {
|
||||
DEBUG_PRINTF("%u needs splitting\n", g[v].index);
|
||||
DEBUG_PRINTF("%zu needs splitting\n", g[v].index);
|
||||
to_split->emplace(g[v].index, v);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void setReportId(ReportManager &rm, NGWrapper &g, NFAVertex v, s32 adj) {
|
||||
Report ir = rm.getBasicInternalReport(g, adj);
|
||||
|
||||
g[v].reports.insert(rm.getInternalId(ir));
|
||||
DEBUG_PRINTF("set report id for vertex %u, adj %d\n", g[v].index, adj);
|
||||
DEBUG_PRINTF("set report id for vertex %zu, adj %d\n", g[v].index, adj);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -224,7 +224,7 @@ void splitVertex(ReportManager &rm, NGWrapper &g, NFAVertex v, bool ucp) {
|
||||
assert(v != g.start);
|
||||
assert(v != g.accept);
|
||||
assert(v != g.acceptEod);
|
||||
DEBUG_PRINTF("partitioning vertex %u ucp:%d\n", g[v].index, (int)ucp);
|
||||
DEBUG_PRINTF("partitioning vertex %zu ucp:%d\n", g[v].index, (int)ucp);
|
||||
|
||||
CharReach cr_word = ucp ? CHARREACH_WORD_UCP_PRE : CHARREACH_WORD;
|
||||
CharReach cr_nonword = ucp ? CHARREACH_NONWORD_UCP_PRE : CHARREACH_NONWORD;
|
||||
@@ -267,8 +267,8 @@ void resolveEdges(ReportManager &rm, NGWrapper &g, set<NFAEdge> *dead) {
|
||||
|
||||
bool impassable = true;
|
||||
bool ucp = flags & UCP_ASSERT_FLAGS;
|
||||
DEBUG_PRINTF("resolving edge %u->%u (flags=0x%x, ucp=%d)\n", g[u].index,
|
||||
g[v].index, flags, (int)ucp);
|
||||
DEBUG_PRINTF("resolving edge %zu->%zu (flags=0x%x, ucp=%d)\n",
|
||||
g[u].index, g[v].index, flags, (int)ucp);
|
||||
while (flags && impassable) {
|
||||
u32 flag = 1U << findAndClearLSB_32(&flags);
|
||||
switch (flag) {
|
||||
@@ -482,12 +482,12 @@ void resolveAsserts(ReportManager &rm, NGWrapper &g) {
|
||||
resolveEdges(rm, g, &dead);
|
||||
|
||||
remove_edges(dead, g);
|
||||
g.renumberVertices();
|
||||
renumber_vertices(g);
|
||||
pruneUseless(g);
|
||||
pruneEmptyVertices(g);
|
||||
|
||||
g.renumberVertices();
|
||||
g.renumberEdges();
|
||||
renumber_vertices(g);
|
||||
renumber_edges(g);
|
||||
clearReports(g);
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ void ensureCodePointStart(ReportManager &rm, NGWrapper &g) {
|
||||
add_edge(g.start, v_4, g);
|
||||
add_edge(g.startDs, v_4, g);
|
||||
remove_edge(orig, g);
|
||||
g.renumberEdges();
|
||||
renumber_edges(g);
|
||||
clearReports(g);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user