Skip to content

Commit 6fec7c7

Browse files
committed
updated for version 7.3.1217
Problem: New regexp engine: Can't handle \%[[ao]]. (Yukihiro Nakadaira) Solution: Support nested atoms inside \%[].
1 parent 76ee6e4 commit 6fec7c7

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

src/regexp_nfa.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,13 +1150,16 @@ nfa_regatom()
11501150
int n;
11511151

11521152
/* \%[abc] */
1153-
for (n = 0; (c = getchr()) != ']'; ++n)
1153+
for (n = 0; (c = peekchr()) != ']'; ++n)
11541154
{
11551155
if (c == NUL)
11561156
EMSG2_RET_FAIL(_(e_missing_sb),
11571157
reg_magic == MAGIC_ALL);
1158-
EMIT(c);
1158+
/* recursive call! */
1159+
if (nfa_regatom() == FAIL)
1160+
return FAIL;
11591161
}
1162+
getchr(); /* get the ] */
11601163
if (n == 0)
11611164
EMSG2_RET_FAIL(_(e_empty_sb),
11621165
reg_magic == MAGIC_ALL);

src/testdir/test64.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ STARTTEST
366366
:call add(tl, [2, '\%[bar]x', 'barxx', 'barx'])
367367
:call add(tl, [2, '\%[bar]x', 'bxx', 'bx'])
368368
:call add(tl, [2, '\%[bar]x', 'xxx', 'x'])
369+
:call add(tl, [2, 'b\%[[ao]r]', 'bar bor', 'bar'])
369370
:"
370371
:"""" Alternatives, must use first longest match
371372
:call add(tl, [2, 'goo\|go', 'google', 'goo'])

src/testdir/test64.ok

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,9 @@ OK 2 - \%[bar]x
836836
OK 0 - \%[bar]x
837837
OK 1 - \%[bar]x
838838
OK 2 - \%[bar]x
839+
OK 0 - b\%[[ao]r]
840+
OK 1 - b\%[[ao]r]
841+
OK 2 - b\%[[ao]r]
839842
OK 0 - goo\|go
840843
OK 1 - goo\|go
841844
OK 2 - goo\|go

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+
1217,
731733
/**/
732734
1216,
733735
/**/

0 commit comments

Comments
 (0)