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)");
endc = coll_get_char();
if (startc > endc)
- EMSG_RET_NULL(_(e_invrange));
+ 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 */
+ /* Limit to a range of 256 chars. */
if (endc > startc + 256)
- EMSG_RET_NULL(_(e_invrange));
+ EMSG_RET_NULL(_(e_large_class));
while (++startc <= endc)
regmbc(startc);
}
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