Karsten Hopp d68559
To: vim_dev@googlegroups.com
Karsten Hopp d68559
Subject: Patch 7.3.1247
Karsten Hopp d68559
Fcc: outbox
Karsten Hopp d68559
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp d68559
Mime-Version: 1.0
Karsten Hopp d68559
Content-Type: text/plain; charset=UTF-8
Karsten Hopp d68559
Content-Transfer-Encoding: 8bit
Karsten Hopp d68559
------------
Karsten Hopp d68559
Karsten Hopp d68559
Patch 7.3.1247
Karsten Hopp d68559
Problem:    New regexp engine: '[ ]\@!\p\%([ ]\@!\p\)*:' does not always match.
Karsten Hopp d68559
Solution:   When there is a PIM add a duplicate state that starts at another
Karsten Hopp d68559
	    position.
Karsten Hopp d68559
Files:	    src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
Karsten Hopp d68559
Karsten Hopp d68559
Karsten Hopp d68559
*** ../vim-7.3.1246/src/regexp_nfa.c	2013-06-26 12:42:38.000000000 +0200
Karsten Hopp d68559
--- src/regexp_nfa.c	2013-06-26 17:54:31.000000000 +0200
Karsten Hopp d68559
***************
Karsten Hopp d68559
*** 3642,3655 ****
Karsten Hopp d68559
  	    if (i < sub1->in_use)
Karsten Hopp d68559
  		s1 = sub1->list.multi[i].start.lnum;
Karsten Hopp d68559
  	    else
Karsten Hopp d68559
! 		s1 = 0;
Karsten Hopp d68559
  	    if (i < sub2->in_use)
Karsten Hopp d68559
  		s2 = sub2->list.multi[i].start.lnum;
Karsten Hopp d68559
  	    else
Karsten Hopp d68559
! 		s2 = 0;
Karsten Hopp d68559
  	    if (s1 != s2)
Karsten Hopp d68559
  		return FALSE;
Karsten Hopp d68559
! 	    if (s1 != 0 && sub1->list.multi[i].start.col
Karsten Hopp d68559
  					     != sub2->list.multi[i].start.col)
Karsten Hopp d68559
  		return FALSE;
Karsten Hopp d68559
  	}
Karsten Hopp d68559
--- 3642,3655 ----
Karsten Hopp d68559
  	    if (i < sub1->in_use)
Karsten Hopp d68559
  		s1 = sub1->list.multi[i].start.lnum;
Karsten Hopp d68559
  	    else
Karsten Hopp d68559
! 		s1 = -1;
Karsten Hopp d68559
  	    if (i < sub2->in_use)
Karsten Hopp d68559
  		s2 = sub2->list.multi[i].start.lnum;
Karsten Hopp d68559
  	    else
Karsten Hopp d68559
! 		s2 = -1;
Karsten Hopp d68559
  	    if (s1 != s2)
Karsten Hopp d68559
  		return FALSE;
Karsten Hopp d68559
! 	    if (s1 != -1 && sub1->list.multi[i].start.col
Karsten Hopp d68559
  					     != sub2->list.multi[i].start.col)
Karsten Hopp d68559
  		return FALSE;
Karsten Hopp d68559
  	}
Karsten Hopp d68559
***************
Karsten Hopp d68559
*** 3931,3938 ****
Karsten Hopp d68559
  	    if (state->lastlist[nfa_ll_index] == l->id)
Karsten Hopp d68559
  	    {
Karsten Hopp d68559
  		/* This state is already in the list, don't add it again,
Karsten Hopp d68559
! 		 * unless it is an MOPEN that is used for a backreference. */
Karsten Hopp d68559
! 		if (!nfa_has_backref)
Karsten Hopp d68559
  		{
Karsten Hopp d68559
  skip_add:
Karsten Hopp d68559
  #ifdef ENABLE_LOG
Karsten Hopp d68559
--- 3931,3939 ----
Karsten Hopp d68559
  	    if (state->lastlist[nfa_ll_index] == l->id)
Karsten Hopp d68559
  	    {
Karsten Hopp d68559
  		/* This state is already in the list, don't add it again,
Karsten Hopp d68559
! 		 * unless it is an MOPEN that is used for a backreference or
Karsten Hopp d68559
! 		 * when there is a PIM. */
Karsten Hopp d68559
! 		if (!nfa_has_backref && pim == NULL)
Karsten Hopp d68559
  		{
Karsten Hopp d68559
  skip_add:
Karsten Hopp d68559
  #ifdef ENABLE_LOG
Karsten Hopp d68559
***************
Karsten Hopp d68559
*** 3949,3957 ****
Karsten Hopp d68559
  		    goto skip_add;
Karsten Hopp d68559
  	    }
Karsten Hopp d68559
  
Karsten Hopp d68559
! 	    /* When there are backreferences the number of states may be (a
Karsten Hopp d68559
! 	     * lot) bigger than anticipated. */
Karsten Hopp d68559
! 	    if (nfa_has_backref && l->n == l->len)
Karsten Hopp d68559
  	    {
Karsten Hopp d68559
  		int newlen = l->len * 3 / 2 + 50;
Karsten Hopp d68559
  
Karsten Hopp d68559
--- 3950,3958 ----
Karsten Hopp d68559
  		    goto skip_add;
Karsten Hopp d68559
  	    }
Karsten Hopp d68559
  
Karsten Hopp d68559
! 	    /* When there are backreferences or PIMs the number of states may
Karsten Hopp d68559
! 	     * be (a lot) bigger than anticipated. */
Karsten Hopp d68559
! 	    if (l->n == l->len)
Karsten Hopp d68559
  	    {
Karsten Hopp d68559
  		int newlen = l->len * 3 / 2 + 50;
Karsten Hopp d68559
  
Karsten Hopp d68559
*** ../vim-7.3.1246/src/testdir/test64.in	2013-06-26 12:42:38.000000000 +0200
Karsten Hopp d68559
--- src/testdir/test64.in	2013-06-26 16:43:19.000000000 +0200
Karsten Hopp d68559
***************
Karsten Hopp d68559
*** 338,343 ****
Karsten Hopp d68559
--- 338,344 ----
Karsten Hopp d68559
  :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' bar foo '])
Karsten Hopp d68559
  :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo bar '])
Karsten Hopp d68559
  :call add(tl, [2, '^\%(.*bar\)\@!.*\zsfoo', ' foo xxx ', 'foo'])
Karsten Hopp d68559
+ :call add(tl, [2, '[ ]\@!\p\%([ ]\@!\p\)*:', 'implicit mappings:', 'mappings:'])
Karsten Hopp d68559
  :"
Karsten Hopp d68559
  :"""" Combining different tests and features
Karsten Hopp d68559
  :call add(tl, [2, '[[:alpha:]]\{-2,6}', '787abcdiuhsasiuhb4', 'ab'])
Karsten Hopp d68559
*** ../vim-7.3.1246/src/testdir/test64.ok	2013-06-26 12:42:38.000000000 +0200
Karsten Hopp d68559
--- src/testdir/test64.ok	2013-06-26 17:33:11.000000000 +0200
Karsten Hopp d68559
***************
Karsten Hopp d68559
*** 770,775 ****
Karsten Hopp d68559
--- 770,778 ----
Karsten Hopp d68559
  OK 0 - ^\%(.*bar\)\@!.*\zsfoo
Karsten Hopp d68559
  OK 1 - ^\%(.*bar\)\@!.*\zsfoo
Karsten Hopp d68559
  OK 2 - ^\%(.*bar\)\@!.*\zsfoo
Karsten Hopp d68559
+ OK 0 - [ ]\@!\p\%([ ]\@!\p\)*:
Karsten Hopp d68559
+ OK 1 - [ ]\@!\p\%([ ]\@!\p\)*:
Karsten Hopp d68559
+ OK 2 - [ ]\@!\p\%([ ]\@!\p\)*:
Karsten Hopp d68559
  OK 0 - [[:alpha:]]\{-2,6}
Karsten Hopp d68559
  OK 1 - [[:alpha:]]\{-2,6}
Karsten Hopp d68559
  OK 2 - [[:alpha:]]\{-2,6}
Karsten Hopp d68559
*** ../vim-7.3.1246/src/version.c	2013-06-26 14:04:37.000000000 +0200
Karsten Hopp d68559
--- src/version.c	2013-06-26 17:30:26.000000000 +0200
Karsten Hopp d68559
***************
Karsten Hopp d68559
*** 730,731 ****
Karsten Hopp d68559
--- 730,733 ----
Karsten Hopp d68559
  {   /* Add new patch number below this line */
Karsten Hopp d68559
+ /**/
Karsten Hopp d68559
+     1247,
Karsten Hopp d68559
  /**/
Karsten Hopp d68559
Karsten Hopp d68559
-- 
Karsten Hopp d68559
FATHER: One day, lad, all this will be yours ...
Karsten Hopp d68559
PRINCE: What - the curtains?
Karsten Hopp d68559
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp d68559
Karsten Hopp d68559
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp d68559
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp d68559
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp d68559
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///