Merge #1322 'vim-patch:7.4.421 + vim-patch:7.4.437'

This commit is contained in:
Justin M. Keyes 2014-11-13 11:41:50 -05:00
commit c7a3109dd3
5 changed files with 38 additions and 4 deletions

View File

@ -1983,9 +1983,15 @@ static char_u *regatom(int *flagp)
break;
case 's': ret = regnode(MOPEN + 0);
if (!re_mult_next("\\zs")) {
return NULL;
}
break;
case 'e': ret = regnode(MCLOSE + 0);
if (!re_mult_next("\\ze")) {
return NULL;
}
break;
default: EMSG_RET_NULL(_("E68: Invalid character after \\z"));
@ -2460,6 +2466,15 @@ do_multibyte:
return ret;
}
/// Used in a place where no * or \+ can follow.
static bool re_mult_next(char *what)
{
if (re_multi_type(peekchr()) == MULTI_MULT) {
EMSG2_RET_FAIL(_("E888: (NFA regexp) cannot repeat %s"), what);
}
return true;
}
/*
* Return TRUE if MULTIBYTECODE should be used instead of EXACTLY for
* character "c".

View File

@ -1259,10 +1259,16 @@ static int nfa_regatom(void)
switch (c) {
case 's':
EMIT(NFA_ZSTART);
if (!re_mult_next("\\zs")) {
return false;
}
break;
case 'e':
EMIT(NFA_ZEND);
nfa_has_zend = TRUE;
nfa_has_zend = true;
if (!re_mult_next("\\zs")) {
return false;
}
break;
case '1':
case '2':

View File

@ -459,7 +459,7 @@ STARTTEST
: let text = t[2]
: let matchidx = 3
: for engine in [0, 1, 2]
: if engine == 2 && re == 0 || engine == 1 && re ==1
: if engine == 2 && re == 0 || engine == 1 && re == 1
: continue
: endif
: let &regexpengine = engine
@ -608,6 +608,17 @@ yeGopA END:"
"ayb20gg/..\%$
"bybGo"apo"bp:"
:"
:" Check for detecting error
:set regexpengine=2
:for pat in [' \ze*', ' \zs*']
: try
: let l = matchlist('x x', pat)
: $put ='E888 NOT detected for ' . pat
: catch
: $put ='E888 detected for ' . pat
: endtry
:endfor
:"
:""""" Write the results """""""""""""
:/\%#=1^Results/,$wq! test.out
ENDTEST

View File

@ -1097,3 +1097,5 @@ Test
Test END
EN
E
E888 detected for \ze*
E888 detected for \zs*

View File

@ -228,7 +228,7 @@ static int included_patches[] = {
440,
439,
//438,
//437,
437,
436,
//435,
//434,
@ -244,7 +244,7 @@ static int included_patches[] = {
//424 NA
//423,
//422,
//421,
421,
//420 NA
419,
418,