diff src/regexp_nfa.c @ 5895:b871734bf54e v7.4.290

updated for version 7.4.290 Problem: A non-greedy match followed by a branch is too greedy. (Ingo Karkat) Solution: Add NFA_MATCH when it is already in the state list if the position differs.
author Bram Moolenaar <bram@vim.org>
date Tue, 13 May 2014 16:44:29 +0200
parents 99374096a76b
children 10fc95f48546
line wrap: on
line diff
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -4324,8 +4324,10 @@ addstate(l, state, subs_arg, pim, off)
 	    {
 		/* This state is already in the list, don't add it again,
 		 * unless it is an MOPEN that is used for a backreference or
-		 * when there is a PIM. */
-		if (!nfa_has_backref && pim == NULL && !l->has_pim)
+		 * when there is a PIM. For NFA_MATCH check the position,
+		 * lower position is preferred. */
+		if (!nfa_has_backref && pim == NULL && !l->has_pim
+						     && state->c != NFA_MATCH)
 		{
 skip_add:
 #ifdef ENABLE_LOG