Patch 8.0.0623
Problem:    The message "Invalid range" is used for multiple errors.
Solution:   Add two more specific error messages. (Itchyny, Ken Hamada)
Files:      src/regexp.c, src/regexp_nfa.c, src/testdir/test_regexp_utf8.vim


*** ../vim-8.0.0622/src/regexp.c        2017-03-29 17:30:23.164136889 +0200
--- src/regexp.c        2017-06-05 16:47:56.834961919 +0200
***************
*** 358,363 ****
--- 358,365 ----
  static int re_mult_next(char *what);
  
  static char_u e_missingbracket[] = N_("E769: Missing ] after %s[");
+ static char_u e_reverse_range[] = N_("E944: Reverse range in character 
class");
+ static char_u e_large_class[] = N_("E945: Range too large in character 
class");
  static char_u e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
  static char_u e_unmatchedp[] = N_("E54: Unmatched %s(");
  static char_u e_unmatchedpar[] = N_("E55: Unmatched %s)");
***************
*** 2426,2439 ****
                                endc = coll_get_char();
  
                            if (startc > endc)
!                               EMSG_RET_NULL(_(e_invrange));
  #ifdef FEAT_MBYTE
                            if (has_mbyte && ((*mb_char2len)(startc) > 1
                                                 || (*mb_char2len)(endc) > 1))
                            {
!                               /* Limit to a range of 256 chars */
                                if (endc > startc + 256)
!                                   EMSG_RET_NULL(_(e_invrange));
                                while (++startc <= endc)
                                    regmbc(startc);
                            }
--- 2428,2441 ----
                                endc = coll_get_char();
  
                            if (startc > endc)
!                               EMSG_RET_NULL(_(e_reverse_range));
  #ifdef FEAT_MBYTE
                            if (has_mbyte && ((*mb_char2len)(startc) > 1
                                                 || (*mb_char2len)(endc) > 1))
                            {
!                               /* Limit to a range of 256 chars. */
                                if (endc > startc + 256)
!                                   EMSG_RET_NULL(_(e_large_class));
                                while (++startc <= endc)
                                    regmbc(startc);
                            }
*** ../vim-8.0.0622/src/regexp_nfa.c    2017-06-05 13:30:01.172255652 +0200
--- src/regexp_nfa.c    2017-06-05 16:47:34.139119607 +0200
***************
*** 1853,1859 ****
                        endc = startc;
                        startc = oldstartc;
                        if (startc > endc)
!                           EMSG_RET_FAIL(_(e_invrange));
  
                        if (endc > startc + 2)
                        {
--- 1853,1859 ----
                        endc = startc;
                        startc = oldstartc;
                        if (startc > endc)
!                           EMSG_RET_FAIL(_(e_reverse_range));
  
                        if (endc > startc + 2)
                        {
*** ../vim-8.0.0622/src/testdir/test_regexp_utf8.vim    2017-03-30 
22:20:23.416149582 +0200
--- src/testdir/test_regexp_utf8.vim    2017-06-05 16:40:52.733891477 +0200
***************
*** 137,139 ****
--- 137,156 ----
    call s:classes_test()
    set re=0
  endfunc
+ 
+ func Test_reversed_range()
+   for re in range(0, 2)
+     exe 'set re=' . re
+     call assert_fails('call match("abc def", "[c-a]")', 'E944:')
+   endfor
+   set re=0
+ endfunc
+ 
+ func Test_large_class()
+   set re=1
+   call assert_fails('call match("abc def", "[\u3000-\u4000]")', 'E945:')
+   set re=2
+   call assert_equal(0, 'abc def' =~# '[\u3000-\u4000]')
+   call assert_equal(1, "\u3042" =~# '[\u3000-\u4000]')
+   set re=0
+ endfunc
*** ../vim-8.0.0622/src/version.c       2017-06-05 16:37:03.331465083 +0200
--- src/version.c       2017-06-05 16:42:51.073079245 +0200
***************
*** 766,767 ****
--- 766,769 ----
  {   /* Add new patch number below this line */
+ /**/
+     623,
  /**/

-- 
The goal of science is to build better mousetraps.
The goal of nature is to build better mice.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui