for (i = b; i != e; ++i) {
nfa_state_t *s = i->state;
+
+ closure_cleanup<ctx_t>(s);
+
if (s->type == nfa_state_t::RAN) {
buffer.push_back(*i);
}
namespace re2c {
+template<typename ctx_t> void closure_cleanup(nfa_state_t *q);
template<typename ctx_t> static void closure_leftmost_dfs(ctx_t &ctx);
inline void closure_leftmost(ldetctx_t &ctx)
{
closure_leftmost_dfs(ctx);
-
- // cleanup
- for (clositer_t i = ctx.state.begin(); i != ctx.state.end(); ++i) {
- i->state->clos = NOCLOS;
- }
}
template<typename ctx_t>
}
}
+template<>
+inline void closure_cleanup<ldetctx_t>(nfa_state_t *q)
+{
+ q->clos = NOCLOS;
+}
+
} // namespace re2c
#endif // _RE2C_DFA_CLOSURE_LEFTMOST_
* can just propagate the new path up to the next join point.
*/
+template<typename ctx_t> void closure_cleanup(nfa_state_t *q);
template<typename ctx_t> static void closure_posix_gor1(ctx_t &);
template<typename ctx_t> static void closure_posix_gtop(ctx_t &);
}
DDUMP_CLSTATS(ctx);
-
- // cleanup
- closure_t &cl = ctx.state;
- for (clositer_t i = cl.begin(); i != cl.end(); ++i) {
- nfa_state_t *q = i->state;
- q->clos = NOCLOS;
- q->arcidx = 0;
- DASSERT(q->status == GOR_NOPASS && q->active == 0);
- }
}
template<typename ctx_t>
}
}
+template<>
+inline void closure_cleanup<pdetctx_t>(nfa_state_t *q)
+{
+ q->clos = NOCLOS;
+ q->arcidx = 0;
+ DASSERT(q->status == GOR_NOPASS && q->active == 0);
+}
+
} // namespace re2c
#endif // _RE2C_DFA_CLOSURE_POSIX_