jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.289

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