Karsten Hopp e233d0
To: vim_dev@googlegroups.com
Karsten Hopp e233d0
Subject: Patch 7.3.1019
Karsten Hopp e233d0
Fcc: outbox
Karsten Hopp e233d0
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp e233d0
Mime-Version: 1.0
Karsten Hopp e233d0
Content-Type: text/plain; charset=UTF-8
Karsten Hopp e233d0
Content-Transfer-Encoding: 8bit
Karsten Hopp e233d0
------------
Karsten Hopp e233d0
Karsten Hopp e233d0
Patch 7.3.1019
Karsten Hopp e233d0
Problem:    These do not work with the new regexp engine: \%o123, \%x123,
Karsten Hopp e233d0
	    \%d123, \%u123 and \%U123.
Karsten Hopp e233d0
Solution:   Implement these items.
Karsten Hopp e233d0
Files:	    src/regexp_nfa.c
Karsten Hopp e233d0
Karsten Hopp e233d0
Karsten Hopp e233d0
*** ../vim-7.3.1018/src/regexp_nfa.c	2013-05-25 21:18:30.000000000 +0200
Karsten Hopp e233d0
--- src/regexp_nfa.c	2013-05-25 21:56:16.000000000 +0200
Karsten Hopp e233d0
***************
Karsten Hopp e233d0
*** 604,610 ****
Karsten Hopp e233d0
      char_u	*endp;
Karsten Hopp e233d0
  #ifdef FEAT_MBYTE
Karsten Hopp e233d0
      char_u	*old_regparse = regparse;
Karsten Hopp e233d0
-     int		clen;
Karsten Hopp e233d0
      int		i;
Karsten Hopp e233d0
  #endif
Karsten Hopp e233d0
      int		extra = 0;
Karsten Hopp e233d0
--- 604,609 ----
Karsten Hopp e233d0
***************
Karsten Hopp e233d0
*** 623,637 ****
Karsten Hopp e233d0
      cpo_bsl = vim_strchr(p_cpo, CPO_BACKSL) != NULL;
Karsten Hopp e233d0
  
Karsten Hopp e233d0
      c = getchr();
Karsten Hopp e233d0
- 
Karsten Hopp e233d0
- #ifdef FEAT_MBYTE
Karsten Hopp e233d0
-     /* clen has the length of the current char, without composing chars */
Karsten Hopp e233d0
-     clen = (*mb_char2len)(c);
Karsten Hopp e233d0
-     if (has_mbyte && clen > 1)
Karsten Hopp e233d0
- 	goto nfa_do_multibyte;
Karsten Hopp e233d0
- #endif
Karsten Hopp e233d0
      switch (c)
Karsten Hopp e233d0
      {
Karsten Hopp e233d0
  	case Magic('^'):
Karsten Hopp e233d0
  	    EMIT(NFA_BOL);
Karsten Hopp e233d0
  	    break;
Karsten Hopp e233d0
--- 622,633 ----
Karsten Hopp e233d0
      cpo_bsl = vim_strchr(p_cpo, CPO_BACKSL) != NULL;
Karsten Hopp e233d0
  
Karsten Hopp e233d0
      c = getchr();
Karsten Hopp e233d0
      switch (c)
Karsten Hopp e233d0
      {
Karsten Hopp e233d0
+ 	case NUL:
Karsten Hopp e233d0
+ 	    syntax_error = TRUE;
Karsten Hopp e233d0
+ 	    EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely"));
Karsten Hopp e233d0
+ 
Karsten Hopp e233d0
  	case Magic('^'):
Karsten Hopp e233d0
  	    EMIT(NFA_BOL);
Karsten Hopp e233d0
  	    break;
Karsten Hopp e233d0
***************
Karsten Hopp e233d0
*** 747,756 ****
Karsten Hopp e233d0
  		return FAIL;	    /* cascaded error */
Karsten Hopp e233d0
  	    break;
Karsten Hopp e233d0
  
Karsten Hopp e233d0
- 	case NUL:
Karsten Hopp e233d0
- 	    syntax_error = TRUE;
Karsten Hopp e233d0
- 	    EMSG_RET_FAIL(_("E865: (NFA) Regexp end encountered prematurely"));
Karsten Hopp e233d0
- 
Karsten Hopp e233d0
  	case Magic('|'):
Karsten Hopp e233d0
  	case Magic('&'):
Karsten Hopp e233d0
  	case Magic(')'):
Karsten Hopp e233d0
--- 743,748 ----
Karsten Hopp e233d0
***************
Karsten Hopp e233d0
*** 834,844 ****
Karsten Hopp e233d0
  		case 'x':   /* %xab hex 2 */
Karsten Hopp e233d0
  		case 'u':   /* %uabcd hex 4 */
Karsten Hopp e233d0
  		case 'U':   /* %U1234abcd hex 8 */
Karsten Hopp e233d0
! 		    /* Not yet supported */
Karsten Hopp e233d0
! 		    return FAIL;
Karsten Hopp e233d0
  
Karsten Hopp e233d0
! 		    c = coll_get_char();
Karsten Hopp e233d0
! 		    EMIT(c);
Karsten Hopp e233d0
  		    break;
Karsten Hopp e233d0
  
Karsten Hopp e233d0
  		/* Catch \%^ and \%$ regardless of where they appear in the
Karsten Hopp e233d0
--- 826,851 ----
Karsten Hopp e233d0
  		case 'x':   /* %xab hex 2 */
Karsten Hopp e233d0
  		case 'u':   /* %uabcd hex 4 */
Karsten Hopp e233d0
  		case 'U':   /* %U1234abcd hex 8 */
Karsten Hopp e233d0
! 		    {
Karsten Hopp e233d0
! 			int i;
Karsten Hopp e233d0
  
Karsten Hopp e233d0
! 			switch (c)
Karsten Hopp e233d0
! 			{
Karsten Hopp e233d0
! 			    case 'd': i = getdecchrs(); break;
Karsten Hopp e233d0
! 			    case 'o': i = getoctchrs(); break;
Karsten Hopp e233d0
! 			    case 'x': i = gethexchrs(2); break;
Karsten Hopp e233d0
! 			    case 'u': i = gethexchrs(4); break;
Karsten Hopp e233d0
! 			    case 'U': i = gethexchrs(8); break;
Karsten Hopp e233d0
! 			    default:  i = -1; break;
Karsten Hopp e233d0
! 			}
Karsten Hopp e233d0
! 
Karsten Hopp e233d0
! 			if (i < 0)
Karsten Hopp e233d0
! 			    EMSG2_RET_FAIL(
Karsten Hopp e233d0
! 			       _("E678: Invalid character after %s%%[dxouU]"),
Karsten Hopp e233d0
! 				    reg_magic == MAGIC_ALL);
Karsten Hopp e233d0
! 			/* TODO: what if a composing character follows? */
Karsten Hopp e233d0
! 			EMIT(i);
Karsten Hopp e233d0
! 		    }
Karsten Hopp e233d0
  		    break;
Karsten Hopp e233d0
  
Karsten Hopp e233d0
  		/* Catch \%^ and \%$ regardless of where they appear in the
Karsten Hopp e233d0
***************
Karsten Hopp e233d0
*** 1217,1225 ****
Karsten Hopp e233d0
  		int	plen;
Karsten Hopp e233d0
  
Karsten Hopp e233d0
  nfa_do_multibyte:
Karsten Hopp e233d0
! 		/* Length of current char with composing chars. */
Karsten Hopp e233d0
! 		if (enc_utf8 && (clen != (plen = (*mb_ptr2len)(old_regparse))
Karsten Hopp e233d0
! 			    || utf_iscomposing(c)))
Karsten Hopp e233d0
  		{
Karsten Hopp e233d0
  		    /* A base character plus composing characters, or just one
Karsten Hopp e233d0
  		     * or more composing characters.
Karsten Hopp e233d0
--- 1224,1233 ----
Karsten Hopp e233d0
  		int	plen;
Karsten Hopp e233d0
  
Karsten Hopp e233d0
  nfa_do_multibyte:
Karsten Hopp e233d0
! 		/* plen is length of current char with composing chars */
Karsten Hopp e233d0
! 		if (enc_utf8 && ((*mb_char2len)(c)
Karsten Hopp e233d0
! 			    != (plen = (*mb_ptr2len)(old_regparse))
Karsten Hopp e233d0
! 						       || utf_iscomposing(c)))
Karsten Hopp e233d0
  		{
Karsten Hopp e233d0
  		    /* A base character plus composing characters, or just one
Karsten Hopp e233d0
  		     * or more composing characters.
Karsten Hopp e233d0
*** ../vim-7.3.1018/src/version.c	2013-05-25 21:18:30.000000000 +0200
Karsten Hopp e233d0
--- src/version.c	2013-05-25 22:00:51.000000000 +0200
Karsten Hopp e233d0
***************
Karsten Hopp e233d0
*** 730,731 ****
Karsten Hopp e233d0
--- 730,733 ----
Karsten Hopp e233d0
  {   /* Add new patch number below this line */
Karsten Hopp e233d0
+ /**/
Karsten Hopp e233d0
+     1019,
Karsten Hopp e233d0
  /**/
Karsten Hopp e233d0
Karsten Hopp e233d0
-- 
Karsten Hopp e233d0
The budget process was invented by an alien race of sadistic beings who
Karsten Hopp e233d0
resemble large cats.
Karsten Hopp e233d0
				(Scott Adams - The Dilbert principle)
Karsten Hopp e233d0
Karsten Hopp e233d0
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp e233d0
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp e233d0
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp e233d0
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///