From 78c93e4b6a87720a50ac14c40aa077ed6b86145b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 5 Sep 2013 16:05:36 +0200 Subject: updated for version 7.4.020 Problem: NFA engine matches too much with \@>. (John McGowan) Solution: When a whole pattern match is found stop searching. --- src/regexp_nfa.c | 5 ++++- src/testdir/test64.in | 1 + src/testdir/test64.ok | 3 +++ src/version.c | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 5288eb6d3..fe1d02582 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -5322,7 +5322,10 @@ nfa_regmatch(prog, start, submatch, m) log_subsexpr(m); #endif nfa_match = TRUE; - break; + /* See comment above at "goto nextchar". */ + if (nextlist->n == 0) + clen = 0; + goto nextchar; case NFA_START_INVISIBLE: case NFA_START_INVISIBLE_FIRST: diff --git a/src/testdir/test64.in b/src/testdir/test64.in index ac3f13d54..8f7008c1a 100644 --- a/src/testdir/test64.in +++ b/src/testdir/test64.in @@ -427,6 +427,7 @@ STARTTEST :""""" \@> :call add(tl, [2, '\(a*\)\@>a', 'aaaa']) :call add(tl, [2, '\(a*\)\@>b', 'aaab', 'aaab', 'aaa']) +:call add(tl, [2, '^\(.\{-}b\)\@>.', ' abcbd', ' abc', ' ab']) :" TODO: BT engine does not restore submatch after failure :call add(tl, [1, '\(a*\)\@>a\|a\+', 'aaaa', 'aaaa']) :" diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok index da19c0423..fa83f91af 100644 --- a/src/testdir/test64.ok +++ b/src/testdir/test64.ok @@ -983,6 +983,9 @@ OK 2 - \(a*\)\@>a OK 0 - \(a*\)\@>b OK 1 - \(a*\)\@>b OK 2 - \(a*\)\@>b +OK 0 - ^\(.\{-}b\)\@>. +OK 1 - ^\(.\{-}b\)\@>. +OK 2 - ^\(.\{-}b\)\@>. OK 0 - \(a*\)\@>a\|a\+ OK 2 - \(a*\)\@>a\|a\+ OK 0 - \_[^8-9]\+ diff --git a/src/version.c b/src/version.c index 0e6dc1c80..99c9d222d 100644 --- a/src/version.c +++ b/src/version.c @@ -738,6 +738,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 20, /**/ 19, /**/ -- cgit v1.2.1