Karsten Hopp ae76c0
To: vim_dev@googlegroups.com
Karsten Hopp ae76c0
Subject: Patch 7.3.1086
Karsten Hopp ae76c0
Fcc: outbox
Karsten Hopp ae76c0
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp ae76c0
Mime-Version: 1.0
Karsten Hopp ae76c0
Content-Type: text/plain; charset=UTF-8
Karsten Hopp ae76c0
Content-Transfer-Encoding: 8bit
Karsten Hopp ae76c0
------------
Karsten Hopp ae76c0
Karsten Hopp ae76c0
Patch 7.3.1086
Karsten Hopp ae76c0
Problem:    Old regexp engine accepts illegal range, new one doesn't.
Karsten Hopp ae76c0
Solution:   Also accept the illegal range with the new engine.
Karsten Hopp ae76c0
Files:	    src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
Karsten Hopp ae76c0
Karsten Hopp ae76c0
Karsten Hopp ae76c0
*** ../vim-7.3.1085/src/regexp_nfa.c	2013-06-01 12:40:14.000000000 +0200
Karsten Hopp ae76c0
--- src/regexp_nfa.c	2013-06-01 13:16:34.000000000 +0200
Karsten Hopp ae76c0
***************
Karsten Hopp ae76c0
*** 1089,1096 ****
Karsten Hopp ae76c0
  			     * while loop. */
Karsten Hopp ae76c0
  			}
Karsten Hopp ae76c0
  		    }
Karsten Hopp ae76c0
! 		    /* Try a range like 'a-x' or '\t-z' */
Karsten Hopp ae76c0
! 		    if (*regparse == '-')
Karsten Hopp ae76c0
  		    {
Karsten Hopp ae76c0
  			emit_range = TRUE;
Karsten Hopp ae76c0
  			startc = oldstartc;
Karsten Hopp ae76c0
--- 1089,1097 ----
Karsten Hopp ae76c0
  			     * while loop. */
Karsten Hopp ae76c0
  			}
Karsten Hopp ae76c0
  		    }
Karsten Hopp ae76c0
! 		    /* Try a range like 'a-x' or '\t-z'. Also allows '-' as a
Karsten Hopp ae76c0
! 		     * start character. */
Karsten Hopp ae76c0
! 		    if (*regparse == '-' && oldstartc != -1)
Karsten Hopp ae76c0
  		    {
Karsten Hopp ae76c0
  			emit_range = TRUE;
Karsten Hopp ae76c0
  			startc = oldstartc;
Karsten Hopp ae76c0
***************
Karsten Hopp ae76c0
*** 1140,1155 ****
Karsten Hopp ae76c0
  
Karsten Hopp ae76c0
  		    /* Normal printable char */
Karsten Hopp ae76c0
  		    if (startc == -1)
Karsten Hopp ae76c0
! #ifdef FEAT_MBYTE
Karsten Hopp ae76c0
! 			startc = (*mb_ptr2char)(regparse);
Karsten Hopp ae76c0
! #else
Karsten Hopp ae76c0
! 		    startc = *regparse;
Karsten Hopp ae76c0
! #endif
Karsten Hopp ae76c0
  
Karsten Hopp ae76c0
  		    /* Previous char was '-', so this char is end of range. */
Karsten Hopp ae76c0
  		    if (emit_range)
Karsten Hopp ae76c0
  		    {
Karsten Hopp ae76c0
! 			endc = startc; startc = oldstartc;
Karsten Hopp ae76c0
  			if (startc > endc)
Karsten Hopp ae76c0
  			    EMSG_RET_FAIL(_(e_invrange));
Karsten Hopp ae76c0
  #ifdef FEAT_MBYTE
Karsten Hopp ae76c0
--- 1141,1153 ----
Karsten Hopp ae76c0
  
Karsten Hopp ae76c0
  		    /* Normal printable char */
Karsten Hopp ae76c0
  		    if (startc == -1)
Karsten Hopp ae76c0
! 			startc = PTR2CHAR(regparse);
Karsten Hopp ae76c0
  
Karsten Hopp ae76c0
  		    /* Previous char was '-', so this char is end of range. */
Karsten Hopp ae76c0
  		    if (emit_range)
Karsten Hopp ae76c0
  		    {
Karsten Hopp ae76c0
! 			endc = startc;
Karsten Hopp ae76c0
! 			startc = oldstartc;
Karsten Hopp ae76c0
  			if (startc > endc)
Karsten Hopp ae76c0
  			    EMSG_RET_FAIL(_(e_invrange));
Karsten Hopp ae76c0
  #ifdef FEAT_MBYTE
Karsten Hopp ae76c0
***************
Karsten Hopp ae76c0
*** 1166,1172 ****
Karsten Hopp ae76c0
  				TRY_NEG();
Karsten Hopp ae76c0
  				EMIT_GLUE();
Karsten Hopp ae76c0
  			    }
Karsten Hopp ae76c0
- 			    emit_range = FALSE;
Karsten Hopp ae76c0
  			}
Karsten Hopp ae76c0
  			else
Karsten Hopp ae76c0
  #endif
Karsten Hopp ae76c0
--- 1164,1169 ----
Karsten Hopp ae76c0
***************
Karsten Hopp ae76c0
*** 1190,1197 ****
Karsten Hopp ae76c0
  				    TRY_NEG();
Karsten Hopp ae76c0
  				    EMIT_GLUE();
Karsten Hopp ae76c0
  				}
Karsten Hopp ae76c0
- 			    emit_range = FALSE;
Karsten Hopp ae76c0
  			}
Karsten Hopp ae76c0
  		    }
Karsten Hopp ae76c0
  		    else
Karsten Hopp ae76c0
  		    {
Karsten Hopp ae76c0
--- 1187,1195 ----
Karsten Hopp ae76c0
  				    TRY_NEG();
Karsten Hopp ae76c0
  				    EMIT_GLUE();
Karsten Hopp ae76c0
  				}
Karsten Hopp ae76c0
  			}
Karsten Hopp ae76c0
+ 			emit_range = FALSE;
Karsten Hopp ae76c0
+ 			startc = -1;
Karsten Hopp ae76c0
  		    }
Karsten Hopp ae76c0
  		    else
Karsten Hopp ae76c0
  		    {
Karsten Hopp ae76c0
*** ../vim-7.3.1085/src/testdir/test64.in	2013-06-01 12:40:14.000000000 +0200
Karsten Hopp ae76c0
--- src/testdir/test64.in	2013-06-01 13:14:51.000000000 +0200
Karsten Hopp ae76c0
***************
Karsten Hopp ae76c0
*** 270,275 ****
Karsten Hopp ae76c0
--- 270,276 ----
Karsten Hopp ae76c0
  :call add(tl, [2, '\_[0-9]\+', "asfi\n9888u", "\n9888"])
Karsten Hopp ae76c0
  :call add(tl, [2, '\_f', "  \na ", "\n"])
Karsten Hopp ae76c0
  :call add(tl, [2, '\_f\+', "  \na ", "\na"])
Karsten Hopp ae76c0
+ :call add(tl, [2, '[0-9A-Za-z-_.]\+', " @0_a.A-{ ", "0_a.A-"])
Karsten Hopp ae76c0
  :"
Karsten Hopp ae76c0
  :"""" Test start/end of line, start/end of file
Karsten Hopp ae76c0
  :call add(tl, [2, '^a.', "a_\nb ", "a_"])
Karsten Hopp ae76c0
*** ../vim-7.3.1085/src/testdir/test64.ok	2013-06-01 12:40:14.000000000 +0200
Karsten Hopp ae76c0
--- src/testdir/test64.ok	2013-06-01 13:22:58.000000000 +0200
Karsten Hopp ae76c0
***************
Karsten Hopp ae76c0
*** 605,610 ****
Karsten Hopp ae76c0
--- 605,613 ----
Karsten Hopp ae76c0
  OK 0 - \_f\+
Karsten Hopp ae76c0
  OK 1 - \_f\+
Karsten Hopp ae76c0
  OK 2 - \_f\+
Karsten Hopp ae76c0
+ OK 0 - [0-9A-Za-z-_.]\+
Karsten Hopp ae76c0
+ OK 1 - [0-9A-Za-z-_.]\+
Karsten Hopp ae76c0
+ OK 2 - [0-9A-Za-z-_.]\+
Karsten Hopp ae76c0
  OK 0 - ^a.
Karsten Hopp ae76c0
  OK 1 - ^a.
Karsten Hopp ae76c0
  OK 2 - ^a.
Karsten Hopp ae76c0
*** ../vim-7.3.1085/src/version.c	2013-06-01 12:40:14.000000000 +0200
Karsten Hopp ae76c0
--- src/version.c	2013-06-01 13:17:56.000000000 +0200
Karsten Hopp ae76c0
***************
Karsten Hopp ae76c0
*** 730,731 ****
Karsten Hopp ae76c0
--- 730,733 ----
Karsten Hopp ae76c0
  {   /* Add new patch number below this line */
Karsten Hopp ae76c0
+ /**/
Karsten Hopp ae76c0
+     1086,
Karsten Hopp ae76c0
  /**/
Karsten Hopp ae76c0
Karsten Hopp ae76c0
-- 
Karsten Hopp ae76c0
Micro$oft: where do you want to go today?
Karsten Hopp ae76c0
    Linux: where do you want to go tomorrow?
Karsten Hopp ae76c0
  FreeBSD: are you guys coming, or what?
Karsten Hopp ae76c0
Karsten Hopp ae76c0
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp ae76c0
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp ae76c0
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp ae76c0
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///