Skip to content

Commit 4fafaa8

Browse files
committed
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.
1 parent 1af6c83 commit 4fafaa8

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

src/regexp_nfa.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5322,7 +5322,10 @@ nfa_regmatch(prog, start, submatch, m)
53225322
log_subsexpr(m);
53235323
#endif
53245324
nfa_match = TRUE;
5325-
break;
5325+
/* See comment above at "goto nextchar". */
5326+
if (nextlist->n == 0)
5327+
clen = 0;
5328+
goto nextchar;
53265329

53275330
case NFA_START_INVISIBLE:
53285331
case NFA_START_INVISIBLE_FIRST:

src/testdir/test64.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ STARTTEST
427427
:""""" \@>
428428
:call add(tl, [2, '\(a*\)\@>a', 'aaaa'])
429429
:call add(tl, [2, '\(a*\)\@>b', 'aaab', 'aaab', 'aaa'])
430+
:call add(tl, [2, '^\(.\{-}b\)\@>.', ' abcbd', ' abc', ' ab'])
430431
:" TODO: BT engine does not restore submatch after failure
431432
:call add(tl, [1, '\(a*\)\@>a\|a\+', 'aaaa', 'aaaa'])
432433
:"

src/testdir/test64.ok

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,9 @@ OK 2 - \(a*\)\@>a
983983
OK 0 - \(a*\)\@>b
984984
OK 1 - \(a*\)\@>b
985985
OK 2 - \(a*\)\@>b
986+
OK 0 - ^\(.\{-}b\)\@>.
987+
OK 1 - ^\(.\{-}b\)\@>.
988+
OK 2 - ^\(.\{-}b\)\@>.
986989
OK 0 - \(a*\)\@>a\|a\+
987990
OK 2 - \(a*\)\@>a\|a\+
988991
OK 0 - \_[^8-9]\+

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
20,
741743
/**/
742744
19,
743745
/**/

0 commit comments

Comments
 (0)