Karsten Hopp 236828
To: vim_dev@googlegroups.com
Karsten Hopp 236828
Subject: Patch 7.3.1091
Karsten Hopp 236828
Fcc: outbox
Karsten Hopp 236828
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 236828
Mime-Version: 1.0
Karsten Hopp 236828
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 236828
Content-Transfer-Encoding: 8bit
Karsten Hopp 236828
------------
Karsten Hopp 236828
Karsten Hopp 236828
Patch 7.3.1091
Karsten Hopp 236828
Problem:    New regexp engine: no error when using \z1 or \z( where it does
Karsten Hopp 236828
	    not work.
Karsten Hopp 236828
Solution:   Give an error message.
Karsten Hopp 236828
Files:	    src/regexp.c, src/regexp_nfa.c
Karsten Hopp 236828
Karsten Hopp 236828
Karsten Hopp 236828
*** ../vim-7.3.1090/src/regexp.c	2013-06-01 19:54:39.000000000 +0200
Karsten Hopp 236828
--- src/regexp.c	2013-06-02 14:56:07.000000000 +0200
Karsten Hopp 236828
***************
Karsten Hopp 236828
*** 361,366 ****
Karsten Hopp 236828
--- 361,368 ----
Karsten Hopp 236828
  static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
Karsten Hopp 236828
  static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
Karsten Hopp 236828
  static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)");
Karsten Hopp 236828
+ static char_u e_z_not_allowed[] = N_("E66: \\z( not allowed here");
Karsten Hopp 236828
+ static char_u e_z1_not_allowed[] = N_("E67: \\z1 et al. not allowed here");
Karsten Hopp 236828
  
Karsten Hopp 236828
  #define NOT_MULTI	0
Karsten Hopp 236828
  #define MULTI_ONE	1
Karsten Hopp 236828
***************
Karsten Hopp 236828
*** 2120,2126 ****
Karsten Hopp 236828
  	    {
Karsten Hopp 236828
  #ifdef FEAT_SYN_HL
Karsten Hopp 236828
  		case '(': if (reg_do_extmatch != REX_SET)
Karsten Hopp 236828
! 			      EMSG_RET_NULL(_("E66: \\z( not allowed here"));
Karsten Hopp 236828
  			  if (one_exactly)
Karsten Hopp 236828
  			      EMSG_ONE_RET_NULL;
Karsten Hopp 236828
  			  ret = reg(REG_ZPAREN, &flags);
Karsten Hopp 236828
--- 2122,2128 ----
Karsten Hopp 236828
  	    {
Karsten Hopp 236828
  #ifdef FEAT_SYN_HL
Karsten Hopp 236828
  		case '(': if (reg_do_extmatch != REX_SET)
Karsten Hopp 236828
! 			      EMSG_RET_NULL(_(e_z_not_allowed));
Karsten Hopp 236828
  			  if (one_exactly)
Karsten Hopp 236828
  			      EMSG_ONE_RET_NULL;
Karsten Hopp 236828
  			  ret = reg(REG_ZPAREN, &flags);
Karsten Hopp 236828
***************
Karsten Hopp 236828
*** 2139,2145 ****
Karsten Hopp 236828
  		case '7':
Karsten Hopp 236828
  		case '8':
Karsten Hopp 236828
  		case '9': if (reg_do_extmatch != REX_USE)
Karsten Hopp 236828
! 			      EMSG_RET_NULL(_("E67: \\z1 et al. not allowed here"));
Karsten Hopp 236828
  			  ret = regnode(ZREF + c - '0');
Karsten Hopp 236828
  			  re_has_z = REX_USE;
Karsten Hopp 236828
  			  break;
Karsten Hopp 236828
--- 2141,2147 ----
Karsten Hopp 236828
  		case '7':
Karsten Hopp 236828
  		case '8':
Karsten Hopp 236828
  		case '9': if (reg_do_extmatch != REX_USE)
Karsten Hopp 236828
! 			      EMSG_RET_NULL(_(e_z1_not_allowed));
Karsten Hopp 236828
  			  ret = regnode(ZREF + c - '0');
Karsten Hopp 236828
  			  re_has_z = REX_USE;
Karsten Hopp 236828
  			  break;
Karsten Hopp 236828
*** ../vim-7.3.1090/src/regexp_nfa.c	2013-06-01 23:02:48.000000000 +0200
Karsten Hopp 236828
--- src/regexp_nfa.c	2013-06-02 14:56:53.000000000 +0200
Karsten Hopp 236828
***************
Karsten Hopp 236828
*** 865,870 ****
Karsten Hopp 236828
--- 865,872 ----
Karsten Hopp 236828
  		case '8':
Karsten Hopp 236828
  		case '9':
Karsten Hopp 236828
  		    /* \z1...\z9 */
Karsten Hopp 236828
+ 		    if (reg_do_extmatch != REX_USE)
Karsten Hopp 236828
+ 			EMSG_RET_FAIL(_(e_z1_not_allowed));
Karsten Hopp 236828
  		    EMIT(NFA_ZREF1 + (no_Magic(c) - '1'));
Karsten Hopp 236828
  		    /* No need to set nfa_has_backref, the sub-matches don't
Karsten Hopp 236828
  		     * change when \z1 .. \z9 maches or not. */
Karsten Hopp 236828
***************
Karsten Hopp 236828
*** 872,877 ****
Karsten Hopp 236828
--- 874,881 ----
Karsten Hopp 236828
  		    break;
Karsten Hopp 236828
  		case '(':
Karsten Hopp 236828
  		    /* \z(  */
Karsten Hopp 236828
+ 		    if (reg_do_extmatch != REX_SET)
Karsten Hopp 236828
+ 			EMSG_RET_FAIL(_(e_z_not_allowed));
Karsten Hopp 236828
  		    if (nfa_reg(REG_ZPAREN) == FAIL)
Karsten Hopp 236828
  			return FAIL;	    /* cascaded error */
Karsten Hopp 236828
  		    re_has_z = REX_SET;
Karsten Hopp 236828
*** ../vim-7.3.1090/src/version.c	2013-06-01 23:02:48.000000000 +0200
Karsten Hopp 236828
--- src/version.c	2013-06-02 14:58:17.000000000 +0200
Karsten Hopp 236828
***************
Karsten Hopp 236828
*** 730,731 ****
Karsten Hopp 236828
--- 730,733 ----
Karsten Hopp 236828
  {   /* Add new patch number below this line */
Karsten Hopp 236828
+ /**/
Karsten Hopp 236828
+     1091,
Karsten Hopp 236828
  /**/
Karsten Hopp 236828
Karsten Hopp 236828
-- 
Karsten Hopp 236828
Don't believe everything you hear or anything you say.
Karsten Hopp 236828
Karsten Hopp 236828
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 236828
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 236828
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 236828
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///