From: Justin Viiret Date: Thu, 10 Dec 2015 04:35:12 +0000 (+1100) Subject: Perform an early removeRedundancy call on graph X-Git-Tag: v4.2.0^2~208 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=326abeb3ee05d3c3dbf818c8393e466e8d961855;p=thirdparty%2Fvectorscan.git Perform an early removeRedundancy call on graph 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. --- diff --git a/src/nfagraph/ng.cpp b/src/nfagraph/ng.cpp index 7f866a66..75884181 100644 --- a/src/nfagraph/ng.cpp +++ b/src/nfagraph/ng.cpp @@ -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) {