0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.0645: no error for illegal back reference in NFA engine

Problem:    The new regexp engine does not give an error for using a back
            reference where it is not allowed. (Dominique Pelle)
Solution:   Check the back reference like the old engine. (closes #1774)
This commit is contained in:
Bram Moolenaar
2017-06-17 20:08:20 +02:00
parent 5b1affefd0
commit 1ef9bbe215
6 changed files with 53 additions and 23 deletions

View File

@@ -62,3 +62,13 @@ func Test_eow_with_optional()
call assert_equal(expected, actual)
endfor
endfunc
func Test_backref()
new
call setline(1, ['one', 'two', 'three', 'four', 'five'])
call assert_equal(3, search('\%#=1\(e\)\1'))
call assert_equal(3, search('\%#=2\(e\)\1'))
call assert_fails('call search("\\%#=1\\(e\\1\\)")', 'E65:')
call assert_fails('call search("\\%#=2\\(e\\1\\)")', 'E65:')
bwipe!
endfunc