Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.1104
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.3.1104
Problem:    New regexp engine does not handle "~".
Solution:   Add support for "~".
Files:	    src/regexp_nfa.c, src/testdir/test24.in, src/testdir/test24.ok


*** ../vim-7.3.1103/src/regexp_nfa.c	2013-06-02 21:30:00.000000000 +0200
--- src/regexp_nfa.c	2013-06-02 22:00:21.000000000 +0200
***************
*** 829,837 ****
  	    EMSGN(_(e_misplaced), no_Magic(c));
  	    return FAIL;
  
! 	case Magic('~'):		/* previous substitute pattern */
! 	    /* TODO: Not supported yet */
! 	    return FAIL;
  
  	case Magic('1'):
  	case Magic('2'):
--- 829,854 ----
  	    EMSGN(_(e_misplaced), no_Magic(c));
  	    return FAIL;
  
! 	case Magic('~'):
! 	    {
! 		char_u	    *lp;
! 
! 		/* Previous substitute pattern.
! 		 * Generated as "\%(pattern\)". */
! 		if (reg_prev_sub == NULL)
! 		{
! 		    EMSG(_(e_nopresub));
! 		    return FAIL;
! 		}
! 		for (lp = reg_prev_sub; *lp != NUL; mb_cptr_adv(lp))
! 		{
! 		    EMIT(PTR2CHAR(lp));
! 		    if (lp != reg_prev_sub)
! 			EMIT(NFA_CONCAT);
! 		}
! 		EMIT(NFA_NOPEN);
! 		break;
! 	    }
  
  	case Magic('1'):
  	case Magic('2'):
*** ../vim-7.3.1103/src/testdir/test24.in	2010-08-15 21:57:29.000000000 +0200
--- src/testdir/test24.in	2013-06-02 22:03:23.000000000 +0200
***************
*** 44,49 ****
--- 44,56 ----
  :s/^\(\h\w*\%(->\|\.\)\=\)\+=/XX/
  
  :s/^\(\h\w*\%(->\|\.\)\=\)\+=/YY/
+ 
+ :s/aaa/xyz/
+ 
+ :s/~/bcd/
+ 
+ :s/~\+/BB/
+ :"
  :?start?,$w! test.out
  :qa!
  ENDTEST
***************
*** 77,79 ****
--- 84,89 ----
  xx an file xx
  x= 9;
  hh= 77;
+  aaa 
+  xyz
+  bcdbcdbcd
*** ../vim-7.3.1103/src/testdir/test24.ok	2010-08-15 21:57:29.000000000 +0200
--- src/testdir/test24.ok	2013-06-02 22:03:36.000000000 +0200
***************
*** 27,29 ****
--- 27,32 ----
  xx an A xx
  XX 9;
  YY 77;
+  xyz 
+  bcd
+  BB
*** ../vim-7.3.1103/src/version.c	2013-06-02 21:30:00.000000000 +0200
--- src/version.c	2013-06-02 22:07:20.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
  {   /* Add new patch number below this line */
+ /**/
+     1104,
  /**/

-- 
Q: What is a patch 22?
A: A patch you need to include to make it possible to include patches.

 /// 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    ///