Karsten Hopp 9587fc
To: vim_dev@googlegroups.com
Karsten Hopp 9587fc
Subject: Patch 7.3.1093
Karsten Hopp 9587fc
Fcc: outbox
Karsten Hopp 9587fc
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 9587fc
Mime-Version: 1.0
Karsten Hopp 9587fc
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 9587fc
Content-Transfer-Encoding: 8bit
Karsten Hopp 9587fc
------------
Karsten Hopp 9587fc
Karsten Hopp 9587fc
Patch 7.3.1093
Karsten Hopp 9587fc
Problem:    New regexp engine: When a sub expression is empty \1 skips a
Karsten Hopp 9587fc
	    character.
Karsten Hopp 9587fc
Solution:   Make \1 try the current position when the match is emtpy.
Karsten Hopp 9587fc
Files:	    src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
Karsten Hopp 9587fc
Karsten Hopp 9587fc
Karsten Hopp 9587fc
*** ../vim-7.3.1092/src/regexp_nfa.c	2013-06-02 15:55:52.000000000 +0200
Karsten Hopp 9587fc
--- src/regexp_nfa.c	2013-06-02 16:03:28.000000000 +0200
Karsten Hopp 9587fc
***************
Karsten Hopp 9587fc
*** 4435,4445 ****
Karsten Hopp 9587fc
  		{
Karsten Hopp 9587fc
  		    if (bytelen == 0)
Karsten Hopp 9587fc
  		    {
Karsten Hopp 9587fc
! 			/* empty match always works, add NFA_SKIP with zero to
Karsten Hopp 9587fc
! 			 * be used next */
Karsten Hopp 9587fc
! 			addstate_here(thislist, t->state->out, &t->subs,
Karsten Hopp 9587fc
  								    &listidx);
Karsten Hopp 9587fc
- 			thislist->t[listidx + 1].count = 0;
Karsten Hopp 9587fc
  		    }
Karsten Hopp 9587fc
  		    else if (bytelen <= clen)
Karsten Hopp 9587fc
  		    {
Karsten Hopp 9587fc
--- 4435,4444 ----
Karsten Hopp 9587fc
  		{
Karsten Hopp 9587fc
  		    if (bytelen == 0)
Karsten Hopp 9587fc
  		    {
Karsten Hopp 9587fc
! 			/* empty match always works, output of NFA_SKIP to be
Karsten Hopp 9587fc
! 			 * used next */
Karsten Hopp 9587fc
! 			addstate_here(thislist, t->state->out->out, &t->subs,
Karsten Hopp 9587fc
  								    &listidx);
Karsten Hopp 9587fc
  		    }
Karsten Hopp 9587fc
  		    else if (bytelen <= clen)
Karsten Hopp 9587fc
  		    {
Karsten Hopp 9587fc
*** ../vim-7.3.1092/src/testdir/test64.in	2013-06-01 19:54:39.000000000 +0200
Karsten Hopp 9587fc
--- src/testdir/test64.in	2013-06-02 16:02:56.000000000 +0200
Karsten Hopp 9587fc
***************
Karsten Hopp 9587fc
*** 361,366 ****
Karsten Hopp 9587fc
--- 361,367 ----
Karsten Hopp 9587fc
  :call add(tl, [2, '\(\i\+\) \1', ' abc abc', 'abc abc', 'abc'])
Karsten Hopp 9587fc
  :call add(tl, [2, '\(\i\+\) \1', 'xgoo goox', 'goo goo', 'goo'])
Karsten Hopp 9587fc
  :call add(tl, [2, '\(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9', 'xabcddefghiabcddefghix', 'abcddefghiabcddefghi', 'a', 'b', 'c', 'dd', 'e', 'f', 'g', 'h', 'i'])
Karsten Hopp 9587fc
+ :call add(tl, [2, '\(\d*\)a \1b', ' a b ', 'a b', ''])
Karsten Hopp 9587fc
  :"
Karsten Hopp 9587fc
  :"""" Look-behind with limit
Karsten Hopp 9587fc
  :call add(tl, [2, '<\@<=span.', 'xxspanxx
Karsten Hopp 9587fc
*** ../vim-7.3.1092/src/testdir/test64.ok	2013-06-01 19:54:39.000000000 +0200
Karsten Hopp 9587fc
--- src/testdir/test64.ok	2013-06-02 16:06:44.000000000 +0200
Karsten Hopp 9587fc
***************
Karsten Hopp 9587fc
*** 815,820 ****
Karsten Hopp 9587fc
--- 815,823 ----
Karsten Hopp 9587fc
  OK 0 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
Karsten Hopp 9587fc
  OK 1 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
Karsten Hopp 9587fc
  OK 2 - \(a\)\(b\)\(c\)\(dd\)\(e\)\(f\)\(g\)\(h\)\(i\)\1\2\3\4\5\6\7\8\9
Karsten Hopp 9587fc
+ OK 0 - \(\d*\)a \1b
Karsten Hopp 9587fc
+ OK 1 - \(\d*\)a \1b
Karsten Hopp 9587fc
+ OK 2 - \(\d*\)a \1b
Karsten Hopp 9587fc
  OK 0 - <\@<=span.
Karsten Hopp 9587fc
  OK 1 - <\@<=span.
Karsten Hopp 9587fc
  OK 2 - <\@<=span.
Karsten Hopp 9587fc
*** ../vim-7.3.1092/src/version.c	2013-06-02 15:55:52.000000000 +0200
Karsten Hopp 9587fc
--- src/version.c	2013-06-02 16:03:55.000000000 +0200
Karsten Hopp 9587fc
***************
Karsten Hopp 9587fc
*** 730,731 ****
Karsten Hopp 9587fc
--- 730,733 ----
Karsten Hopp 9587fc
  {   /* Add new patch number below this line */
Karsten Hopp 9587fc
+ /**/
Karsten Hopp 9587fc
+     1093,
Karsten Hopp 9587fc
  /**/
Karsten Hopp 9587fc
Karsten Hopp 9587fc
-- 
Karsten Hopp 9587fc
Well, you come from nothing, you go back to nothing...  What have you
Karsten Hopp 9587fc
lost?  Nothing!
Karsten Hopp 9587fc
				-- Monty Python: The life of Brian
Karsten Hopp 9587fc
Karsten Hopp 9587fc
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 9587fc
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 9587fc
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 9587fc
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///