]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.1086 v7.3.1086
authorBram Moolenaar <Bram@vim.org>
Sat, 1 Jun 2013 11:24:24 +0000 (13:24 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 1 Jun 2013 11:24:24 +0000 (13:24 +0200)
Problem:    Old regexp engine accepts illegal range, new one doesn't.
Solution:   Also accept the illegal range with the new engine.

src/regexp_nfa.c
src/testdir/test64.in
src/testdir/test64.ok
src/version.c

index 753733d2b6df7b6a1bdc447232fd2398499e7b4c..2d1df6d6365283de2e7fcbd65940784563ae9004 100644 (file)
@@ -1089,8 +1089,9 @@ collection:
                             * while loop. */
                        }
                    }
-                   /* Try a range like 'a-x' or '\t-z' */
-                   if (*regparse == '-')
+                   /* Try a range like 'a-x' or '\t-z'. Also allows '-' as a
+                    * start character. */
+                   if (*regparse == '-' && oldstartc != -1)
                    {
                        emit_range = TRUE;
                        startc = oldstartc;
@@ -1140,16 +1141,13 @@ collection:
 
                    /* Normal printable char */
                    if (startc == -1)
-#ifdef FEAT_MBYTE
-                       startc = (*mb_ptr2char)(regparse);
-#else
-                   startc = *regparse;
-#endif
+                       startc = PTR2CHAR(regparse);
 
                    /* Previous char was '-', so this char is end of range. */
                    if (emit_range)
                    {
-                       endc = startc; startc = oldstartc;
+                       endc = startc;
+                       startc = oldstartc;
                        if (startc > endc)
                            EMSG_RET_FAIL(_(e_invrange));
 #ifdef FEAT_MBYTE
@@ -1166,7 +1164,6 @@ collection:
                                TRY_NEG();
                                EMIT_GLUE();
                            }
-                           emit_range = FALSE;
                        }
                        else
 #endif
@@ -1190,8 +1187,9 @@ collection:
                                    TRY_NEG();
                                    EMIT_GLUE();
                                }
-                           emit_range = FALSE;
                        }
+                       emit_range = FALSE;
+                       startc = -1;
                    }
                    else
                    {
index f76f62f29605c45554e83eead018301b57d43d0c..346e792fae0f8e9fb849cbbdb25b987e55a0e176 100644 (file)
@@ -270,6 +270,7 @@ STARTTEST
 :call add(tl, [2, '\_[0-9]\+', "asfi\n9888u", "\n9888"])
 :call add(tl, [2, '\_f', "  \na ", "\n"])
 :call add(tl, [2, '\_f\+', "  \na ", "\na"])
+:call add(tl, [2, '[0-9A-Za-z-_.]\+', " @0_a.A-{ ", "0_a.A-"])
 :"
 :"""" Test start/end of line, start/end of file
 :call add(tl, [2, '^a.', "a_\nb ", "a_"])
index 6423ecd4a27218070284c1b01c7a10eb74cc75f0..fdd55da3855b94823e2334c918a70391caced79c 100644 (file)
@@ -605,6 +605,9 @@ OK 2 - \_f
 OK 0 - \_f\+
 OK 1 - \_f\+
 OK 2 - \_f\+
+OK 0 - [0-9A-Za-z-_.]\+
+OK 1 - [0-9A-Za-z-_.]\+
+OK 2 - [0-9A-Za-z-_.]\+
 OK 0 - ^a.
 OK 1 - ^a.
 OK 2 - ^a.
index 7d17122eced9210da59ea2c180eba6e03c40c017..ec0105e441fcbe5a1d31e875115dd6da8739bd68 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1086,
 /**/
     1085,
 /**/