diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-05-30 11:51:08 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-05-30 11:51:08 +0200 |
commit | bad704fa0478c914e1089531bc61ac78009afaec (patch) | |
tree | d09d6f17df0ee4199d193f0eb48e2e51be782bb4 | |
parent | 7e28384a9a009852414a5fe3a44bcdcbd82a52d8 (diff) | |
download | vim-git-bad704fa0478c914e1089531bc61ac78009afaec.tar.gz |
updated for version 7.3.1055v7.3.1055
Problem: Negated collection does not match newline.
Solution: Handle newline differently. (Hiroshi Shirosaki)
-rw-r--r-- | src/regexp_nfa.c | 15 | ||||
-rw-r--r-- | src/testdir/test64.in | 6 | ||||
-rw-r--r-- | src/testdir/test64.ok | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 21 insertions, 8 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index bb8c982fe..aa6c56e6a 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -1203,13 +1203,6 @@ collection: } mb_ptr_adv(regparse); - if (extra == ADD_NL) /* \_[] also matches \n */ - { - EMIT(reg_string ? NL : NFA_NEWL); - TRY_NEG(); - EMIT_GLUE(); - } - /* skip the trailing ] */ regparse = endp; mb_ptr_adv(regparse); @@ -1219,6 +1212,14 @@ collection: EMIT(NFA_END_NEG_RANGE); EMIT(NFA_CONCAT); } + + /* \_[] also matches \n but it's not negated */ + if (extra == ADD_NL) + { + EMIT(reg_string ? NL : NFA_NEWL); + EMIT(NFA_OR); + } + return OK; } /* if exists closing ] */ diff --git a/src/testdir/test64.in b/src/testdir/test64.in index 192d45672..0c5517316 100644 --- a/src/testdir/test64.in +++ b/src/testdir/test64.in @@ -344,8 +344,12 @@ STARTTEST :call add(tl, [0, '\(<<\)\@1<=span.', 'xxspanxxxx<spanxx<<spanyyy']) :call add(tl, [0, '\(<<\)\@2<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<']) :" -:"""" Run the tests +:"""" "\_" prepended negated collection matches EOL +:call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"]) +:call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"]) +:" :" +:"""" Run the tests :" :for t in tl : let re = t[0] diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok index 74db0bd09..7b8185306 100644 --- a/src/testdir/test64.ok +++ b/src/testdir/test64.ok @@ -731,6 +731,12 @@ OK 0 - \(<<\)\@1<=span. OK 1 - \(<<\)\@1<=span. OK 0 - \(<<\)\@2<=span. OK 1 - \(<<\)\@2<=span. +OK 0 - \_[^8-9]\+ +OK 1 - \_[^8-9]\+ +OK 2 - \_[^8-9]\+ +OK 0 - \_[^a]\+ +OK 1 - \_[^a]\+ +OK 2 - \_[^a]\+ 192.168.0.1 192.168.0.1 192.168.0.1 diff --git a/src/version.c b/src/version.c index 795e175bc..651c64c58 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 */ /**/ + 1055, +/**/ 1054, /**/ 1053, |