diff src/regexp_nfa.c @ 4615:5679b8ddd8cc v7.3.1055

updated for version 7.3.1055 Problem: Negated collection does not match newline. Solution: Handle newline differently. (Hiroshi Shirosaki)
author Bram Moolenaar <bram@vim.org>
date Thu, 30 May 2013 11:51:08 +0200
parents 321cfbef9431
children 857f6c53f117
line wrap: on
line diff
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -1203,13 +1203,6 @@ collection:
 		}
 		mb_ptr_adv(regparse);
 
-		if (extra == ADD_NL)	    /* \_[] also matches \n */
-		{
-		    EMIT(reg_string ? NL : NFA_NEWL);
-		    TRY_NEG();
-		    EMIT_GLUE();
-		}
-
 		/* skip the trailing ] */
 		regparse = endp;
 		mb_ptr_adv(regparse);
@@ -1219,6 +1212,14 @@ collection:
 		    EMIT(NFA_END_NEG_RANGE);
 		    EMIT(NFA_CONCAT);
 		}
+
+		/* \_[] also matches \n but it's not negated */
+		if (extra == ADD_NL)
+		{
+		    EMIT(reg_string ? NL : NFA_NEWL);
+		    EMIT(NFA_OR);
+		}
+
 		return OK;
 	    } /* if exists closing ] */