To: vim_dev@googlegroups.com
Subject: Patch 7.4.100
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.100
Problem:    NFA regexp doesn't handle backreference correctly. (Ryuichi
	    Hayashida, Urtica Dioica)
Solution:   Always add NFA_SKIP, also when it already exists at the start
	    position.
Files:      src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok


*** ../vim-7.4.099/src/regexp_nfa.c	2013-10-06 15:46:06.000000000 +0200
--- src/regexp_nfa.c	2013-11-21 15:58:58.000000000 +0100
***************
*** 4278,4284 ****
  	     * endless loop for "\(\)*" */
  
  	default:
! 	    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 or
--- 4278,4284 ----
  	     * endless loop for "\(\)*" */
  
  	default:
! 	    if (state->lastlist[nfa_ll_index] == l->id && state->c != NFA_SKIP)
  	    {
  		/* This state is already in the list, don't add it again,
  		 * unless it is an MOPEN that is used for a backreference or
*** ../vim-7.4.099/src/testdir/test64.in	2013-09-25 18:16:34.000000000 +0200
--- src/testdir/test64.in	2013-11-21 15:58:19.000000000 +0100
***************
*** 406,411 ****
--- 406,412 ----
  :call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<!$', 'foo.bat/foo.bat'])
  :call add(tl, [2, '^.*\.\(.*\)/.\+\(\1\)\@<=$', 'foo.bat/foo.bat', 'foo.bat/foo.bat', 'bat', 'bat'])
  :call add(tl, [2, '\\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}', '2013-06-27${0}', '${0}', '0'])
+ :call add(tl, [2, '^\(a*\)\1$', 'aaaaaaaa', 'aaaaaaaa', 'aaaa'])
  :"
  :"""" Look-behind with limit
  :call add(tl, [2, '<\@<=span.', 'xxspanxx<spanyyy', 'spany'])
*** ../vim-7.4.099/src/testdir/test64.ok	2013-09-25 18:16:34.000000000 +0200
--- src/testdir/test64.ok	2013-11-21 15:59:04.000000000 +0100
***************
*** 944,949 ****
--- 944,952 ----
  OK 0 - \\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}
  OK 1 - \\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}
  OK 2 - \\\@<!\${\(\d\+\%(:.\{-}\)\?\\\@<!\)}
+ OK 0 - ^\(a*\)\1$
+ OK 1 - ^\(a*\)\1$
+ OK 2 - ^\(a*\)\1$
  OK 0 - <\@<=span.
  OK 1 - <\@<=span.
  OK 2 - <\@<=span.
*** ../vim-7.4.099/src/version.c	2013-11-21 14:39:58.000000000 +0100
--- src/version.c	2013-11-21 16:02:27.000000000 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     100,
  /**/

-- 
Sometimes you can protect millions of dollars in your budget simply by buying
a bag of cookies, dropping it on the budget anylyst's desk, and saying
something deeply personal such as "How was your weekend, big guy?"
				(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
