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