From: Ulya Trofimovich Date: Wed, 27 Feb 2019 11:46:55 +0000 (+0000) Subject: Exit early from loops in GOR1. X-Git-Tag: 1.2~136 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d46dc3a1cfd7d7e1e719dd2dce32708ae18b01f;p=re2c Exit early from loops in GOR1. --- diff --git a/re2c/lib/regexec_nfa_posix.cc b/re2c/lib/regexec_nfa_posix.cc index e80a40f5..26f58107 100644 --- a/re2c/lib/regexec_nfa_posix.cc +++ b/re2c/lib/regexec_nfa_posix.cc @@ -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(state.size()); state.push_back(x); diff --git a/re2c/src/dfa/closure_posix.cc b/re2c/src/dfa/closure_posix.cc index f3c4405d..b4cf096a 100644 --- a/re2c/src/dfa/closure_posix.cc +++ b/re2c/src/dfa/closure_posix.cc @@ -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(state.size()); state.push_back(x);