Mercurial > vim
changeset 4944:613651492c19 v7.3.1217
updated for version 7.3.1217
Problem: New regexp engine: Can't handle \%[[ao]]. (Yukihiro Nakadaira)
Solution: Support nested atoms inside \%[].
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 17 Jun 2013 21:33:41 +0200 |
parents | 18cd87117e0f |
children | 6eaa2ff2149b |
files | src/regexp_nfa.c src/testdir/test64.in src/testdir/test64.ok src/version.c |
diffstat | 4 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -1150,13 +1150,16 @@ nfa_regatom() int n; /* \%[abc] */ - for (n = 0; (c = getchr()) != ']'; ++n) + for (n = 0; (c = peekchr()) != ']'; ++n) { if (c == NUL) EMSG2_RET_FAIL(_(e_missing_sb), reg_magic == MAGIC_ALL); - EMIT(c); + /* recursive call! */ + if (nfa_regatom() == FAIL) + return FAIL; } + getchr(); /* get the ] */ if (n == 0) EMSG2_RET_FAIL(_(e_empty_sb), reg_magic == MAGIC_ALL);
--- a/src/testdir/test64.in +++ b/src/testdir/test64.in @@ -366,6 +366,7 @@ STARTTEST :call add(tl, [2, '\%[bar]x', 'barxx', 'barx']) :call add(tl, [2, '\%[bar]x', 'bxx', 'bx']) :call add(tl, [2, '\%[bar]x', 'xxx', 'x']) +:call add(tl, [2, 'b\%[[ao]r]', 'bar bor', 'bar']) :" :"""" Alternatives, must use first longest match :call add(tl, [2, 'goo\|go', 'google', 'goo'])