jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.290

073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.290
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.290
073263
Problem:    A non-greedy match followed by a branch is too greedy. (Ingo
073263
	    Karkat)
073263
Solution:   Add NFA_MATCH when it is already in the state list if the position
073263
	    differs.
073263
Files:	    src/testdir/test64.in, src/testdir/test64.ok, src/regexp_nfa.c
073263
073263
073263
*** ../vim-7.4.289/src/testdir/test64.in	2014-05-13 15:56:45.017670668 +0200
073263
--- src/testdir/test64.in	2014-05-13 16:15:57.213680754 +0200
073263
***************
073263
*** 238,244 ****
073263
  :call add(tl, [2, '\vx(.{-,8})yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz','ayxa','xayzxayz'])
073263
  :call add(tl, [2, '\vx(.*)yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz', 'ayxayzxayzxa',''])
073263
  :call add(tl, [2, '\v(a{1,2}){-2,3}','aaaaaaa','aaaa','aa'])
073263
! :call add(tl, [2, '\v(a{-1,3})+','aa','aa','a'])
073263
  :"
073263
  :" Test Character classes
073263
  :call add(tl, [2, '\d\+e\d\d','test 10e23 fd','10e23'])
073263
--- 238,248 ----
073263
  :call add(tl, [2, '\vx(.{-,8})yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz','ayxa','xayzxayz'])
073263
  :call add(tl, [2, '\vx(.*)yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz', 'ayxayzxayzxa',''])
073263
  :call add(tl, [2, '\v(a{1,2}){-2,3}','aaaaaaa','aaaa','aa'])
073263
! :call add(tl, [2, '\v(a{-1,3})+', 'aa', 'aa', 'a'])
073263
! :call add(tl, [2, '^\s\{-}\zs\( x\|x$\)', ' x', ' x', ' x'])
073263
! :call add(tl, [2, '^\s\{-}\zs\(x\| x$\)', ' x', ' x', ' x'])
073263
! :call add(tl, [2, '^\s\{-}\ze\(x\| x$\)', ' x', '', ' x'])
073263
! :call add(tl, [2, '^\(\s\{-}\)\(x\| x$\)', ' x', ' x', '', ' x'])
073263
  :"
073263
  :" Test Character classes
073263
  :call add(tl, [2, '\d\+e\d\d','test 10e23 fd','10e23'])
073263
***************
073263
*** 462,476 ****
073263
  :    try
073263
  :      let l = matchlist(text, pat)
073263
  :    catch
073263
! :      $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"'
073263
  :    endtry
073263
  :" check the match itself
073263
  :    if len(l) == 0 && len(t) > matchidx
073263
! :      $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"'
073263
  :    elseif len(l) > 0 && len(t) == matchidx
073263
! :      $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected no match'
073263
  :    elseif len(t) > matchidx && l[0] != t[matchidx]
073263
! :      $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected: \"' . t[matchidx] . '\"'
073263
  :    else
073263
  :      $put ='OK ' . engine . ' - ' . pat
073263
  :    endif
073263
--- 466,480 ----
073263
  :    try
073263
  :      let l = matchlist(text, pat)
073263
  :    catch
073263
! :      $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"'
073263
  :    endtry
073263
  :" check the match itself
073263
  :    if len(l) == 0 && len(t) > matchidx
073263
! :      $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"'
073263
  :    elseif len(l) > 0 && len(t) == matchidx
073263
! :      $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected no match'
073263
  :    elseif len(t) > matchidx && l[0] != t[matchidx]
073263
! :      $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected: \"' . t[matchidx] . '\"'
073263
  :    else
073263
  :      $put ='OK ' . engine . ' - ' . pat
073263
  :    endif
073263
***************
073263
*** 483,489 ****
073263
  :          let e = t[matchidx + i]
073263
  :        endif
073263
  :        if l[i] != e
073263
! :          $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"'
073263
  :        endif
073263
  :      endfor
073263
  :      unlet i
073263
--- 487,493 ----
073263
  :          let e = t[matchidx + i]
073263
  :        endif
073263
  :        if l[i] != e
073263
! :          $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"'
073263
  :        endif
073263
  :      endfor
073263
  :      unlet i
073263
*** ../vim-7.4.289/src/testdir/test64.ok	2014-05-13 15:56:45.017670668 +0200
073263
--- src/testdir/test64.ok	2014-05-13 16:39:35.077693166 +0200
073263
***************
073263
*** 533,538 ****
073263
--- 533,550 ----
073263
  OK 0 - \v(a{-1,3})+
073263
  OK 1 - \v(a{-1,3})+
073263
  OK 2 - \v(a{-1,3})+
073263
+ OK 0 - ^\s\{-}\zs\( x\|x$\)
073263
+ OK 1 - ^\s\{-}\zs\( x\|x$\)
073263
+ OK 2 - ^\s\{-}\zs\( x\|x$\)
073263
+ OK 0 - ^\s\{-}\zs\(x\| x$\)
073263
+ OK 1 - ^\s\{-}\zs\(x\| x$\)
073263
+ OK 2 - ^\s\{-}\zs\(x\| x$\)
073263
+ OK 0 - ^\s\{-}\ze\(x\| x$\)
073263
+ OK 1 - ^\s\{-}\ze\(x\| x$\)
073263
+ OK 2 - ^\s\{-}\ze\(x\| x$\)
073263
+ OK 0 - ^\(\s\{-}\)\(x\| x$\)
073263
+ OK 1 - ^\(\s\{-}\)\(x\| x$\)
073263
+ OK 2 - ^\(\s\{-}\)\(x\| x$\)
073263
  OK 0 - \d\+e\d\d
073263
  OK 1 - \d\+e\d\d
073263
  OK 2 - \d\+e\d\d
073263
*** ../vim-7.4.289/src/regexp_nfa.c	2014-05-13 15:56:45.021670668 +0200
073263
--- src/regexp_nfa.c	2014-05-13 16:37:58.481692320 +0200
073263
***************
073263
*** 4324,4331 ****
073263
  	    {
073263
  		/* This state is already in the list, don't add it again,
073263
  		 * unless it is an MOPEN that is used for a backreference or
073263
! 		 * when there is a PIM. */
073263
! 		if (!nfa_has_backref && pim == NULL && !l->has_pim)
073263
  		{
073263
  skip_add:
073263
  #ifdef ENABLE_LOG
073263
--- 4324,4333 ----
073263
  	    {
073263
  		/* This state is already in the list, don't add it again,
073263
  		 * unless it is an MOPEN that is used for a backreference or
073263
! 		 * when there is a PIM. For NFA_MATCH check the position,
073263
! 		 * lower position is preferred. */
073263
! 		if (!nfa_has_backref && pim == NULL && !l->has_pim
073263
! 						     && state->c != NFA_MATCH)
073263
  		{
073263
  skip_add:
073263
  #ifdef ENABLE_LOG
073263
*** ../vim-7.4.289/src/version.c	2014-05-13 15:56:45.025670668 +0200
073263
--- src/version.c	2014-05-13 16:13:33.953679500 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     290,
073263
  /**/
073263
073263
-- 
073263
Although the scythe isn't pre-eminent among the weapons of war, anyone who
073263
has been on the wrong end of, say, a peasants' revolt will know that in
073263
skilled hands it is fearsome.
073263
					-- (Terry Pratchett, Mort)
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///