0
0
mirror of https://github.com/vim/vim.git synced 2025-11-14 23:04:02 -05:00

updated for version 7.3.1073

Problem:    New regexp engine may run out of states.
Solution:   Allocate states dynamically.  Also make the test report errors.
This commit is contained in:
Bram Moolenaar
2013-05-30 18:45:23 +02:00
parent 4b6ebe6dce
commit 16299b57cb
5 changed files with 57 additions and 16 deletions

View File

@@ -348,6 +348,9 @@ STARTTEST
:call add(tl, [2, '\_[^8-9]\+', "asfi\n9888", "asfi\n"])
:call add(tl, [2, '\_[^a]\+', "asfi\n9888", "sfi\n9888"])
:"
:"""" Requiring lots of states.
:call add(tl, [0, '[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-"])
:"
:"
:"""" Run the tests
:"
@@ -361,7 +364,11 @@ STARTTEST
: continue
: endif
: let &regexpengine = engine
: let l = matchlist(text, pat)
: try
: let l = matchlist(text, pat)
: catch
: $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"'
: endtry
:" check the match itself
: if len(l) == 0 && len(t) > matchidx
: $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"'

View File

@@ -740,6 +740,8 @@ OK 2 - \_[^8-9]\+
OK 0 - \_[^a]\+
OK 1 - \_[^a]\+
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}
192.168.0.1
192.168.0.1
192.168.0.1

View File

@@ -85,7 +85,11 @@ STARTTEST
: continue
: endif
: let &regexpengine = engine
: let l = matchlist(text, pat)
: try
: let l = matchlist(text, pat)
: catch
: $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"'
: endtry
:" check the match itself
: if len(l) == 0 && len(t) > matchidx
: $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"'