|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.289
|
|
|
22c937 |
Fcc: outbox
|
|
|
22c937 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
22c937 |
Mime-Version: 1.0
|
|
|
22c937 |
Content-Type: text/plain; charset=UTF-8
|
|
|
22c937 |
Content-Transfer-Encoding: 8bit
|
|
|
22c937 |
------------
|
|
|
22c937 |
|
|
|
22c937 |
Patch 7.4.289
|
|
|
22c937 |
Problem: Pattern with repeated backreference does not match with new regexp
|
|
|
22c937 |
engine. (Urtica Dioica)
|
|
|
22c937 |
Solution: Also check the end of a submatch when deciding to put a state in
|
|
|
22c937 |
the state list.
|
|
|
22c937 |
Files: src/testdir/test64.in, src/testdir/test64.ok, src/regexp_nfa.c
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.288/src/testdir/test64.in 2013-11-21 17:12:55.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test64.in 2014-05-13 15:35:02.477659266 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 407,412 ****
|
|
|
22c937 |
--- 407,413 ----
|
|
|
22c937 |
:call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<=$', 'foo.bat/foo.bat', 'foo.bat/foo.bat', 'bat', 'bat'])
|
|
|
22c937 |
:call add(tl, [2, '\\\@
|
|
|
22c937 |
:call add(tl, [2, '^\(a*\)\1$', 'aaaaaaaa', 'aaaaaaaa', 'aaaa'])
|
|
|
22c937 |
+ :call add(tl, [2, '^\(a\{-2,}\)\1\+$', 'aaaaaaaaa', 'aaaaaaaaa', 'aaa'])
|
|
|
22c937 |
:"
|
|
|
22c937 |
:"""" Look-behind with limit
|
|
|
22c937 |
:call add(tl, [2, '<\@<=span.', 'xxspanxx
|
|
|
22c937 |
*** ../vim-7.4.288/src/testdir/test64.ok 2013-11-21 17:12:55.000000000 +0100
|
|
|
22c937 |
--- src/testdir/test64.ok 2014-05-13 15:49:21.381666784 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 947,952 ****
|
|
|
22c937 |
--- 947,955 ----
|
|
|
22c937 |
OK 0 - ^\(a*\)\1$
|
|
|
22c937 |
OK 1 - ^\(a*\)\1$
|
|
|
22c937 |
OK 2 - ^\(a*\)\1$
|
|
|
22c937 |
+ OK 0 - ^\(a\{-2,}\)\1\+$
|
|
|
22c937 |
+ OK 1 - ^\(a\{-2,}\)\1\+$
|
|
|
22c937 |
+ OK 2 - ^\(a\{-2,}\)\1\+$
|
|
|
22c937 |
OK 0 - <\@<=span.
|
|
|
22c937 |
OK 1 - <\@<=span.
|
|
|
22c937 |
OK 2 - <\@<=span.
|
|
|
22c937 |
*** ../vim-7.4.288/src/regexp_nfa.c 2014-04-23 19:06:33.702828771 +0200
|
|
|
22c937 |
--- src/regexp_nfa.c 2014-05-13 15:49:15.065666729 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 3945,3950 ****
|
|
|
22c937 |
--- 3945,3951 ----
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* Return TRUE if "sub1" and "sub2" have the same start positions.
|
|
|
22c937 |
+ * When using back-references also check the end position.
|
|
|
22c937 |
*/
|
|
|
22c937 |
static int
|
|
|
22c937 |
sub_equal(sub1, sub2)
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 3976,3981 ****
|
|
|
22c937 |
--- 3977,3999 ----
|
|
|
22c937 |
if (s1 != -1 && sub1->list.multi[i].start.col
|
|
|
22c937 |
!= sub2->list.multi[i].start.col)
|
|
|
22c937 |
return FALSE;
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if (nfa_has_backref)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ if (i < sub1->in_use)
|
|
|
22c937 |
+ s1 = sub1->list.multi[i].end.lnum;
|
|
|
22c937 |
+ else
|
|
|
22c937 |
+ s1 = -1;
|
|
|
22c937 |
+ if (i < sub2->in_use)
|
|
|
22c937 |
+ s2 = sub2->list.multi[i].end.lnum;
|
|
|
22c937 |
+ else
|
|
|
22c937 |
+ s2 = -1;
|
|
|
22c937 |
+ if (s1 != s2)
|
|
|
22c937 |
+ return FALSE;
|
|
|
22c937 |
+ if (s1 != -1 && sub1->list.multi[i].end.col
|
|
|
22c937 |
+ != sub2->list.multi[i].end.col)
|
|
|
22c937 |
+ return FALSE;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
else
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 3992,3997 ****
|
|
|
22c937 |
--- 4010,4028 ----
|
|
|
22c937 |
sp2 = NULL;
|
|
|
22c937 |
if (sp1 != sp2)
|
|
|
22c937 |
return FALSE;
|
|
|
22c937 |
+ if (nfa_has_backref)
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ if (i < sub1->in_use)
|
|
|
22c937 |
+ sp1 = sub1->list.line[i].end;
|
|
|
22c937 |
+ else
|
|
|
22c937 |
+ sp1 = NULL;
|
|
|
22c937 |
+ if (i < sub2->in_use)
|
|
|
22c937 |
+ sp2 = sub2->list.line[i].end;
|
|
|
22c937 |
+ else
|
|
|
22c937 |
+ sp2 = NULL;
|
|
|
22c937 |
+ if (sp1 != sp2)
|
|
|
22c937 |
+ return FALSE;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.288/src/version.c 2014-05-13 14:03:36.425611242 +0200
|
|
|
22c937 |
--- src/version.c 2014-05-13 15:51:52.009668103 +0200
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 736,737 ****
|
|
|
22c937 |
--- 736,739 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 289,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
hundred-and-one symptoms of being an internet addict:
|
|
|
22c937 |
152. You find yourself falling for someone you've never seen or hardly
|
|
|
22c937 |
know, but, boy can he/she TYPE!!!!!!
|
|
|
22c937 |
|
|
|
22c937 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
22c937 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
22c937 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
22c937 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|