|
Karsten Hopp |
2108f3 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
2108f3 |
Subject: Patch 7.3.1118
|
|
Karsten Hopp |
2108f3 |
Fcc: outbox
|
|
Karsten Hopp |
2108f3 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
2108f3 |
Mime-Version: 1.0
|
|
Karsten Hopp |
2108f3 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
2108f3 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
2108f3 |
------------
|
|
Karsten Hopp |
2108f3 |
|
|
Karsten Hopp |
2108f3 |
Patch 7.3.1118
|
|
Karsten Hopp |
2108f3 |
Problem: Match failure rate is not very specific.
|
|
Karsten Hopp |
2108f3 |
Solution: Tune the failure rate for match items.
|
|
Karsten Hopp |
2108f3 |
Files: src/regexp_nfa.c
|
|
Karsten Hopp |
2108f3 |
|
|
Karsten Hopp |
2108f3 |
|
|
Karsten Hopp |
2108f3 |
*** ../vim-7.3.1117/src/regexp_nfa.c 2013-06-05 11:05:12.000000000 +0200
|
|
Karsten Hopp |
2108f3 |
--- src/regexp_nfa.c 2013-06-05 11:41:09.000000000 +0200
|
|
Karsten Hopp |
2108f3 |
***************
|
|
Karsten Hopp |
2108f3 |
*** 3956,3980 ****
|
|
Karsten Hopp |
2108f3 |
if (depth > 4)
|
|
Karsten Hopp |
2108f3 |
return 1;
|
|
Karsten Hopp |
2108f3 |
|
|
Karsten Hopp |
2108f3 |
! if (c == NFA_SPLIT)
|
|
Karsten Hopp |
2108f3 |
{
|
|
Karsten Hopp |
2108f3 |
! if (state->out->c == NFA_SPLIT || state->out1->c == NFA_SPLIT)
|
|
Karsten Hopp |
2108f3 |
return 1;
|
|
Karsten Hopp |
2108f3 |
! l = failure_chance(state->out, depth + 1);
|
|
Karsten Hopp |
2108f3 |
! r = failure_chance(state->out1, depth + 1);
|
|
Karsten Hopp |
2108f3 |
! return l < r ? l : r;
|
|
Karsten Hopp |
2108f3 |
! }
|
|
Karsten Hopp |
2108f3 |
! if (c == NFA_ANY)
|
|
Karsten Hopp |
2108f3 |
! return 1;
|
|
Karsten Hopp |
2108f3 |
! if (c > 0)
|
|
Karsten Hopp |
2108f3 |
! return 99;
|
|
Karsten Hopp |
2108f3 |
! if ((c >= NFA_MOPEN && c <= NFA_MOPEN9)
|
|
Karsten Hopp |
2108f3 |
#ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
2108f3 |
! || (c >= NFA_ZOPEN && c <= NFA_ZOPEN9)
|
|
Karsten Hopp |
2108f3 |
#endif
|
|
Karsten Hopp |
2108f3 |
! || c == NFA_NOPEN)
|
|
Karsten Hopp |
2108f3 |
! return failure_chance(state->out, depth + 1);
|
|
Karsten Hopp |
2108f3 |
! /* something else */
|
|
Karsten Hopp |
2108f3 |
return 50;
|
|
Karsten Hopp |
2108f3 |
}
|
|
Karsten Hopp |
2108f3 |
|
|
Karsten Hopp |
2108f3 |
--- 3956,4093 ----
|
|
Karsten Hopp |
2108f3 |
if (depth > 4)
|
|
Karsten Hopp |
2108f3 |
return 1;
|
|
Karsten Hopp |
2108f3 |
|
|
Karsten Hopp |
2108f3 |
! switch (c)
|
|
Karsten Hopp |
2108f3 |
{
|
|
Karsten Hopp |
2108f3 |
! case NFA_SPLIT:
|
|
Karsten Hopp |
2108f3 |
! if (state->out->c == NFA_SPLIT || state->out1->c == NFA_SPLIT)
|
|
Karsten Hopp |
2108f3 |
! /* avoid recursive stuff */
|
|
Karsten Hopp |
2108f3 |
! return 1;
|
|
Karsten Hopp |
2108f3 |
! /* two alternatives, use the lowest failure chance */
|
|
Karsten Hopp |
2108f3 |
! l = failure_chance(state->out, depth + 1);
|
|
Karsten Hopp |
2108f3 |
! r = failure_chance(state->out1, depth + 1);
|
|
Karsten Hopp |
2108f3 |
! return l < r ? l : r;
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! case NFA_ANY:
|
|
Karsten Hopp |
2108f3 |
! /* matches anything, unlikely to fail */
|
|
Karsten Hopp |
2108f3 |
return 1;
|
|
Karsten Hopp |
2108f3 |
! case NFA_MATCH:
|
|
Karsten Hopp |
2108f3 |
! /* empty match works always */
|
|
Karsten Hopp |
2108f3 |
! return 0;
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! case NFA_BOL:
|
|
Karsten Hopp |
2108f3 |
! case NFA_EOL:
|
|
Karsten Hopp |
2108f3 |
! case NFA_BOF:
|
|
Karsten Hopp |
2108f3 |
! case NFA_EOF:
|
|
Karsten Hopp |
2108f3 |
! case NFA_NEWL:
|
|
Karsten Hopp |
2108f3 |
! return 99;
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! case NFA_BOW:
|
|
Karsten Hopp |
2108f3 |
! case NFA_EOW:
|
|
Karsten Hopp |
2108f3 |
! return 90;
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN1:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN2:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN3:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN4:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN5:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN6:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN7:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN8:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MOPEN9:
|
|
Karsten Hopp |
2108f3 |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN1:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN2:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN3:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN4:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN5:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN6:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN7:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN8:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZOPEN9:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE1:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE2:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE3:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE4:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE5:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE6:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE7:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE8:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZCLOSE9:
|
|
Karsten Hopp |
2108f3 |
! #endif
|
|
Karsten Hopp |
2108f3 |
! case NFA_NOPEN:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE1:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE2:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE3:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE4:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE5:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE6:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE7:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE8:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MCLOSE9:
|
|
Karsten Hopp |
2108f3 |
! case NFA_NCLOSE:
|
|
Karsten Hopp |
2108f3 |
! return failure_chance(state->out, depth + 1);
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! case NFA_BACKREF1:
|
|
Karsten Hopp |
2108f3 |
! case NFA_BACKREF2:
|
|
Karsten Hopp |
2108f3 |
! case NFA_BACKREF3:
|
|
Karsten Hopp |
2108f3 |
! case NFA_BACKREF4:
|
|
Karsten Hopp |
2108f3 |
! case NFA_BACKREF5:
|
|
Karsten Hopp |
2108f3 |
! case NFA_BACKREF6:
|
|
Karsten Hopp |
2108f3 |
! case NFA_BACKREF7:
|
|
Karsten Hopp |
2108f3 |
! case NFA_BACKREF8:
|
|
Karsten Hopp |
2108f3 |
! case NFA_BACKREF9:
|
|
Karsten Hopp |
2108f3 |
#ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZREF1:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZREF2:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZREF3:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZREF4:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZREF5:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZREF6:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZREF7:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZREF8:
|
|
Karsten Hopp |
2108f3 |
! case NFA_ZREF9:
|
|
Karsten Hopp |
2108f3 |
#endif
|
|
Karsten Hopp |
2108f3 |
! /* backreferences don't match in many places */
|
|
Karsten Hopp |
2108f3 |
! return 94;
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! case NFA_LNUM_GT:
|
|
Karsten Hopp |
2108f3 |
! case NFA_LNUM_LT:
|
|
Karsten Hopp |
2108f3 |
! case NFA_COL_GT:
|
|
Karsten Hopp |
2108f3 |
! case NFA_COL_LT:
|
|
Karsten Hopp |
2108f3 |
! case NFA_VCOL_GT:
|
|
Karsten Hopp |
2108f3 |
! case NFA_VCOL_LT:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MARK_GT:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MARK_LT:
|
|
Karsten Hopp |
2108f3 |
! #ifdef FEAT_VISUAL
|
|
Karsten Hopp |
2108f3 |
! case NFA_VISUAL:
|
|
Karsten Hopp |
2108f3 |
! #endif
|
|
Karsten Hopp |
2108f3 |
! /* before/after positions don't match very often */
|
|
Karsten Hopp |
2108f3 |
! return 85;
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! case NFA_LNUM:
|
|
Karsten Hopp |
2108f3 |
! return 90;
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! case NFA_CURSOR:
|
|
Karsten Hopp |
2108f3 |
! case NFA_COL:
|
|
Karsten Hopp |
2108f3 |
! case NFA_VCOL:
|
|
Karsten Hopp |
2108f3 |
! case NFA_MARK:
|
|
Karsten Hopp |
2108f3 |
! /* specific positions rarely match */
|
|
Karsten Hopp |
2108f3 |
! return 98;
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! case NFA_COMPOSING:
|
|
Karsten Hopp |
2108f3 |
! return 95;
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! default:
|
|
Karsten Hopp |
2108f3 |
! if (c > 0)
|
|
Karsten Hopp |
2108f3 |
! /* character match fails often */
|
|
Karsten Hopp |
2108f3 |
! return 95;
|
|
Karsten Hopp |
2108f3 |
! }
|
|
Karsten Hopp |
2108f3 |
!
|
|
Karsten Hopp |
2108f3 |
! /* something else, includes character classes */
|
|
Karsten Hopp |
2108f3 |
return 50;
|
|
Karsten Hopp |
2108f3 |
}
|
|
Karsten Hopp |
2108f3 |
|
|
Karsten Hopp |
2108f3 |
*** ../vim-7.3.1117/src/version.c 2013-06-05 11:05:12.000000000 +0200
|
|
Karsten Hopp |
2108f3 |
--- src/version.c 2013-06-05 11:41:58.000000000 +0200
|
|
Karsten Hopp |
2108f3 |
***************
|
|
Karsten Hopp |
2108f3 |
*** 730,731 ****
|
|
Karsten Hopp |
2108f3 |
--- 730,733 ----
|
|
Karsten Hopp |
2108f3 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
2108f3 |
+ /**/
|
|
Karsten Hopp |
2108f3 |
+ 1118,
|
|
Karsten Hopp |
2108f3 |
/**/
|
|
Karsten Hopp |
2108f3 |
|
|
Karsten Hopp |
2108f3 |
--
|
|
Karsten Hopp |
2108f3 |
From "know your smileys":
|
|
Karsten Hopp |
2108f3 |
:~) A man with a tape recorder up his nose
|
|
Karsten Hopp |
2108f3 |
|
|
Karsten Hopp |
2108f3 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
2108f3 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
2108f3 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
2108f3 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|