|
Karsten Hopp |
f5d645 |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
f5d645 |
Subject: Patch 7.3.1150
|
|
Karsten Hopp |
f5d645 |
Fcc: outbox
|
|
Karsten Hopp |
f5d645 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
f5d645 |
Mime-Version: 1.0
|
|
Karsten Hopp |
f5d645 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
f5d645 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
f5d645 |
------------
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
Patch 7.3.1150
|
|
Karsten Hopp |
f5d645 |
Problem: New regexpengine: Slow when a look-behind match does not have a
|
|
Karsten Hopp |
f5d645 |
width specified.
|
|
Karsten Hopp |
f5d645 |
Solution: Try to compute the maximum width.
|
|
Karsten Hopp |
f5d645 |
Files: src/regexp_nfa.c
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
*** ../vim-7.3.1149/src/regexp_nfa.c 2013-06-08 18:19:39.000000000 +0200
|
|
Karsten Hopp |
f5d645 |
--- src/regexp_nfa.c 2013-06-08 22:29:25.000000000 +0200
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 38,56 ****
|
|
Karsten Hopp |
f5d645 |
NFA_START_COLL, /* [abc] start */
|
|
Karsten Hopp |
f5d645 |
NFA_END_COLL, /* [abc] end */
|
|
Karsten Hopp |
f5d645 |
NFA_START_NEG_COLL, /* [^abc] start */
|
|
Karsten Hopp |
f5d645 |
! NFA_END_NEG_COLL, /* [^abc] end (only used in postfix) */
|
|
Karsten Hopp |
f5d645 |
! NFA_RANGE, /* range of the two previous items (only
|
|
Karsten Hopp |
f5d645 |
! * used in postfix) */
|
|
Karsten Hopp |
f5d645 |
NFA_RANGE_MIN, /* low end of a range */
|
|
Karsten Hopp |
f5d645 |
NFA_RANGE_MAX, /* high end of a range */
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
! NFA_CONCAT, /* concatenate two previous items (only
|
|
Karsten Hopp |
f5d645 |
! * used in postfix) */
|
|
Karsten Hopp |
f5d645 |
! NFA_OR,
|
|
Karsten Hopp |
f5d645 |
! NFA_STAR, /* greedy * */
|
|
Karsten Hopp |
f5d645 |
! NFA_STAR_NONGREEDY, /* non-greedy * */
|
|
Karsten Hopp |
f5d645 |
! NFA_QUEST, /* greedy \? */
|
|
Karsten Hopp |
f5d645 |
! NFA_QUEST_NONGREEDY, /* non-greedy \? */
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
NFA_BOL, /* ^ Begin line */
|
|
Karsten Hopp |
f5d645 |
NFA_EOL, /* $ End line */
|
|
Karsten Hopp |
f5d645 |
--- 38,56 ----
|
|
Karsten Hopp |
f5d645 |
NFA_START_COLL, /* [abc] start */
|
|
Karsten Hopp |
f5d645 |
NFA_END_COLL, /* [abc] end */
|
|
Karsten Hopp |
f5d645 |
NFA_START_NEG_COLL, /* [^abc] start */
|
|
Karsten Hopp |
f5d645 |
! NFA_END_NEG_COLL, /* [^abc] end (postfix only) */
|
|
Karsten Hopp |
f5d645 |
! NFA_RANGE, /* range of the two previous items
|
|
Karsten Hopp |
f5d645 |
! * (postfix only) */
|
|
Karsten Hopp |
f5d645 |
NFA_RANGE_MIN, /* low end of a range */
|
|
Karsten Hopp |
f5d645 |
NFA_RANGE_MAX, /* high end of a range */
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
! NFA_CONCAT, /* concatenate two previous items (postfix
|
|
Karsten Hopp |
f5d645 |
! * only) */
|
|
Karsten Hopp |
f5d645 |
! NFA_OR, /* \| (postfix only) */
|
|
Karsten Hopp |
f5d645 |
! NFA_STAR, /* greedy * (posfix only) */
|
|
Karsten Hopp |
f5d645 |
! NFA_STAR_NONGREEDY, /* non-greedy * (postfix only) */
|
|
Karsten Hopp |
f5d645 |
! NFA_QUEST, /* greedy \? (postfix only) */
|
|
Karsten Hopp |
f5d645 |
! NFA_QUEST_NONGREEDY, /* non-greedy \? (postfix only) */
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
NFA_BOL, /* ^ Begin line */
|
|
Karsten Hopp |
f5d645 |
NFA_EOL, /* $ End line */
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 153,160 ****
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
/* NFA_FIRST_NL */
|
|
Karsten Hopp |
f5d645 |
NFA_ANY, /* Match any one character. */
|
|
Karsten Hopp |
f5d645 |
- NFA_ANYOF, /* Match any character in this string. */
|
|
Karsten Hopp |
f5d645 |
- NFA_ANYBUT, /* Match any character not in this string. */
|
|
Karsten Hopp |
f5d645 |
NFA_IDENT, /* Match identifier char */
|
|
Karsten Hopp |
f5d645 |
NFA_SIDENT, /* Match identifier char but no digit */
|
|
Karsten Hopp |
f5d645 |
NFA_KWORD, /* Match keyword char */
|
|
Karsten Hopp |
f5d645 |
--- 153,158 ----
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 496,503 ****
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
/*
|
|
Karsten Hopp |
f5d645 |
* Figure out if the NFA state list contains just literal text and nothing
|
|
Karsten Hopp |
f5d645 |
! * else. If so return a string with what must match after regstart.
|
|
Karsten Hopp |
f5d645 |
! * Otherwise return NULL.
|
|
Karsten Hopp |
f5d645 |
*/
|
|
Karsten Hopp |
f5d645 |
static char_u *
|
|
Karsten Hopp |
f5d645 |
nfa_get_match_text(start)
|
|
Karsten Hopp |
f5d645 |
--- 494,501 ----
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
/*
|
|
Karsten Hopp |
f5d645 |
* Figure out if the NFA state list contains just literal text and nothing
|
|
Karsten Hopp |
f5d645 |
! * else. If so return a string in allocated memory with what must match after
|
|
Karsten Hopp |
f5d645 |
! * regstart. Otherwise return NULL.
|
|
Karsten Hopp |
f5d645 |
*/
|
|
Karsten Hopp |
f5d645 |
static char_u *
|
|
Karsten Hopp |
f5d645 |
nfa_get_match_text(start)
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 2578,2583 ****
|
|
Karsten Hopp |
f5d645 |
--- 2576,2800 ----
|
|
Karsten Hopp |
f5d645 |
}
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
/*
|
|
Karsten Hopp |
f5d645 |
+ * Estimate the maximum byte length of anything matching "state".
|
|
Karsten Hopp |
f5d645 |
+ * When unknown or unlimited return -1.
|
|
Karsten Hopp |
f5d645 |
+ */
|
|
Karsten Hopp |
f5d645 |
+ static int
|
|
Karsten Hopp |
f5d645 |
+ nfa_max_width(startstate, depth)
|
|
Karsten Hopp |
f5d645 |
+ nfa_state_T *startstate;
|
|
Karsten Hopp |
f5d645 |
+ int depth;
|
|
Karsten Hopp |
f5d645 |
+ {
|
|
Karsten Hopp |
f5d645 |
+ int l, r;
|
|
Karsten Hopp |
f5d645 |
+ nfa_state_T *state = startstate;
|
|
Karsten Hopp |
f5d645 |
+ int len = 0;
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ /* detect looping in a NFA_SPLIT */
|
|
Karsten Hopp |
f5d645 |
+ if (depth > 4)
|
|
Karsten Hopp |
f5d645 |
+ return -1;
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ for (;;)
|
|
Karsten Hopp |
f5d645 |
+ {
|
|
Karsten Hopp |
f5d645 |
+ switch (state->c)
|
|
Karsten Hopp |
f5d645 |
+ {
|
|
Karsten Hopp |
f5d645 |
+ case NFA_END_INVISIBLE:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_END_INVISIBLE_NEG:
|
|
Karsten Hopp |
f5d645 |
+ /* the end, return what we have */
|
|
Karsten Hopp |
f5d645 |
+ return len;
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ case NFA_SPLIT:
|
|
Karsten Hopp |
f5d645 |
+ /* two alternatives, use the maximum */
|
|
Karsten Hopp |
f5d645 |
+ l = nfa_max_width(state->out, depth + 1);
|
|
Karsten Hopp |
f5d645 |
+ r = nfa_max_width(state->out1, depth + 1);
|
|
Karsten Hopp |
f5d645 |
+ if (l < 0 || r < 0)
|
|
Karsten Hopp |
f5d645 |
+ return -1;
|
|
Karsten Hopp |
f5d645 |
+ return len + (l > r ? l : r);
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ANY:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_START_COLL:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_START_NEG_COLL:
|
|
Karsten Hopp |
f5d645 |
+ /* matches some character, including composing chars */
|
|
Karsten Hopp |
f5d645 |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
f5d645 |
+ if (enc_utf8)
|
|
Karsten Hopp |
f5d645 |
+ len += MB_MAXBYTES;
|
|
Karsten Hopp |
f5d645 |
+ else if (has_mbyte)
|
|
Karsten Hopp |
f5d645 |
+ len += 2;
|
|
Karsten Hopp |
f5d645 |
+ else
|
|
Karsten Hopp |
f5d645 |
+ #endif
|
|
Karsten Hopp |
f5d645 |
+ ++len;
|
|
Karsten Hopp |
f5d645 |
+ if (state->c != NFA_ANY)
|
|
Karsten Hopp |
f5d645 |
+ {
|
|
Karsten Hopp |
f5d645 |
+ /* skip over the characters */
|
|
Karsten Hopp |
f5d645 |
+ state = state->out1->out;
|
|
Karsten Hopp |
f5d645 |
+ continue;
|
|
Karsten Hopp |
f5d645 |
+ }
|
|
Karsten Hopp |
f5d645 |
+ break;
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ case NFA_DIGIT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_WHITE:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_HEX:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_OCTAL:
|
|
Karsten Hopp |
f5d645 |
+ /* ascii */
|
|
Karsten Hopp |
f5d645 |
+ ++len;
|
|
Karsten Hopp |
f5d645 |
+ break;
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ case NFA_IDENT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_SIDENT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_KWORD:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_SKWORD:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_FNAME:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_SFNAME:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_PRINT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_SPRINT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NWHITE:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NDIGIT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NHEX:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NOCTAL:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_WORD:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NWORD:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_HEAD:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NHEAD:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ALPHA:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NALPHA:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_LOWER:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NLOWER:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_UPPER:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NUPPER:
|
|
Karsten Hopp |
f5d645 |
+ /* possibly non-ascii */
|
|
Karsten Hopp |
f5d645 |
+ #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
f5d645 |
+ if (has_mbyte)
|
|
Karsten Hopp |
f5d645 |
+ len += 3;
|
|
Karsten Hopp |
f5d645 |
+ else
|
|
Karsten Hopp |
f5d645 |
+ #endif
|
|
Karsten Hopp |
f5d645 |
+ ++len;
|
|
Karsten Hopp |
f5d645 |
+ break;
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ case NFA_START_INVISIBLE:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_START_INVISIBLE_NEG:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_START_INVISIBLE_BEFORE:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_START_INVISIBLE_BEFORE_NEG:
|
|
Karsten Hopp |
f5d645 |
+ /* zero-width, out1 points to the END state */
|
|
Karsten Hopp |
f5d645 |
+ state = state->out1->out;
|
|
Karsten Hopp |
f5d645 |
+ continue;
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BACKREF1:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BACKREF2:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BACKREF3:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BACKREF4:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BACKREF5:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BACKREF6:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BACKREF7:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BACKREF8:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BACKREF9:
|
|
Karsten Hopp |
f5d645 |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZREF1:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZREF2:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZREF3:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZREF4:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZREF5:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZREF6:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZREF7:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZREF8:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZREF9:
|
|
Karsten Hopp |
f5d645 |
+ #endif
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NEWL:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_SKIP:
|
|
Karsten Hopp |
f5d645 |
+ /* unknown width */
|
|
Karsten Hopp |
f5d645 |
+ return -1;
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BOL:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_EOL:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BOF:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_EOF:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_BOW:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_EOW:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN1:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN2:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN3:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN4:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN5:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN6:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN7:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN8:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MOPEN9:
|
|
Karsten Hopp |
f5d645 |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN1:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN2:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN3:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN4:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN5:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN6:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN7:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN8:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZOPEN9:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE1:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE2:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE3:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE4:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE5:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE6:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE7:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE8:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZCLOSE9:
|
|
Karsten Hopp |
f5d645 |
+ #endif
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE1:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE2:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE3:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE4:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE5:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE6:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE7:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE8:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MCLOSE9:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NOPEN:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_NCLOSE:
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ case NFA_LNUM_GT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_LNUM_LT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_COL_GT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_COL_LT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_VCOL_GT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_VCOL_LT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MARK_GT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MARK_LT:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_VISUAL:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_LNUM:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_CURSOR:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_COL:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_VCOL:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_MARK:
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZSTART:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_ZEND:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_OPT_CHARS:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_SKIP_CHAR:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_START_PATTERN:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_END_PATTERN:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_COMPOSING:
|
|
Karsten Hopp |
f5d645 |
+ case NFA_END_COMPOSING:
|
|
Karsten Hopp |
f5d645 |
+ /* zero-width */
|
|
Karsten Hopp |
f5d645 |
+ break;
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ default:
|
|
Karsten Hopp |
f5d645 |
+ if (state->c < 0)
|
|
Karsten Hopp |
f5d645 |
+ /* don't know what this is */
|
|
Karsten Hopp |
f5d645 |
+ return -1;
|
|
Karsten Hopp |
f5d645 |
+ /* normal character */
|
|
Karsten Hopp |
f5d645 |
+ len += MB_CHAR2LEN(state->c);
|
|
Karsten Hopp |
f5d645 |
+ break;
|
|
Karsten Hopp |
f5d645 |
+ }
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ /* normal way to continue */
|
|
Karsten Hopp |
f5d645 |
+ state = state->out;
|
|
Karsten Hopp |
f5d645 |
+ }
|
|
Karsten Hopp |
f5d645 |
+
|
|
Karsten Hopp |
f5d645 |
+ /* unrecognized */
|
|
Karsten Hopp |
f5d645 |
+ return -1;
|
|
Karsten Hopp |
f5d645 |
+ }
|
|
Karsten Hopp |
f5d645 |
+ /*
|
|
Karsten Hopp |
f5d645 |
* Convert a postfix form into its equivalent NFA.
|
|
Karsten Hopp |
f5d645 |
* Return the NFA start state on success, NULL otherwise.
|
|
Karsten Hopp |
f5d645 |
*/
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 2856,2863 ****
|
|
Karsten Hopp |
f5d645 |
s = alloc_state(start_state, e.start, s1);
|
|
Karsten Hopp |
f5d645 |
if (s == NULL)
|
|
Karsten Hopp |
f5d645 |
goto theend;
|
|
Karsten Hopp |
f5d645 |
- if (before)
|
|
Karsten Hopp |
f5d645 |
- s->val = n; /* store the count */
|
|
Karsten Hopp |
f5d645 |
if (pattern)
|
|
Karsten Hopp |
f5d645 |
{
|
|
Karsten Hopp |
f5d645 |
/* NFA_ZEND -> NFA_END_PATTERN -> NFA_SKIP -> what follows. */
|
|
Karsten Hopp |
f5d645 |
--- 3073,3078 ----
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 2871,2876 ****
|
|
Karsten Hopp |
f5d645 |
--- 3086,3099 ----
|
|
Karsten Hopp |
f5d645 |
{
|
|
Karsten Hopp |
f5d645 |
patch(e.out, s1);
|
|
Karsten Hopp |
f5d645 |
PUSH(frag(s, list1(&s1->out)));
|
|
Karsten Hopp |
f5d645 |
+ if (before)
|
|
Karsten Hopp |
f5d645 |
+ {
|
|
Karsten Hopp |
f5d645 |
+ if (n <= 0)
|
|
Karsten Hopp |
f5d645 |
+ /* See if we can guess the maximum width, it avoids a
|
|
Karsten Hopp |
f5d645 |
+ * lot of pointless tries. */
|
|
Karsten Hopp |
f5d645 |
+ n = nfa_max_width(e.start, 0);
|
|
Karsten Hopp |
f5d645 |
+ s->val = n; /* store the count */
|
|
Karsten Hopp |
f5d645 |
+ }
|
|
Karsten Hopp |
f5d645 |
}
|
|
Karsten Hopp |
f5d645 |
break;
|
|
Karsten Hopp |
f5d645 |
}
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 4088,4096 ****
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
/* Go back the specified number of bytes, or as far as the
|
|
Karsten Hopp |
f5d645 |
* start of the previous line, to try matching "\@<=" or
|
|
Karsten Hopp |
f5d645 |
! * not matching "\@
|
|
Karsten Hopp |
f5d645 |
! * TODO: This is very inefficient! Would be better to
|
|
Karsten Hopp |
f5d645 |
! * first check for a match with what follows. */
|
|
Karsten Hopp |
f5d645 |
if (state->val <= 0)
|
|
Karsten Hopp |
f5d645 |
{
|
|
Karsten Hopp |
f5d645 |
if (REG_MULTI)
|
|
Karsten Hopp |
f5d645 |
--- 4311,4318 ----
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
/* Go back the specified number of bytes, or as far as the
|
|
Karsten Hopp |
f5d645 |
* start of the previous line, to try matching "\@<=" or
|
|
Karsten Hopp |
f5d645 |
! * not matching "\@
|
|
Karsten Hopp |
f5d645 |
! * bytes if possible. */
|
|
Karsten Hopp |
f5d645 |
if (state->val <= 0)
|
|
Karsten Hopp |
f5d645 |
{
|
|
Karsten Hopp |
f5d645 |
if (REG_MULTI)
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 4386,4392 ****
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
/*
|
|
Karsten Hopp |
f5d645 |
* Check for a match with match_text.
|
|
Karsten Hopp |
f5d645 |
! * Called after skip_to_start() has find regstart.
|
|
Karsten Hopp |
f5d645 |
* Returns zero for no match, 1 for a match.
|
|
Karsten Hopp |
f5d645 |
*/
|
|
Karsten Hopp |
f5d645 |
static long
|
|
Karsten Hopp |
f5d645 |
--- 4608,4614 ----
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
/*
|
|
Karsten Hopp |
f5d645 |
* Check for a match with match_text.
|
|
Karsten Hopp |
f5d645 |
! * Called after skip_to_start() has found regstart.
|
|
Karsten Hopp |
f5d645 |
* Returns zero for no match, 1 for a match.
|
|
Karsten Hopp |
f5d645 |
*/
|
|
Karsten Hopp |
f5d645 |
static long
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 4736,4742 ****
|
|
Karsten Hopp |
f5d645 |
#ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
f5d645 |
|| (cout >= NFA_ZCLOSE && cout <= NFA_ZCLOSE9)
|
|
Karsten Hopp |
f5d645 |
#endif
|
|
Karsten Hopp |
f5d645 |
- || cout == NFA_NCLOSE
|
|
Karsten Hopp |
f5d645 |
|| t->pim != NULL
|
|
Karsten Hopp |
f5d645 |
|| (t->state->c != NFA_START_INVISIBLE_BEFORE
|
|
Karsten Hopp |
f5d645 |
&& t->state->c != NFA_START_INVISIBLE_BEFORE_NEG
|
|
Karsten Hopp |
f5d645 |
--- 4958,4963 ----
|
|
Karsten Hopp |
f5d645 |
*** ../vim-7.3.1149/src/version.c 2013-06-08 18:19:40.000000000 +0200
|
|
Karsten Hopp |
f5d645 |
--- src/version.c 2013-06-08 22:15:27.000000000 +0200
|
|
Karsten Hopp |
f5d645 |
***************
|
|
Karsten Hopp |
f5d645 |
*** 730,731 ****
|
|
Karsten Hopp |
f5d645 |
--- 730,733 ----
|
|
Karsten Hopp |
f5d645 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
f5d645 |
+ /**/
|
|
Karsten Hopp |
f5d645 |
+ 1150,
|
|
Karsten Hopp |
f5d645 |
/**/
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
--
|
|
Karsten Hopp |
f5d645 |
Amnesia is one of my favorite words, but I forgot what it means.
|
|
Karsten Hopp |
f5d645 |
|
|
Karsten Hopp |
f5d645 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
f5d645 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
f5d645 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
f5d645 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|