comparison src/testdir/test64.in @ 5895:b871734bf54e v7.4.290

updated for version 7.4.290 Problem: A non-greedy match followed by a branch is too greedy. (Ingo Karkat) Solution: Add NFA_MATCH when it is already in the state list if the position differs.
author Bram Moolenaar <bram@vim.org>
date Tue, 13 May 2014 16:44:29 +0200
parents 99374096a76b
children 3ee39fe2df7d
comparison
equal deleted inserted replaced
5894:ff44a3a57ba0 5895:b871734bf54e
236 :call add(tl, [2, 'a\{2,7}','aaaaaaaaaaaaaaaaaaaa', 'aaaaaaa']) 236 :call add(tl, [2, 'a\{2,7}','aaaaaaaaaaaaaaaaaaaa', 'aaaaaaa'])
237 :call add(tl, [2, 'a\{2,7}x','aaaaaaaaax', 'aaaaaaax']) 237 :call add(tl, [2, 'a\{2,7}x','aaaaaaaaax', 'aaaaaaax'])
238 :call add(tl, [2, '\vx(.{-,8})yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz','ayxa','xayzxayz']) 238 :call add(tl, [2, '\vx(.{-,8})yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz','ayxa','xayzxayz'])
239 :call add(tl, [2, '\vx(.*)yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz', 'ayxayzxayzxa','']) 239 :call add(tl, [2, '\vx(.*)yz(.*)','xayxayzxayzxayz','xayxayzxayzxayz', 'ayxayzxayzxa',''])
240 :call add(tl, [2, '\v(a{1,2}){-2,3}','aaaaaaa','aaaa','aa']) 240 :call add(tl, [2, '\v(a{1,2}){-2,3}','aaaaaaa','aaaa','aa'])
241 :call add(tl, [2, '\v(a{-1,3})+','aa','aa','a']) 241 :call add(tl, [2, '\v(a{-1,3})+', 'aa', 'aa', 'a'])
242 :call add(tl, [2, '^\s\{-}\zs\( x\|x$\)', ' x', ' x', ' x'])
243 :call add(tl, [2, '^\s\{-}\zs\(x\| x$\)', ' x', ' x', ' x'])
244 :call add(tl, [2, '^\s\{-}\ze\(x\| x$\)', ' x', '', ' x'])
245 :call add(tl, [2, '^\(\s\{-}\)\(x\| x$\)', ' x', ' x', '', ' x'])
242 :" 246 :"
243 :" Test Character classes 247 :" Test Character classes
244 :call add(tl, [2, '\d\+e\d\d','test 10e23 fd','10e23']) 248 :call add(tl, [2, '\d\+e\d\d','test 10e23 fd','10e23'])
245 :" 249 :"
246 :" Test collections and character range [] 250 :" Test collections and character range []
460 : endif 464 : endif
461 : let &regexpengine = engine 465 : let &regexpengine = engine
462 : try 466 : try
463 : let l = matchlist(text, pat) 467 : let l = matchlist(text, pat)
464 : catch 468 : catch
465 : $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"' 469 : $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", caused an exception: \"' . v:exception . '\"'
466 : endtry 470 : endtry
467 :" check the match itself 471 :" check the match itself
468 : if len(l) == 0 && len(t) > matchidx 472 : if len(l) == 0 && len(t) > matchidx
469 : $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"' 473 : $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", did not match, expected: \"' . t[matchidx] . '\"'
470 : elseif len(l) > 0 && len(t) == matchidx 474 : elseif len(l) > 0 && len(t) == matchidx
471 : $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected no match' 475 : $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected no match'
472 : elseif len(t) > matchidx && l[0] != t[matchidx] 476 : elseif len(t) > matchidx && l[0] != t[matchidx]
473 : $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected: \"' . t[matchidx] . '\"' 477 : $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", match: \"' . l[0] . '\", expected: \"' . t[matchidx] . '\"'
474 : else 478 : else
475 : $put ='OK ' . engine . ' - ' . pat 479 : $put ='OK ' . engine . ' - ' . pat
476 : endif 480 : endif
477 : if len(l) > 0 481 : if len(l) > 0
478 :" check all the nine submatches 482 :" check all the nine submatches
481 : let e = '' 485 : let e = ''
482 : else 486 : else
483 : let e = t[matchidx + i] 487 : let e = t[matchidx + i]
484 : endif 488 : endif
485 : if l[i] != e 489 : if l[i] != e
486 : $put ='ERROR: pat: \"' . pat . '\", text: \"' . text . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"' 490 : $put ='ERROR ' . engine . ': pat: \"' . pat . '\", text: \"' . text . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"'
487 : endif 491 : endif
488 : endfor 492 : endfor
489 : unlet i 493 : unlet i
490 : endif 494 : endif
491 : endfor 495 : endfor