]> granicus.if.org Git - re2c/commitdiff
Exit early from loops in GOR1.
authorUlya Trofimovich <skvadrik@gmail.com>
Wed, 27 Feb 2019 11:46:55 +0000 (11:46 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Wed, 27 Feb 2019 11:46:55 +0000 (11:46 +0000)
re2c/lib/regexec_nfa_posix.cc
re2c/src/dfa/closure_posix.cc

index e80a40f55cbfd4885fee5b4cfe3ca7c15bb8a689..26f58107d693337722263dda1ced590f9d6a2121 100644 (file)
@@ -252,6 +252,10 @@ bool relax_gor1(simctx_t &ctx, const conf_t &x)
     const uint32_t idx = q->clos;
     int32_t p1, p2;
 
+    if (q->status == GOR_TOPSORT) {
+        return false;
+    }
+
     if (idx == NOCLOS) {
         q->clos = static_cast<uint32_t>(state.size());
         state.push_back(x);
index f3c4405d76ccbe984bbed05e4328c450738ab6e3..b4cf096af890f78679f79a035121f20907f29efa 100644 (file)
@@ -180,6 +180,10 @@ bool relax_gor1(determ_context_t &ctx, const clos_t &x)
     const uint32_t idx = q->clos;
     int32_t p1, p2;
 
+    if (q->status == GOR_TOPSORT) {
+        return false;
+    }
+
     if (idx == NOCLOS) {
         q->clos = static_cast<uint32_t>(state.size());
         state.push_back(x);