]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
Perform an early removeRedundancy call on graph
authorJustin Viiret <justin.viiret@intel.com>
Thu, 10 Dec 2015 04:35:12 +0000 (15:35 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Tue, 1 Mar 2016 00:16:17 +0000 (11:16 +1100)
This allows sibling character classes to be merged together before graph
component splitting is done by calcComponents().

In particular, this transforms (A|a)(B|b)(C|c) into [Aa][Bb][Cc]
earlier.

src/nfagraph/ng.cpp

index 7f866a66a6709845a21c23984399bb7def5ed9a5..75884181958d34427cee803b6855543253dfe02d 100644 (file)
@@ -402,6 +402,13 @@ bool NG::addGraph(NGWrapper &w) {
 
     dumpDotWrapper(w, "03_early", cc.grey);
 
+    // Perform a reduction pass to merge sibling character classes together.
+    if (cc.grey.performGraphSimplification) {
+        removeRedundancy(w, som);
+    }
+
+    dumpDotWrapper(w, "04_reduced", cc.grey);
+
     // If we've got some literals that span the graph from start to accept, we
     // can split them off into Rose from here.
     if (!som) {