diff options
author | Bram Moolenaar <bram@vim.org> | 2013-06-17 21:33:41 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2013-06-17 21:33:41 +0200 |
commit | 327e4219babeb69bab54f91a0d73c02a018a765d (patch) | |
tree | f538a68eb842a1df825c2241b0a85d360cd37880 | |
parent | 5ca5635cc4660bcdab6ee8084feda3506cfb566b (diff) | |
download | vim-327e4219babeb69bab54f91a0d73c02a018a765d.tar.gz |
Problem: New regexp engine: Can't handle \%[[ao]]. (Yukihiro Nakadaira)
Solution: Support nested atoms inside \%[].
-rw-r--r-- | src/regexp_nfa.c | 7 | ||||
-rw-r--r-- | src/testdir/test64.in | 1 | ||||
-rw-r--r-- | src/testdir/test64.ok | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 11 insertions, 2 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index fc87e39f..f11c01a9 100644 --- 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); diff --git a/src/testdir/test64.in b/src/testdir/test64.in index 0cabcdfc..061f1f1e 100644 --- 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']) diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok index fda58922..7021d18b 100644 --- a/src/testdir/test64.ok +++ b/src/testdir/test64.ok @@ -836,6 +836,9 @@ OK 2 - \%[bar]x OK 0 - \%[bar]x OK 1 - \%[bar]x OK 2 - \%[bar]x +OK 0 - b\%[[ao]r] +OK 1 - b\%[[ao]r] +OK 2 - b\%[[ao]r] OK 0 - goo\|go OK 1 - goo\|go OK 2 - goo\|go diff --git a/src/version.c b/src/version.c index e1c4ebcf..86f8a858 100644 --- a/src/version.c +++ b/src/version.c @@ -729,6 +729,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1217, +/**/ 1216, /**/ 1215, |