diff options
author | Bram Moolenaar <bram@vim.org> | 2013-06-16 15:43:50 +0200 |
---|---|---|
committer | Bram Moolenaar <bram@vim.org> | 2013-06-16 15:43:50 +0200 |
commit | 2c06a58fc77751602cce59c4b39577e08f0794af (patch) | |
tree | dc59ad3621bd2122e4f8ca10191ee435947b1ad9 | |
parent | c1efeea10c370fba32567a1a5e32373846559353 (diff) | |
download | vim-2c06a58fc77751602cce59c4b39577e08f0794af.tar.gz |
Problem: New regexp engine: no match found on "#if FOO". (Lech Lorens)
Solution: When adding a state gets skipped don't adjust the index.
-rw-r--r-- | src/regexp_nfa.c | 2 | ||||
-rw-r--r-- | src/testdir/test64.in | 2 | ||||
-rw-r--r-- | src/testdir/test64.ok | 3 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 9 insertions, 0 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 5414465b..47d7030e 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -4210,6 +4210,8 @@ addstate_here(l, state, subs, pim, ip) /* re-order to put the new state at the current position */ count = l->n - tlen; + if (count == 0) + return; /* no state got added */ if (count == 1) { /* overwrite the current state */ diff --git a/src/testdir/test64.in b/src/testdir/test64.in index ad11c3c4..0cabcdfc 100644 --- a/src/testdir/test64.in +++ b/src/testdir/test64.in @@ -408,6 +408,8 @@ STARTTEST :"""" Requiring lots of states. :call add(tl, [2, '[0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12}', " 12345678-1234-1234-1234-123456789012 ", "12345678-1234-1234-1234-123456789012", "1234-"]) :" +:"""" Skip adding state twice +:call add(tl, [2, '^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=', "#if FOO", "#if", ' FOO']) :" :"""" Run the tests :" diff --git a/src/testdir/test64.ok b/src/testdir/test64.ok index 48694fb5..fda58922 100644 --- a/src/testdir/test64.ok +++ b/src/testdir/test64.ok @@ -913,6 +913,9 @@ OK 2 - \_[^a]\+ OK 0 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12} OK 1 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12} OK 2 - [0-9a-zA-Z]\{8}-\([0-9a-zA-Z]\{4}-\)\{3}[0-9a-zA-Z]\{12} +OK 0 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@= +OK 1 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@= +OK 2 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@= multi-line tests OK 0 - ^.\(.\).\_..\1. OK 1 - ^.\(.\).\_..\1. diff --git a/src/version.c b/src/version.c index 85147e81..3374e16f 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 */ /**/ + 1207, +/**/ 1206, /**/ 1205, |