Karsten Hopp f7046f
To: vim_dev@googlegroups.com
Karsten Hopp f7046f
Subject: Patch 7.3.1055
Karsten Hopp f7046f
Fcc: outbox
Karsten Hopp f7046f
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp f7046f
Mime-Version: 1.0
Karsten Hopp f7046f
Content-Type: text/plain; charset=UTF-8
Karsten Hopp f7046f
Content-Transfer-Encoding: 8bit
Karsten Hopp f7046f
------------
Karsten Hopp f7046f
Karsten Hopp f7046f
Patch 7.3.1055
Karsten Hopp f7046f
Problem:    Negated collection does not match newline.
Karsten Hopp f7046f
Solution:   Handle newline differently. (Hiroshi Shirosaki)
Karsten Hopp f7046f
Files:	    src/regexp_nfa.c, src/testdir/test64.ok, src/testdir/test64.in
Karsten Hopp f7046f
Karsten Hopp f7046f
Karsten Hopp f7046f
*** ../vim-7.3.1054/src/regexp_nfa.c	2013-05-29 21:14:37.000000000 +0200
Karsten Hopp f7046f
--- src/regexp_nfa.c	2013-05-30 11:47:40.000000000 +0200
Karsten Hopp f7046f
***************
Karsten Hopp f7046f
*** 1203,1215 ****
Karsten Hopp f7046f
  		}
Karsten Hopp f7046f
  		mb_ptr_adv(regparse);
Karsten Hopp f7046f
  
Karsten Hopp f7046f
- 		if (extra == ADD_NL)	    /* \_[] also matches \n */
Karsten Hopp f7046f
- 		{
Karsten Hopp f7046f
- 		    EMIT(reg_string ? NL : NFA_NEWL);
Karsten Hopp f7046f
- 		    TRY_NEG();
Karsten Hopp f7046f
- 		    EMIT_GLUE();
Karsten Hopp f7046f
- 		}
Karsten Hopp f7046f
- 
Karsten Hopp f7046f
  		/* skip the trailing ] */
Karsten Hopp f7046f
  		regparse = endp;
Karsten Hopp f7046f
  		mb_ptr_adv(regparse);
Karsten Hopp f7046f
--- 1203,1208 ----
Karsten Hopp f7046f
***************
Karsten Hopp f7046f
*** 1219,1224 ****
Karsten Hopp f7046f
--- 1212,1225 ----
Karsten Hopp f7046f
  		    EMIT(NFA_END_NEG_RANGE);
Karsten Hopp f7046f
  		    EMIT(NFA_CONCAT);
Karsten Hopp f7046f
  		}
Karsten Hopp f7046f
+ 
Karsten Hopp f7046f
+ 		/* \_[] also matches \n but it's not negated */
Karsten Hopp f7046f
+ 		if (extra == ADD_NL)
Karsten Hopp f7046f
+ 		{
Karsten Hopp f7046f
+ 		    EMIT(reg_string ? NL : NFA_NEWL);
Karsten Hopp f7046f
+ 		    EMIT(NFA_OR);
Karsten Hopp f7046f
+ 		}
Karsten Hopp f7046f
+ 
Karsten Hopp f7046f
  		return OK;
Karsten Hopp f7046f
  	    } /* if exists closing ] */
Karsten Hopp f7046f
  
Karsten Hopp f7046f
*** ../vim-7.3.1054/src/testdir/test64.ok	2013-05-29 21:14:37.000000000 +0200
Karsten Hopp f7046f
--- src/testdir/test64.ok	2013-05-30 11:48:31.000000000 +0200
Karsten Hopp f7046f
***************
Karsten Hopp f7046f
*** 731,736 ****
Karsten Hopp f7046f
--- 731,742 ----
Karsten Hopp f7046f
  OK 1 - \(<<\)\@1<=span.
Karsten Hopp f7046f
  OK 0 - \(<<\)\@2<=span.
Karsten Hopp f7046f
  OK 1 - \(<<\)\@2<=span.
Karsten Hopp f7046f
+ OK 0 - \_[^8-9]\+
Karsten Hopp f7046f
+ OK 1 - \_[^8-9]\+
Karsten Hopp f7046f
+ OK 2 - \_[^8-9]\+
Karsten Hopp f7046f
+ OK 0 - \_[^a]\+
Karsten Hopp f7046f
+ OK 1 - \_[^a]\+
Karsten Hopp f7046f
+ OK 2 - \_[^a]\+
Karsten Hopp f7046f
  192.168.0.1
Karsten Hopp f7046f
  192.168.0.1
Karsten Hopp f7046f
  192.168.0.1
Karsten Hopp f7046f
*** ../vim-7.3.1054/src/testdir/test64.in	2013-05-29 21:14:37.000000000 +0200
Karsten Hopp f7046f
--- src/testdir/test64.in	2013-05-30 11:45:59.000000000 +0200
Karsten Hopp f7046f
***************
Karsten Hopp f7046f
*** 344,351 ****
Karsten Hopp f7046f
  :call add(tl, [0, '\(<<\)\@1<=span.', 'xxspanxxxx
Karsten Hopp f7046f
  :call add(tl, [0, '\(<<\)\@2<=span.', 'xxspanxxxx
Karsten Hopp f7046f
  :"
Karsten Hopp f7046f
! :"""" Run the tests
Karsten Hopp f7046f
  :"
Karsten Hopp f7046f
  :"
Karsten Hopp f7046f
  :for t in tl
Karsten Hopp f7046f
  :  let re = t[0]
Karsten Hopp f7046f
--- 344,355 ----
Karsten Hopp f7046f
  :call add(tl, [0, '\(<<\)\@1<=span.', 'xxspanxxxx
Karsten Hopp f7046f
  :call add(tl, [0, '\(<<\)\@2<=span.', 'xxspanxxxx
Karsten Hopp f7046f
  :"
Karsten Hopp f7046f
! :"""" "\_" prepended negated collection matches EOL
Karsten Hopp f7046f
! :call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"])
Karsten Hopp f7046f
! :call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"])
Karsten Hopp f7046f
! :"
Karsten Hopp f7046f
  :"
Karsten Hopp f7046f
+ :"""" Run the tests
Karsten Hopp f7046f
  :"
Karsten Hopp f7046f
  :for t in tl
Karsten Hopp f7046f
  :  let re = t[0]
Karsten Hopp f7046f
*** ../vim-7.3.1054/src/version.c	2013-05-30 11:43:11.000000000 +0200
Karsten Hopp f7046f
--- src/version.c	2013-05-30 11:49:51.000000000 +0200
Karsten Hopp f7046f
***************
Karsten Hopp f7046f
*** 730,731 ****
Karsten Hopp f7046f
--- 730,733 ----
Karsten Hopp f7046f
  {   /* Add new patch number below this line */
Karsten Hopp f7046f
+ /**/
Karsten Hopp f7046f
+     1055,
Karsten Hopp f7046f
  /**/
Karsten Hopp f7046f
Karsten Hopp f7046f
-- 
Karsten Hopp f7046f
"Making it up?  Why should I want to make anything up?  Life's bad enough
Karsten Hopp f7046f
as it is without wanting to invent any more of it."
Karsten Hopp f7046f
		-- Marvin, the Paranoid Android in Douglas Adams'
Karsten Hopp f7046f
		   "The Hitchhiker's Guide to the Galaxy"
Karsten Hopp f7046f
Karsten Hopp f7046f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp f7046f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp f7046f
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp f7046f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///