Skip to content

Commit 428e6fb

Browse files
committed
updated for version 7.3.1247
Problem: New regexp engine: '[ ]\@!\p\%([ ]\@!\p\)*:' does not always match. Solution: When there is a PIM add a duplicate state that starts at another position.
1 parent 8fd9ab9 commit 428e6fb

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

src/regexp_nfa.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3642,14 +3642,14 @@ sub_equal(sub1, sub2)
36423642
if (i < sub1->in_use)
36433643
s1 = sub1->list.multi[i].start.lnum;
36443644
else
3645-
s1 = 0;
3645+
s1 = -1;
36463646
if (i < sub2->in_use)
36473647
s2 = sub2->list.multi[i].start.lnum;
36483648
else
3649-
s2 = 0;
3649+
s2 = -1;
36503650
if (s1 != s2)
36513651
return FALSE;
3652-
if (s1 != 0 && sub1->list.multi[i].start.col
3652+
if (s1 != -1 && sub1->list.multi[i].start.col
36533653
!= sub2->list.multi[i].start.col)
36543654
return FALSE;
36553655
}
@@ -3931,8 +3931,9 @@ addstate(l, state, subs, pim, off)
39313931
if (state->lastlist[nfa_ll_index] == l->id)
39323932
{
39333933
/* This state is already in the list, don't add it again,
3934-
* unless it is an MOPEN that is used for a backreference. */
3935-
if (!nfa_has_backref)
3934+
* unless it is an MOPEN that is used for a backreference or
3935+
* when there is a PIM. */
3936+
if (!nfa_has_backref && pim == NULL)
39363937
{
39373938
skip_add:
39383939
#ifdef ENABLE_LOG
@@ -3949,9 +3950,9 @@ addstate(l, state, subs, pim, off)
39493950
goto skip_add;
39503951
}
39513952

3952-
/* When there are backreferences the number of states may be (a
3953-
* lot) bigger than anticipated. */
3954-
if (nfa_has_backref && l->n == l->len)
3953+
/* When there are backreferences or PIMs the number of states may
3954+
* be (a lot) bigger than anticipated. */
3955+
if (l->n == l->len)
39553956
{
39563957
int newlen = l->len * 3 / 2 + 50;
39573958

src/testdir/test64.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ STARTTEST
338338
:call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' bar foo '])
339339
:call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo bar '])
340340
:call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo xxx ', 'foo'])
341+
:call add(tl, [2, '[ ]\@!\p\%([ ]\@!\p\)*:', 'implicit mappings:', 'mappings:'])
341342
:"
342343
:"""" Combining different tests and features
343344
:call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])

src/testdir/test64.ok

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,9 @@ OK 2 - ^\%(.*bar\)\@!.*\zsfoo
770770
OK 0 - ^\%(.*bar\)\@!.*\zsfoo
771771
OK 1 - ^\%(.*bar\)\@!.*\zsfoo
772772
OK 2 - ^\%(.*bar\)\@!.*\zsfoo
773+
OK 0 - [ ]\@!\p\%([ ]\@!\p\)*:
774+
OK 1 - [ ]\@!\p\%([ ]\@!\p\)*:
775+
OK 2 - [ ]\@!\p\%([ ]\@!\p\)*:
773776
OK 0 - [[:alpha:]]\{-2,6}
774777
OK 1 - [[:alpha:]]\{-2,6}
775778
OK 2 - [[:alpha:]]\{-2,6}

src/version.c

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

729729
static int included_patches[] =
730730
{ /* Add new patch number below this line */
731+
/**/
732+
1247,
731733
/**/
732734
1246,
733735
/**/

0 commit comments

Comments
 (0)