From fb1fe06e6f912039d524d42a6fff274550f55463 Mon Sep 17 00:00:00 2001 From: Norihiro Tanaka Date: Sat, 3 Sep 2016 12:02:37 +0900 Subject: [PATCH] dfa: additional change new option for anchored searches * src/dfa.c (dfaexec_main): Do it. --- src/dfa.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/src/dfa.c b/src/dfa.c index e009bc6..41b0ffb 100644 --- a/src/dfa.c +++ b/src/dfa.c @@ -3172,10 +3172,18 @@ dfaexec_main (struct dfa *d, char const *begin, char *end, bool allow_nl, mbp = p; s = allow_nl ? d->newlines[s1] : 0; + + s = (allow_nl ? d->newlines[s1] + : (d->syntax.sbit[eol] == CTX_NEWLINE ? 0 + : (d->syntax.sbit[eol] == CTX_LETTER ? d->min_trcount - 1 + : d->initstate_notbol))); } else if (d->fails[s]) { - if (d->success[s] & d->syntax.sbit[*p]) + if ((d->success[s] & d->syntax.sbit[*p]) + || ((char *) p == end + && ACCEPTS_IN_CONTEXT (d->states[s].context, CTX_NEWLINE, s, + *d))) goto done; if (multibyte && s < d->min_trcount) -- 1.7.1