summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <bram@vim.org>2013-06-26 18:16:58 +0200
committerBram Moolenaar <bram@vim.org>2013-06-26 18:16:58 +0200
commit546751bf240ee37d006757bb8aad2d6d57dca4ba (patch)
tree1a9743661e85ea17e510f19471e9d5eb881ed301
parentec5b6af167183afbd564c12d0d7f00353eaa8cf6 (diff)
downloadvim-546751bf240ee37d006757bb8aad2d6d57dca4ba.tar.gz
updated for version 7.3.1247v7.3.1247v7-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.
-rw-r--r--src/regexp_nfa.c17
-rw-r--r--src/testdir/test64.in1
-rw-r--r--src/testdir/test64.ok3
-rw-r--r--src/version.c2
4 files changed, 15 insertions, 8 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index cba4001f..8146d9d6 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -3642,14 +3642,14 @@ sub_equal(sub1, sub2)
if (i < sub1->in_use)
s1 = sub1->list.multi[i].start.lnum;
else
- s1 = 0;
+ s1 = -1;
if (i < sub2->in_use)
s2 = sub2->list.multi[i].start.lnum;
else
- s2 = 0;
+ s2 = -1;
if (s1 != s2)
return FALSE;
- if (s1 != 0 && sub1->list.multi[i].start.col
+ if (s1 != -1 && sub1->list.multi[i].start.col
!= sub2->list.multi[i].start.col)
return FALSE;
}
@@ -3931,8 +3931,9 @@ addstate(l, state, subs, pim, off)
if (state->lastlist[nfa_ll_index] == l->id)
{
/* This state is already in the list, don't add it again,
- * unless it is an MOPEN that is used for a backreference. */
- if (!nfa_has_backref)
+ * unless it is an MOPEN that is used for a backreference or
+ * when there is a PIM. */
+ if (!nfa_has_backref && pim == NULL)
{
skip_add:
#ifdef ENABLE_LOG
@@ -3949,9 +3950,9 @@ skip_add:
goto skip_add;
}
- /* When there are backreferences the number of states may be (a
- * lot) bigger than anticipated. */
- if (nfa_has_backref && l->n == l->len)
+ /* When there are backreferences or PIMs the number of states may
+ * be (a lot) bigger than anticipated. */
+ if (l->n == l->len)
{
int newlen = l->len * 3 / 2 + 50;
diff --git a/src/testdir/test64.in b/src/testdir/test64.in
index 4fdbcf73..a7b5794d 100644
--- a/src/testdir/test64.in
+++ b/src/testdir/test64.in
@@ -338,6 +338,7 @@ STARTTEST
:call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' bar foo '])
:call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo bar '])
:call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo xxx ', 'foo'])
+:call add(tl, [2, '[ ]\@!\p\%([ ]\@!\p\)*:', 'implicit mappings:', 'mappings:'])
:"
:"""" Combining different tests and features
:call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok
index d1f41138..8aa5a604 100644
--- a/src/testdir/test64.ok
+++ b/src/testdir/test64.ok
@@ -770,6 +770,9 @@ OK 2 - ^\%(.*bar\)\@!.*\zsfoo
OK 0 - ^\%(.*bar\)\@!.*\zsfoo
OK 1 - ^\%(.*bar\)\@!.*\zsfoo
OK 2 - ^\%(.*bar\)\@!.*\zsfoo
+OK 0 - [ ]\@!\p\%([ ]\@!\p\)*:
+OK 1 - [ ]\@!\p\%([ ]\@!\p\)*:
+OK 2 - [ ]\@!\p\%([ ]\@!\p\)*:
OK 0 - [[:alpha:]]\{-2,6}
OK 1 - [[:alpha:]]\{-2,6}
OK 2 - [[:alpha:]]\{-2,6}
diff --git a/src/version.c b/src/version.c
index fb70ebc9..025b8563 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1247,
+/**/
1246,
/**/
1245,