changeset 4714:fc4d7f02ea3a v7.3.1104

updated for version 7.3.1104 Problem: New regexp engine does not handle "~". Solution: Add support for "~".
author Bram Moolenaar <bram@vim.org>
date Sun, 02 Jun 2013 22:08:03 +0200
parents 7a2f465822c4
children fad96d38c27a
files src/regexp_nfa.c src/testdir/test24.in src/testdir/test24.ok src/version.c
diffstat 4 files changed, 25 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -829,9 +829,26 @@ nfa_regatom()
 	    EMSGN(_(e_misplaced), no_Magic(c));
 	    return FAIL;
 
-	case Magic('~'):		/* previous substitute pattern */
-	    /* TODO: Not supported yet */
-	    return FAIL;
+	case Magic('~'):
+	    {
+		char_u	    *lp;
+
+		/* Previous substitute pattern.
+		 * Generated as "\%(pattern\)". */
+		if (reg_prev_sub == NULL)
+		{
+		    EMSG(_(e_nopresub));
+		    return FAIL;
+		}
+		for (lp = reg_prev_sub; *lp != NUL; mb_cptr_adv(lp))
+		{
+		    EMIT(PTR2CHAR(lp));
+		    if (lp != reg_prev_sub)
+			EMIT(NFA_CONCAT);
+		}
+		EMIT(NFA_NOPEN);
+		break;
+	    }
 
 	case Magic('1'):
 	case Magic('2'):
index 80eb90bf699ba694167818d364d2e72c06880a45..7dfc1afdc6999616e5171f76f4ff34d92f7d9a2a
GIT binary patch
literal 1301
zc$|$>TXWJt6z+pB?vp>^)S)v74M`xFN=++hUwyDVw9^gFCM-=9vY1^;sMg=^UQ!4b
zN14p-cRA;<JNYuCTyU7M9CCV3i#aS)kw8S^?|e#l0wfy)6A8_M&uN^JDZ~lMNi1m2
zA<cL?rf?Uc{**Hia#p2P4NYiavslQsY%z;yPRE=67DCs<{+HqK>UxNJoC?TT%w}^U
z(r8NIA)Te!gf)Y#M999wMTiQy2^?w=t_(M9HPTzH6pOd+GjJ@qc#?f{6!*`%#$m44
zStD5_SFhxr>nns$3a_nq<~kiS&T*t8Pi(Lp?K+`t-=k8p9z)!;?UF7O{n<W!DivHO
z_|4jvtg%NMTcxtM^JMq8Bx_G=;JVwE)`yFYJYh^J?~fyrSBf+ImE)#%f=N21&(;Xn
zae|i(d{VbA@GsnwC4o9zVBg&Qv*h;Hln_GfV)baqZ##;|C6t#O3~bbUje3_{kX&4z
z)|SUQG%dCesP}^$qpQ!KbR3YbKsr%a&_bASDP+W#heWM~J7W0PN<l|EV(maB*=h%n
zu_~Qt&v7gnGvju}uIrycS9>w+dMby?8jC}gW2s!~R)633T=1)x8f-ih-s*)vRy-Z(
zjd@fVT86w-j#TRljbCkSll$@&$v3`xF!LpB{rdx6tSY|xG*D3hQ9n@Nf7t=-w%1JN
kUM3z2y%;|Om2}Mlcz2GHBmmz(N2(JL$m1iBQ8f?x1H46>RsaA1
--- a/src/testdir/test24.ok
+++ b/src/testdir/test24.ok
@@ -27,3 +27,6 @@ xx foobar xA xx
 xx an A xx
 XX 9;
 YY 77;
+ xyz 
+ bcd
+ BB
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1104,
+/**/
     1103,
 /**/
     1102,