|
Karsten Hopp |
3d1a0d |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
3d1a0d |
Subject: Patch 7.3.10
|
|
Karsten Hopp |
3d1a0d |
Fcc: outbox
|
|
Karsten Hopp |
3d1a0d |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
3d1a0d |
Mime-Version: 1.0
|
|
Karsten Hopp |
3d1a0d |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
3d1a0d |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
3d1a0d |
------------
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
Patch 7.3.1090
|
|
Karsten Hopp |
3d1a0d |
Problem: New regexp engine does not support \z1 .. \z9 and \z(.
|
|
Karsten Hopp |
3d1a0d |
Solution: Implement the syntax submatches.
|
|
Karsten Hopp |
3d1a0d |
Files: src/regexp.h, src/regexp_nfa.c
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
*** ../vim-7.3.1089/src/regexp.h 2013-05-30 17:05:34.000000000 +0200
|
|
Karsten Hopp |
3d1a0d |
--- src/regexp.h 2013-06-01 22:18:07.000000000 +0200
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 55,61 ****
|
|
Karsten Hopp |
3d1a0d |
--- 55,63 ----
|
|
Karsten Hopp |
3d1a0d |
char_u reganch;
|
|
Karsten Hopp |
3d1a0d |
char_u *regmust;
|
|
Karsten Hopp |
3d1a0d |
int regmlen;
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
char_u reghasz;
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
char_u program[1]; /* actually longer.. */
|
|
Karsten Hopp |
3d1a0d |
} bt_regprog_T;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 88,93 ****
|
|
Karsten Hopp |
3d1a0d |
--- 90,98 ----
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T *start;
|
|
Karsten Hopp |
3d1a0d |
int has_zend; /* pattern contains \ze */
|
|
Karsten Hopp |
3d1a0d |
int has_backref; /* pattern contains \1 .. \9 */
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ int reghasz;
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
int nsubexp; /* number of () */
|
|
Karsten Hopp |
3d1a0d |
int nstate;
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T state[0]; /* actually longer.. */
|
|
Karsten Hopp |
3d1a0d |
*** ../vim-7.3.1089/src/regexp_nfa.c 2013-06-01 19:54:39.000000000 +0200
|
|
Karsten Hopp |
3d1a0d |
--- src/regexp_nfa.c 2013-06-01 22:54:08.000000000 +0200
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 78,90 ****
|
|
Karsten Hopp |
3d1a0d |
NFA_BACKREF7, /* \7 */
|
|
Karsten Hopp |
3d1a0d |
NFA_BACKREF8, /* \8 */
|
|
Karsten Hopp |
3d1a0d |
NFA_BACKREF9, /* \9 */
|
|
Karsten Hopp |
3d1a0d |
NFA_SKIP, /* Skip characters */
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
NFA_MOPEN,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE = NFA_MOPEN + NSUBEXP,
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* NFA_FIRST_NL */
|
|
Karsten Hopp |
3d1a0d |
! NFA_ANY = NFA_MCLOSE + NSUBEXP, /* Match any one character. */
|
|
Karsten Hopp |
3d1a0d |
NFA_ANYOF, /* Match any character in this string. */
|
|
Karsten Hopp |
3d1a0d |
NFA_ANYBUT, /* Match any character not in this string. */
|
|
Karsten Hopp |
3d1a0d |
NFA_IDENT, /* Match identifier char */
|
|
Karsten Hopp |
3d1a0d |
--- 78,144 ----
|
|
Karsten Hopp |
3d1a0d |
NFA_BACKREF7, /* \7 */
|
|
Karsten Hopp |
3d1a0d |
NFA_BACKREF8, /* \8 */
|
|
Karsten Hopp |
3d1a0d |
NFA_BACKREF9, /* \9 */
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ NFA_ZREF1, /* \z1 */
|
|
Karsten Hopp |
3d1a0d |
+ NFA_ZREF2, /* \z2 */
|
|
Karsten Hopp |
3d1a0d |
+ NFA_ZREF3, /* \z3 */
|
|
Karsten Hopp |
3d1a0d |
+ NFA_ZREF4, /* \z4 */
|
|
Karsten Hopp |
3d1a0d |
+ NFA_ZREF5, /* \z5 */
|
|
Karsten Hopp |
3d1a0d |
+ NFA_ZREF6, /* \z6 */
|
|
Karsten Hopp |
3d1a0d |
+ NFA_ZREF7, /* \z7 */
|
|
Karsten Hopp |
3d1a0d |
+ NFA_ZREF8, /* \z8 */
|
|
Karsten Hopp |
3d1a0d |
+ NFA_ZREF9, /* \z9 */
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
NFA_SKIP, /* Skip characters */
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
NFA_MOPEN,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MOPEN1,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MOPEN2,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MOPEN3,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MOPEN4,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MOPEN5,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MOPEN6,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MOPEN7,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MOPEN8,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MOPEN9,
|
|
Karsten Hopp |
3d1a0d |
!
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE1,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE2,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE3,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE4,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE5,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE6,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE7,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE8,
|
|
Karsten Hopp |
3d1a0d |
! NFA_MCLOSE9,
|
|
Karsten Hopp |
3d1a0d |
!
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN1,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN2,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN3,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN4,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN5,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN6,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN7,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN8,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZOPEN9,
|
|
Karsten Hopp |
3d1a0d |
!
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE1,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE2,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE3,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE4,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE5,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE6,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE7,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE8,
|
|
Karsten Hopp |
3d1a0d |
! NFA_ZCLOSE9,
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* NFA_FIRST_NL */
|
|
Karsten Hopp |
3d1a0d |
! NFA_ANY, /* Match any one character. */
|
|
Karsten Hopp |
3d1a0d |
NFA_ANYOF, /* Match any character in this string. */
|
|
Karsten Hopp |
3d1a0d |
NFA_ANYBUT, /* Match any character not in this string. */
|
|
Karsten Hopp |
3d1a0d |
NFA_IDENT, /* Match identifier char */
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 221,227 ****
|
|
Karsten Hopp |
3d1a0d |
static void nfa_save_listids __ARGS((nfa_state_T *start, int *list));
|
|
Karsten Hopp |
3d1a0d |
static void nfa_restore_listids __ARGS((nfa_state_T *start, int *list));
|
|
Karsten Hopp |
3d1a0d |
static int nfa_re_num_cmp __ARGS((long_u val, int op, long_u pos));
|
|
Karsten Hopp |
3d1a0d |
! static long nfa_regtry __ARGS((nfa_state_T *start, colnr_T col));
|
|
Karsten Hopp |
3d1a0d |
static long nfa_regexec_both __ARGS((char_u *line, colnr_T col));
|
|
Karsten Hopp |
3d1a0d |
static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags));
|
|
Karsten Hopp |
3d1a0d |
static int nfa_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
|
|
Karsten Hopp |
3d1a0d |
--- 275,281 ----
|
|
Karsten Hopp |
3d1a0d |
static void nfa_save_listids __ARGS((nfa_state_T *start, int *list));
|
|
Karsten Hopp |
3d1a0d |
static void nfa_restore_listids __ARGS((nfa_state_T *start, int *list));
|
|
Karsten Hopp |
3d1a0d |
static int nfa_re_num_cmp __ARGS((long_u val, int op, long_u pos));
|
|
Karsten Hopp |
3d1a0d |
! static long nfa_regtry __ARGS((nfa_regprog_T *prog, colnr_T col));
|
|
Karsten Hopp |
3d1a0d |
static long nfa_regexec_both __ARGS((char_u *line, colnr_T col));
|
|
Karsten Hopp |
3d1a0d |
static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags));
|
|
Karsten Hopp |
3d1a0d |
static int nfa_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 267,272 ****
|
|
Karsten Hopp |
3d1a0d |
--- 321,327 ----
|
|
Karsten Hopp |
3d1a0d |
nfa_has_zend = FALSE;
|
|
Karsten Hopp |
3d1a0d |
nfa_has_backref = FALSE;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
+ /* shared with BT engine */
|
|
Karsten Hopp |
3d1a0d |
regcomp_start(expr, re_flags);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
return OK;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 799,804 ****
|
|
Karsten Hopp |
3d1a0d |
--- 854,860 ----
|
|
Karsten Hopp |
3d1a0d |
EMIT(NFA_ZEND);
|
|
Karsten Hopp |
3d1a0d |
nfa_has_zend = TRUE;
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
case '1':
|
|
Karsten Hopp |
3d1a0d |
case '2':
|
|
Karsten Hopp |
3d1a0d |
case '3':
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 808,816 ****
|
|
Karsten Hopp |
3d1a0d |
case '7':
|
|
Karsten Hopp |
3d1a0d |
case '8':
|
|
Karsten Hopp |
3d1a0d |
case '9':
|
|
Karsten Hopp |
3d1a0d |
case '(':
|
|
Karsten Hopp |
3d1a0d |
! /* TODO: \z1...\z9 and \z( not yet supported */
|
|
Karsten Hopp |
3d1a0d |
! return FAIL;
|
|
Karsten Hopp |
3d1a0d |
default:
|
|
Karsten Hopp |
3d1a0d |
syntax_error = TRUE;
|
|
Karsten Hopp |
3d1a0d |
EMSGN(_("E867: (NFA) Unknown operator '\\z%c'"),
|
|
Karsten Hopp |
3d1a0d |
--- 864,882 ----
|
|
Karsten Hopp |
3d1a0d |
case '7':
|
|
Karsten Hopp |
3d1a0d |
case '8':
|
|
Karsten Hopp |
3d1a0d |
case '9':
|
|
Karsten Hopp |
3d1a0d |
+ /* \z1...\z9 */
|
|
Karsten Hopp |
3d1a0d |
+ EMIT(NFA_ZREF1 + (no_Magic(c) - '1'));
|
|
Karsten Hopp |
3d1a0d |
+ /* No need to set nfa_has_backref, the sub-matches don't
|
|
Karsten Hopp |
3d1a0d |
+ * change when \z1 .. \z9 maches or not. */
|
|
Karsten Hopp |
3d1a0d |
+ re_has_z = REX_USE;
|
|
Karsten Hopp |
3d1a0d |
+ break;
|
|
Karsten Hopp |
3d1a0d |
case '(':
|
|
Karsten Hopp |
3d1a0d |
! /* \z( */
|
|
Karsten Hopp |
3d1a0d |
! if (nfa_reg(REG_ZPAREN) == FAIL)
|
|
Karsten Hopp |
3d1a0d |
! return FAIL; /* cascaded error */
|
|
Karsten Hopp |
3d1a0d |
! re_has_z = REX_SET;
|
|
Karsten Hopp |
3d1a0d |
! break;
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
default:
|
|
Karsten Hopp |
3d1a0d |
syntax_error = TRUE;
|
|
Karsten Hopp |
3d1a0d |
EMSGN(_("E867: (NFA) Unknown operator '\\z%c'"),
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 1651,1658 ****
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int parno = 0;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
- #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
- #endif
|
|
Karsten Hopp |
3d1a0d |
if (paren == REG_PAREN)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
if (regnpar >= NSUBEXP) /* Too many `(' */
|
|
Karsten Hopp |
3d1a0d |
--- 1717,1722 ----
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 1662,1667 ****
|
|
Karsten Hopp |
3d1a0d |
--- 1726,1743 ----
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
parno = regnpar++;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ else if (paren == REG_ZPAREN)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ /* Make a ZOPEN node. */
|
|
Karsten Hopp |
3d1a0d |
+ if (regnzpar >= NSUBEXP)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ syntax_error = TRUE;
|
|
Karsten Hopp |
3d1a0d |
+ EMSG_RET_FAIL(_("E879: (NFA regexp) Too many \\z("));
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ parno = regnzpar++;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
if (nfa_regbranch() == FAIL)
|
|
Karsten Hopp |
3d1a0d |
return FAIL; /* cascaded error */
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 1700,1705 ****
|
|
Karsten Hopp |
3d1a0d |
--- 1776,1785 ----
|
|
Karsten Hopp |
3d1a0d |
had_endbrace[parno] = TRUE; /* have seen the close paren */
|
|
Karsten Hopp |
3d1a0d |
EMIT(NFA_MOPEN + parno);
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ else if (paren == REG_ZPAREN)
|
|
Karsten Hopp |
3d1a0d |
+ EMIT(NFA_ZOPEN + parno);
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
return OK;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 1738,1743 ****
|
|
Karsten Hopp |
3d1a0d |
--- 1818,1834 ----
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF7: STRCPY(code, "NFA_BACKREF7"); break;
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF8: STRCPY(code, "NFA_BACKREF8"); break;
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF9: STRCPY(code, "NFA_BACKREF9"); break;
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF1: STRCPY(code, "NFA_ZREF1"); break;
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF2: STRCPY(code, "NFA_ZREF2"); break;
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF3: STRCPY(code, "NFA_ZREF3"); break;
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF4: STRCPY(code, "NFA_ZREF4"); break;
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF5: STRCPY(code, "NFA_ZREF5"); break;
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF6: STRCPY(code, "NFA_ZREF6"); break;
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF7: STRCPY(code, "NFA_ZREF7"); break;
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF8: STRCPY(code, "NFA_ZREF8"); break;
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF9: STRCPY(code, "NFA_ZREF9"); break;
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
case NFA_SKIP: STRCPY(code, "NFA_SKIP"); break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_PREV_ATOM_NO_WIDTH:
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 1758,1789 ****
|
|
Karsten Hopp |
3d1a0d |
case NFA_COMPOSING: STRCPY(code, "NFA_COMPOSING"); break;
|
|
Karsten Hopp |
3d1a0d |
case NFA_END_COMPOSING: STRCPY(code, "NFA_END_COMPOSING"); break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 0:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 9:
|
|
Karsten Hopp |
3d1a0d |
STRCPY(code, "NFA_MOPEN(x)");
|
|
Karsten Hopp |
3d1a0d |
code[10] = c - NFA_MOPEN + '0';
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 0:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 9:
|
|
Karsten Hopp |
3d1a0d |
STRCPY(code, "NFA_MCLOSE(x)");
|
|
Karsten Hopp |
3d1a0d |
code[11] = c - NFA_MCLOSE + '0';
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
case NFA_EOL: STRCPY(code, "NFA_EOL "); break;
|
|
Karsten Hopp |
3d1a0d |
case NFA_BOL: STRCPY(code, "NFA_BOL "); break;
|
|
Karsten Hopp |
3d1a0d |
case NFA_EOW: STRCPY(code, "NFA_EOW "); break;
|
|
Karsten Hopp |
3d1a0d |
--- 1849,1908 ----
|
|
Karsten Hopp |
3d1a0d |
case NFA_COMPOSING: STRCPY(code, "NFA_COMPOSING"); break;
|
|
Karsten Hopp |
3d1a0d |
case NFA_END_COMPOSING: STRCPY(code, "NFA_END_COMPOSING"); break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN9:
|
|
Karsten Hopp |
3d1a0d |
STRCPY(code, "NFA_MOPEN(x)");
|
|
Karsten Hopp |
3d1a0d |
code[10] = c - NFA_MOPEN + '0';
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE9:
|
|
Karsten Hopp |
3d1a0d |
STRCPY(code, "NFA_MCLOSE(x)");
|
|
Karsten Hopp |
3d1a0d |
code[11] = c - NFA_MCLOSE + '0';
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN1:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN2:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN3:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN4:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN5:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN6:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN7:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN8:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZOPEN9:
|
|
Karsten Hopp |
3d1a0d |
+ STRCPY(code, "NFA_ZOPEN(x)");
|
|
Karsten Hopp |
3d1a0d |
+ code[10] = c - NFA_ZOPEN + '0';
|
|
Karsten Hopp |
3d1a0d |
+ break;
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE1:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE2:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE3:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE4:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE5:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE6:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE7:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE8:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZCLOSE9:
|
|
Karsten Hopp |
3d1a0d |
+ STRCPY(code, "NFA_ZCLOSE(x)");
|
|
Karsten Hopp |
3d1a0d |
+ code[11] = c - NFA_ZCLOSE + '0';
|
|
Karsten Hopp |
3d1a0d |
+ break;
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
case NFA_EOL: STRCPY(code, "NFA_EOL "); break;
|
|
Karsten Hopp |
3d1a0d |
case NFA_BOL: STRCPY(code, "NFA_BOL "); break;
|
|
Karsten Hopp |
3d1a0d |
case NFA_EOW: STRCPY(code, "NFA_EOW "); break;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2437,2453 ****
|
|
Karsten Hopp |
3d1a0d |
/* FALLTHROUGH */
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 0: /* Submatch */
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 9:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_NOPEN: /* \%( "Invisible Submatch" */
|
|
Karsten Hopp |
3d1a0d |
if (nfa_calc_size == TRUE)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
nstate += 2;
|
|
Karsten Hopp |
3d1a0d |
--- 2556,2584 ----
|
|
Karsten Hopp |
3d1a0d |
/* FALLTHROUGH */
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN: /* \( \) Submatch */
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN9:
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN: /* \z( \) Submatch */
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN9:
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
! case NFA_NOPEN: /* \%( \) "Invisible Submatch" */
|
|
Karsten Hopp |
3d1a0d |
if (nfa_calc_size == TRUE)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
nstate += 2;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2457,2472 ****
|
|
Karsten Hopp |
3d1a0d |
mopen = *p;
|
|
Karsten Hopp |
3d1a0d |
switch (*p)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! case NFA_NOPEN:
|
|
Karsten Hopp |
3d1a0d |
! mclose = NFA_NCLOSE;
|
|
Karsten Hopp |
3d1a0d |
! break;
|
|
Karsten Hopp |
3d1a0d |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
3d1a0d |
! case NFA_COMPOSING:
|
|
Karsten Hopp |
3d1a0d |
! mclose = NFA_END_COMPOSING;
|
|
Karsten Hopp |
3d1a0d |
! break;
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
default:
|
|
Karsten Hopp |
3d1a0d |
! /* NFA_MOPEN(0) ... NFA_MOPEN(9) */
|
|
Karsten Hopp |
3d1a0d |
mclose = *p + NSUBEXP;
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
--- 2588,2611 ----
|
|
Karsten Hopp |
3d1a0d |
mopen = *p;
|
|
Karsten Hopp |
3d1a0d |
switch (*p)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! case NFA_NOPEN: mclose = NFA_NCLOSE; break;
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN: mclose = NFA_ZCLOSE; break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN1: mclose = NFA_ZCLOSE1; break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN2: mclose = NFA_ZCLOSE2; break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN3: mclose = NFA_ZCLOSE3; break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN4: mclose = NFA_ZCLOSE4; break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN5: mclose = NFA_ZCLOSE5; break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN6: mclose = NFA_ZCLOSE6; break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN7: mclose = NFA_ZCLOSE7; break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN8: mclose = NFA_ZCLOSE8; break;
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN9: mclose = NFA_ZCLOSE9; break;
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
3d1a0d |
! case NFA_COMPOSING: mclose = NFA_END_COMPOSING; break;
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
default:
|
|
Karsten Hopp |
3d1a0d |
! /* NFA_MOPEN, NFA_MOPEN1 .. NFA_MOPEN9 */
|
|
Karsten Hopp |
3d1a0d |
mclose = *p + NSUBEXP;
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2518,2523 ****
|
|
Karsten Hopp |
3d1a0d |
--- 2657,2673 ----
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF7:
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF8:
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF9:
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF1:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF2:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF3:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF4:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF5:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF6:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF7:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF8:
|
|
Karsten Hopp |
3d1a0d |
+ case NFA_ZREF9:
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
if (nfa_calc_size == TRUE)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
nstate += 2;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2630,2641 ****
|
|
Karsten Hopp |
3d1a0d |
} list;
|
|
Karsten Hopp |
3d1a0d |
} regsub_T;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* nfa_thread_T contains execution information of a NFA state */
|
|
Karsten Hopp |
3d1a0d |
typedef struct
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T *state;
|
|
Karsten Hopp |
3d1a0d |
int count;
|
|
Karsten Hopp |
3d1a0d |
! regsub_T sub; /* submatch info, only party used */
|
|
Karsten Hopp |
3d1a0d |
} nfa_thread_T;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* nfa_list_T contains the alternative NFA execution states. */
|
|
Karsten Hopp |
3d1a0d |
--- 2780,2799 ----
|
|
Karsten Hopp |
3d1a0d |
} list;
|
|
Karsten Hopp |
3d1a0d |
} regsub_T;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
+ typedef struct
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ regsub_T norm; /* \( .. \) matches */
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ regsub_T synt; /* \z( .. \) matches */
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
+ } regsubs_T;
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
/* nfa_thread_T contains execution information of a NFA state */
|
|
Karsten Hopp |
3d1a0d |
typedef struct
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T *state;
|
|
Karsten Hopp |
3d1a0d |
int count;
|
|
Karsten Hopp |
3d1a0d |
! regsubs_T subs; /* submatch info, only party used */
|
|
Karsten Hopp |
3d1a0d |
} nfa_thread_T;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* nfa_list_T contains the alternative NFA execution states. */
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2648,2653 ****
|
|
Karsten Hopp |
3d1a0d |
--- 2806,2824 ----
|
|
Karsten Hopp |
3d1a0d |
} nfa_list_T;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
+ static void log_subsexpr __ARGS((regsubs_T *subs));
|
|
Karsten Hopp |
3d1a0d |
+ static void log_subexpr __ARGS((regsub_T *sub));
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
+ static void
|
|
Karsten Hopp |
3d1a0d |
+ log_subsexpr(subs)
|
|
Karsten Hopp |
3d1a0d |
+ regsubs_T *subs;
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ log_subexpr(&subs->norm);
|
|
Karsten Hopp |
3d1a0d |
+ # ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ log_subexpr(&subs->synt);
|
|
Karsten Hopp |
3d1a0d |
+ # endif
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
static void
|
|
Karsten Hopp |
3d1a0d |
log_subexpr(sub)
|
|
Karsten Hopp |
3d1a0d |
regsub_T *sub;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2674,2682 ****
|
|
Karsten Hopp |
3d1a0d |
/* Used during execution: whether a match has been found. */
|
|
Karsten Hopp |
3d1a0d |
static int nfa_match;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
static int sub_equal __ARGS((regsub_T *sub1, regsub_T *sub2));
|
|
Karsten Hopp |
3d1a0d |
! static void addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *sub, int off));
|
|
Karsten Hopp |
3d1a0d |
! static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsub_T *sub, int *ip));
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
* Return TRUE if "sub1" and "sub2" have the same positions.
|
|
Karsten Hopp |
3d1a0d |
--- 2845,2916 ----
|
|
Karsten Hopp |
3d1a0d |
/* Used during execution: whether a match has been found. */
|
|
Karsten Hopp |
3d1a0d |
static int nfa_match;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
+ static void clear_sub __ARGS((regsub_T *sub));
|
|
Karsten Hopp |
3d1a0d |
+ static void copy_sub __ARGS((regsub_T *to, regsub_T *from));
|
|
Karsten Hopp |
3d1a0d |
+ static void copy_sub_off __ARGS((regsub_T *to, regsub_T *from));
|
|
Karsten Hopp |
3d1a0d |
static int sub_equal __ARGS((regsub_T *sub1, regsub_T *sub2));
|
|
Karsten Hopp |
3d1a0d |
! static void addstate __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, int off));
|
|
Karsten Hopp |
3d1a0d |
! static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state, regsubs_T *subs, int *ip));
|
|
Karsten Hopp |
3d1a0d |
!
|
|
Karsten Hopp |
3d1a0d |
! static void
|
|
Karsten Hopp |
3d1a0d |
! clear_sub(sub)
|
|
Karsten Hopp |
3d1a0d |
! regsub_T *sub;
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
! /* Use 0xff to set lnum to -1 */
|
|
Karsten Hopp |
3d1a0d |
! vim_memset(sub->list.multi, 0xff,
|
|
Karsten Hopp |
3d1a0d |
! sizeof(struct multipos) * nfa_nsubexpr);
|
|
Karsten Hopp |
3d1a0d |
! else
|
|
Karsten Hopp |
3d1a0d |
! vim_memset(sub->list.line, 0, sizeof(struct linepos) * nfa_nsubexpr);
|
|
Karsten Hopp |
3d1a0d |
! sub->in_use = 0;
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
!
|
|
Karsten Hopp |
3d1a0d |
! /*
|
|
Karsten Hopp |
3d1a0d |
! * Copy the submatches from "from" to "to".
|
|
Karsten Hopp |
3d1a0d |
! */
|
|
Karsten Hopp |
3d1a0d |
! static void
|
|
Karsten Hopp |
3d1a0d |
! copy_sub(to, from)
|
|
Karsten Hopp |
3d1a0d |
! regsub_T *to;
|
|
Karsten Hopp |
3d1a0d |
! regsub_T *from;
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! to->in_use = from->in_use;
|
|
Karsten Hopp |
3d1a0d |
! if (from->in_use > 0)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! /* Copy the match start and end positions. */
|
|
Karsten Hopp |
3d1a0d |
! if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
! mch_memmove(&to->list.multi[0],
|
|
Karsten Hopp |
3d1a0d |
! &from->list.multi[0],
|
|
Karsten Hopp |
3d1a0d |
! sizeof(struct multipos) * from->in_use);
|
|
Karsten Hopp |
3d1a0d |
! else
|
|
Karsten Hopp |
3d1a0d |
! mch_memmove(&to->list.line[0],
|
|
Karsten Hopp |
3d1a0d |
! &from->list.line[0],
|
|
Karsten Hopp |
3d1a0d |
! sizeof(struct linepos) * from->in_use);
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
!
|
|
Karsten Hopp |
3d1a0d |
! /*
|
|
Karsten Hopp |
3d1a0d |
! * Like copy_sub() but exclude the main match.
|
|
Karsten Hopp |
3d1a0d |
! */
|
|
Karsten Hopp |
3d1a0d |
! static void
|
|
Karsten Hopp |
3d1a0d |
! copy_sub_off(to, from)
|
|
Karsten Hopp |
3d1a0d |
! regsub_T *to;
|
|
Karsten Hopp |
3d1a0d |
! regsub_T *from;
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! if (to->in_use < from->in_use)
|
|
Karsten Hopp |
3d1a0d |
! to->in_use = from->in_use;
|
|
Karsten Hopp |
3d1a0d |
! if (from->in_use > 1)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! /* Copy the match start and end positions. */
|
|
Karsten Hopp |
3d1a0d |
! if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
! mch_memmove(&to->list.multi[1],
|
|
Karsten Hopp |
3d1a0d |
! &from->list.multi[1],
|
|
Karsten Hopp |
3d1a0d |
! sizeof(struct multipos) * (from->in_use - 1));
|
|
Karsten Hopp |
3d1a0d |
! else
|
|
Karsten Hopp |
3d1a0d |
! mch_memmove(&to->list.line[1],
|
|
Karsten Hopp |
3d1a0d |
! &from->list.line[1],
|
|
Karsten Hopp |
3d1a0d |
! sizeof(struct linepos) * (from->in_use - 1));
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
* Return TRUE if "sub1" and "sub2" have the same positions.
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2761,2770 ****
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
static void
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state, sub, off)
|
|
Karsten Hopp |
3d1a0d |
nfa_list_T *l; /* runtime state list */
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T *state; /* state to update */
|
|
Karsten Hopp |
3d1a0d |
! regsub_T *sub; /* pointers to subexpressions */
|
|
Karsten Hopp |
3d1a0d |
int off; /* byte offset, when -1 go to next line */
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int subidx;
|
|
Karsten Hopp |
3d1a0d |
--- 2995,3004 ----
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
static void
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state, subs, off)
|
|
Karsten Hopp |
3d1a0d |
nfa_list_T *l; /* runtime state list */
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T *state; /* state to update */
|
|
Karsten Hopp |
3d1a0d |
! regsubs_T *subs; /* pointers to subexpressions */
|
|
Karsten Hopp |
3d1a0d |
int off; /* byte offset, when -1 go to next line */
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int subidx;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2773,2778 ****
|
|
Karsten Hopp |
3d1a0d |
--- 3007,3013 ----
|
|
Karsten Hopp |
3d1a0d |
int save_in_use;
|
|
Karsten Hopp |
3d1a0d |
char_u *save_ptr;
|
|
Karsten Hopp |
3d1a0d |
int i;
|
|
Karsten Hopp |
3d1a0d |
+ regsub_T *sub;
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
int did_print = FALSE;
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2787,2815 ****
|
|
Karsten Hopp |
3d1a0d |
case NFA_NOPEN:
|
|
Karsten Hopp |
3d1a0d |
case NFA_NCLOSE:
|
|
Karsten Hopp |
3d1a0d |
case NFA_MCLOSE:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 9:
|
|
Karsten Hopp |
3d1a0d |
/* These nodes are not added themselves but their "out" and/or
|
|
Karsten Hopp |
3d1a0d |
* "out1" may be added below. */
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_MOPEN:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 9:
|
|
Karsten Hopp |
3d1a0d |
/* These nodes do not need to be added, but we need to bail out
|
|
Karsten Hopp |
3d1a0d |
* when it was tried to be added to this list before. */
|
|
Karsten Hopp |
3d1a0d |
if (state->lastlist == l->id)
|
|
Karsten Hopp |
3d1a0d |
--- 3022,3074 ----
|
|
Karsten Hopp |
3d1a0d |
case NFA_NOPEN:
|
|
Karsten Hopp |
3d1a0d |
case NFA_NCLOSE:
|
|
Karsten Hopp |
3d1a0d |
case NFA_MCLOSE:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE9:
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE9:
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
/* These nodes are not added themselves but their "out" and/or
|
|
Karsten Hopp |
3d1a0d |
* "out1" may be added below. */
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_MOPEN:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN9:
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN9:
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
/* These nodes do not need to be added, but we need to bail out
|
|
Karsten Hopp |
3d1a0d |
* when it was tried to be added to this list before. */
|
|
Karsten Hopp |
3d1a0d |
if (state->lastlist == l->id)
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2839,2845 ****
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
thread = &l->t[i];
|
|
Karsten Hopp |
3d1a0d |
if (thread->state->id == state->id
|
|
Karsten Hopp |
3d1a0d |
! && sub_equal(&thread->sub, sub))
|
|
Karsten Hopp |
3d1a0d |
goto skip_add;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
--- 3098,3108 ----
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
thread = &l->t[i];
|
|
Karsten Hopp |
3d1a0d |
if (thread->state->id == state->id
|
|
Karsten Hopp |
3d1a0d |
! && sub_equal(&thread->subs.norm, &subs->norm)
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! && sub_equal(&thread->subs.synt, &subs->synt)
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
! )
|
|
Karsten Hopp |
3d1a0d |
goto skip_add;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2858,2876 ****
|
|
Karsten Hopp |
3d1a0d |
state->lastlist = l->id;
|
|
Karsten Hopp |
3d1a0d |
thread = &l->t[l->n++];
|
|
Karsten Hopp |
3d1a0d |
thread->state = state;
|
|
Karsten Hopp |
3d1a0d |
! thread->sub.in_use = sub->in_use;
|
|
Karsten Hopp |
3d1a0d |
! if (sub->in_use > 0)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! /* Copy the match start and end positions. */
|
|
Karsten Hopp |
3d1a0d |
! if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
! mch_memmove(&thread->sub.list.multi[0],
|
|
Karsten Hopp |
3d1a0d |
! &sub->list.multi[0],
|
|
Karsten Hopp |
3d1a0d |
! sizeof(struct multipos) * sub->in_use);
|
|
Karsten Hopp |
3d1a0d |
! else
|
|
Karsten Hopp |
3d1a0d |
! mch_memmove(&thread->sub.list.line[0],
|
|
Karsten Hopp |
3d1a0d |
! &sub->list.line[0],
|
|
Karsten Hopp |
3d1a0d |
! sizeof(struct linepos) * sub->in_use);
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int col;
|
|
Karsten Hopp |
3d1a0d |
--- 3121,3130 ----
|
|
Karsten Hopp |
3d1a0d |
state->lastlist = l->id;
|
|
Karsten Hopp |
3d1a0d |
thread = &l->t[l->n++];
|
|
Karsten Hopp |
3d1a0d |
thread->state = state;
|
|
Karsten Hopp |
3d1a0d |
! copy_sub(&thread->subs.norm, &subs->norm);
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! copy_sub(&thread->subs.synt, &subs->synt);
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int col;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 2912,2959 ****
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_SPLIT:
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, sub, off);
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out1, sub, off);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
- #if 0
|
|
Karsten Hopp |
3d1a0d |
- case NFA_END_NEG_RANGE:
|
|
Karsten Hopp |
3d1a0d |
- /* Nothing to handle here. nfa_regmatch() will take care of it */
|
|
Karsten Hopp |
3d1a0d |
- break;
|
|
Karsten Hopp |
3d1a0d |
-
|
|
Karsten Hopp |
3d1a0d |
- case NFA_NOT:
|
|
Karsten Hopp |
3d1a0d |
- EMSG(_("E999: (NFA regexp internal error) Should not process NOT node !"));
|
|
Karsten Hopp |
3d1a0d |
- #ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
- fprintf(f, "\n\n>>> E999: Added state NFA_NOT to a list ... Something went wrong ! Why wasn't it processed already? \n\n");
|
|
Karsten Hopp |
3d1a0d |
- #endif
|
|
Karsten Hopp |
3d1a0d |
- break;
|
|
Karsten Hopp |
3d1a0d |
-
|
|
Karsten Hopp |
3d1a0d |
- case NFA_COMPOSING:
|
|
Karsten Hopp |
3d1a0d |
- /* nfa_regmatch() will match all the bytes of this composing char. */
|
|
Karsten Hopp |
3d1a0d |
- break;
|
|
Karsten Hopp |
3d1a0d |
- #endif
|
|
Karsten Hopp |
3d1a0d |
-
|
|
Karsten Hopp |
3d1a0d |
case NFA_SKIP_CHAR:
|
|
Karsten Hopp |
3d1a0d |
case NFA_NOPEN:
|
|
Karsten Hopp |
3d1a0d |
case NFA_NCLOSE:
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, sub, off);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 0:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN + 9:
|
|
Karsten Hopp |
3d1a0d |
case NFA_ZSTART:
|
|
Karsten Hopp |
3d1a0d |
if (state->c == NFA_ZSTART)
|
|
Karsten Hopp |
3d1a0d |
subidx = 0;
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
subidx = state->c - NFA_MOPEN;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* Set the position (with "off") in the subexpression. Save and
|
|
Karsten Hopp |
3d1a0d |
* restore it when it was in use. Otherwise fill any gap. */
|
|
Karsten Hopp |
3d1a0d |
--- 3166,3222 ----
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_SPLIT:
|
|
Karsten Hopp |
3d1a0d |
! /* order matters here */
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, subs, off);
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out1, subs, off);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_SKIP_CHAR:
|
|
Karsten Hopp |
3d1a0d |
case NFA_NOPEN:
|
|
Karsten Hopp |
3d1a0d |
case NFA_NCLOSE:
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, subs, off);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MOPEN9:
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZOPEN9:
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
case NFA_ZSTART:
|
|
Karsten Hopp |
3d1a0d |
if (state->c == NFA_ZSTART)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
subidx = 0;
|
|
Karsten Hopp |
3d1a0d |
+ sub = &subs->norm;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ else if (state->c >= NFA_ZOPEN)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ subidx = state->c - NFA_ZOPEN;
|
|
Karsten Hopp |
3d1a0d |
+ sub = &subs->synt;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
subidx = state->c - NFA_MOPEN;
|
|
Karsten Hopp |
3d1a0d |
+ sub = &subs->norm;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* Set the position (with "off") in the subexpression. Save and
|
|
Karsten Hopp |
3d1a0d |
* restore it when it was in use. Otherwise fill any gap. */
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3007,3013 ****
|
|
Karsten Hopp |
3d1a0d |
sub->list.line[subidx].start = reginput + off;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, sub, off);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
if (save_in_use == -1)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
--- 3270,3276 ----
|
|
Karsten Hopp |
3d1a0d |
sub->list.line[subidx].start = reginput + off;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, subs, off);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
if (save_in_use == -1)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3020,3047 ****
|
|
Karsten Hopp |
3d1a0d |
sub->in_use = save_in_use;
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 0:
|
|
Karsten Hopp |
3d1a0d |
if (nfa_has_zend)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* Do not overwrite the position set by \ze. If no \ze
|
|
Karsten Hopp |
3d1a0d |
* encountered end will be set in nfa_regtry(). */
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, sub, off);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE + 9:
|
|
Karsten Hopp |
3d1a0d |
case NFA_ZEND:
|
|
Karsten Hopp |
3d1a0d |
if (state->c == NFA_ZEND)
|
|
Karsten Hopp |
3d1a0d |
subidx = 0;
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
subidx = state->c - NFA_MCLOSE;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* We don't fill in gaps here, there must have been an MOPEN that
|
|
Karsten Hopp |
3d1a0d |
* has done that. */
|
|
Karsten Hopp |
3d1a0d |
--- 3283,3335 ----
|
|
Karsten Hopp |
3d1a0d |
sub->in_use = save_in_use;
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE:
|
|
Karsten Hopp |
3d1a0d |
if (nfa_has_zend)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* Do not overwrite the position set by \ze. If no \ze
|
|
Karsten Hopp |
3d1a0d |
* encountered end will be set in nfa_regtry(). */
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, subs, off);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_MCLOSE9:
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZCLOSE9:
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
case NFA_ZEND:
|
|
Karsten Hopp |
3d1a0d |
if (state->c == NFA_ZEND)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
subidx = 0;
|
|
Karsten Hopp |
3d1a0d |
+ sub = &subs->norm;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ else if (state->c >= NFA_ZCLOSE)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ subidx = state->c - NFA_ZCLOSE;
|
|
Karsten Hopp |
3d1a0d |
+ sub = &subs->synt;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
subidx = state->c - NFA_MCLOSE;
|
|
Karsten Hopp |
3d1a0d |
+ sub = &subs->norm;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* We don't fill in gaps here, there must have been an MOPEN that
|
|
Karsten Hopp |
3d1a0d |
* has done that. */
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3069,3075 ****
|
|
Karsten Hopp |
3d1a0d |
sub->list.line[subidx].end = reginput + off;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, sub, off);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
sub->list.multi[subidx].end = save_lpos;
|
|
Karsten Hopp |
3d1a0d |
--- 3357,3363 ----
|
|
Karsten Hopp |
3d1a0d |
sub->list.line[subidx].end = reginput + off;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state->out, subs, off);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
sub->list.multi[subidx].end = save_lpos;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3087,3096 ****
|
|
Karsten Hopp |
3d1a0d |
* matters for alternatives.
|
|
Karsten Hopp |
3d1a0d |
*/
|
|
Karsten Hopp |
3d1a0d |
static void
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(l, state, sub, ip)
|
|
Karsten Hopp |
3d1a0d |
nfa_list_T *l; /* runtime state list */
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T *state; /* state to update */
|
|
Karsten Hopp |
3d1a0d |
! regsub_T *sub; /* pointers to subexpressions */
|
|
Karsten Hopp |
3d1a0d |
int *ip;
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int tlen = l->n;
|
|
Karsten Hopp |
3d1a0d |
--- 3375,3384 ----
|
|
Karsten Hopp |
3d1a0d |
* matters for alternatives.
|
|
Karsten Hopp |
3d1a0d |
*/
|
|
Karsten Hopp |
3d1a0d |
static void
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(l, state, subs, ip)
|
|
Karsten Hopp |
3d1a0d |
nfa_list_T *l; /* runtime state list */
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T *state; /* state to update */
|
|
Karsten Hopp |
3d1a0d |
! regsubs_T *subs; /* pointers to subexpressions */
|
|
Karsten Hopp |
3d1a0d |
int *ip;
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int tlen = l->n;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3098,3104 ****
|
|
Karsten Hopp |
3d1a0d |
int i = *ip;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* first add the state(s) at the end, so that we know how many there are */
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state, sub, 0);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* when "*ip" was at the end of the list, nothing to do */
|
|
Karsten Hopp |
3d1a0d |
if (i + 1 == tlen)
|
|
Karsten Hopp |
3d1a0d |
--- 3386,3392 ----
|
|
Karsten Hopp |
3d1a0d |
int i = *ip;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* first add the state(s) at the end, so that we know how many there are */
|
|
Karsten Hopp |
3d1a0d |
! addstate(l, state, subs, 0);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* when "*ip" was at the end of the list, nothing to do */
|
|
Karsten Hopp |
3d1a0d |
if (i + 1 == tlen)
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3212,3218 ****
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
* Check for a match with subexpression "subidx".
|
|
Karsten Hopp |
3d1a0d |
! * return TRUE if it matches.
|
|
Karsten Hopp |
3d1a0d |
*/
|
|
Karsten Hopp |
3d1a0d |
static int
|
|
Karsten Hopp |
3d1a0d |
match_backref(sub, subidx, bytelen)
|
|
Karsten Hopp |
3d1a0d |
--- 3500,3506 ----
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
* Check for a match with subexpression "subidx".
|
|
Karsten Hopp |
3d1a0d |
! * Return TRUE if it matches.
|
|
Karsten Hopp |
3d1a0d |
*/
|
|
Karsten Hopp |
3d1a0d |
static int
|
|
Karsten Hopp |
3d1a0d |
match_backref(sub, subidx, bytelen)
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3260,3265 ****
|
|
Karsten Hopp |
3d1a0d |
--- 3548,3586 ----
|
|
Karsten Hopp |
3d1a0d |
return FALSE;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
+ static int match_zref __ARGS((int subidx, int *bytelen));
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
+ /*
|
|
Karsten Hopp |
3d1a0d |
+ * Check for a match with \z subexpression "subidx".
|
|
Karsten Hopp |
3d1a0d |
+ * Return TRUE if it matches.
|
|
Karsten Hopp |
3d1a0d |
+ */
|
|
Karsten Hopp |
3d1a0d |
+ static int
|
|
Karsten Hopp |
3d1a0d |
+ match_zref(subidx, bytelen)
|
|
Karsten Hopp |
3d1a0d |
+ int subidx;
|
|
Karsten Hopp |
3d1a0d |
+ int *bytelen; /* out: length of match in bytes */
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ int len;
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
+ cleanup_zsubexpr();
|
|
Karsten Hopp |
3d1a0d |
+ if (re_extmatch_in == NULL || re_extmatch_in->matches[subidx] == NULL)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ /* backref was not set, match an empty string */
|
|
Karsten Hopp |
3d1a0d |
+ *bytelen = 0;
|
|
Karsten Hopp |
3d1a0d |
+ return TRUE;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
+ len = (int)STRLEN(re_extmatch_in->matches[subidx]);
|
|
Karsten Hopp |
3d1a0d |
+ if (cstrncmp(re_extmatch_in->matches[subidx], reginput, &len) == 0)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ *bytelen = len;
|
|
Karsten Hopp |
3d1a0d |
+ return TRUE;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ return FALSE;
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
* Set all NFA nodes' list ID equal to -1.
|
|
Karsten Hopp |
3d1a0d |
*/
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3334,3340 ****
|
|
Karsten Hopp |
3d1a0d |
return val == pos;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! static int nfa_regmatch __ARGS((nfa_state_T *start, regsub_T *submatch, regsub_T *m, save_se_T *endp));
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
* Main matching routine.
|
|
Karsten Hopp |
3d1a0d |
--- 3655,3661 ----
|
|
Karsten Hopp |
3d1a0d |
return val == pos;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! static int nfa_regmatch __ARGS((nfa_state_T *start, regsubs_T *submatch, regsubs_T *m, save_se_T *endp));
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
* Main matching routine.
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3349,3356 ****
|
|
Karsten Hopp |
3d1a0d |
static int
|
|
Karsten Hopp |
3d1a0d |
nfa_regmatch(start, submatch, m, endp)
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T *start;
|
|
Karsten Hopp |
3d1a0d |
! regsub_T *submatch;
|
|
Karsten Hopp |
3d1a0d |
! regsub_T *m;
|
|
Karsten Hopp |
3d1a0d |
save_se_T *endp;
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int result;
|
|
Karsten Hopp |
3d1a0d |
--- 3670,3677 ----
|
|
Karsten Hopp |
3d1a0d |
static int
|
|
Karsten Hopp |
3d1a0d |
nfa_regmatch(start, submatch, m, endp)
|
|
Karsten Hopp |
3d1a0d |
nfa_state_T *start;
|
|
Karsten Hopp |
3d1a0d |
! regsubs_T *submatch;
|
|
Karsten Hopp |
3d1a0d |
! regsubs_T *m;
|
|
Karsten Hopp |
3d1a0d |
save_se_T *endp;
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int result;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3429,3435 ****
|
|
Karsten Hopp |
3d1a0d |
#define ADD_POS_NEG_STATE(node) \
|
|
Karsten Hopp |
3d1a0d |
ll = listtbl[result ? 1 : 0][node->negated]; \
|
|
Karsten Hopp |
3d1a0d |
if (ll != NULL) \
|
|
Karsten Hopp |
3d1a0d |
! addstate(ll, node->out , &t->sub, clen);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
--- 3750,3756 ----
|
|
Karsten Hopp |
3d1a0d |
#define ADD_POS_NEG_STATE(node) \
|
|
Karsten Hopp |
3d1a0d |
ll = listtbl[result ? 1 : 0][node->negated]; \
|
|
Karsten Hopp |
3d1a0d |
if (ll != NULL) \
|
|
Karsten Hopp |
3d1a0d |
! addstate(ll, node->out , &t->subs, clen);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3531,3556 ****
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
case NFA_MATCH:
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
- int j;
|
|
Karsten Hopp |
3d1a0d |
-
|
|
Karsten Hopp |
3d1a0d |
nfa_match = TRUE;
|
|
Karsten Hopp |
3d1a0d |
! submatch->in_use = t->sub.in_use;
|
|
Karsten Hopp |
3d1a0d |
! if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
! for (j = 0; j < submatch->in_use; j++)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! submatch->list.multi[j].start =
|
|
Karsten Hopp |
3d1a0d |
! t->sub.list.multi[j].start;
|
|
Karsten Hopp |
3d1a0d |
! submatch->list.multi[j].end = t->sub.list.multi[j].end;
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
! else
|
|
Karsten Hopp |
3d1a0d |
! for (j = 0; j < submatch->in_use; j++)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! submatch->list.line[j].start =
|
|
Karsten Hopp |
3d1a0d |
! t->sub.list.line[j].start;
|
|
Karsten Hopp |
3d1a0d |
! submatch->list.line[j].end = t->sub.list.line[j].end;
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subexpr(&t->sub);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
/* Found the left-most longest match, do not look at any other
|
|
Karsten Hopp |
3d1a0d |
* states at this position. When the list of states is going
|
|
Karsten Hopp |
3d1a0d |
--- 3852,3864 ----
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
case NFA_MATCH:
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
nfa_match = TRUE;
|
|
Karsten Hopp |
3d1a0d |
! copy_sub(&submatch->norm, &t->subs.norm);
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! copy_sub(&submatch->synt, &t->subs.synt);
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subsexpr(&t->subs);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
/* Found the left-most longest match, do not look at any other
|
|
Karsten Hopp |
3d1a0d |
* states at this position. When the list of states is going
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3570,3578 ****
|
|
Karsten Hopp |
3d1a0d |
* finished successfully, so return control to the parent
|
|
Karsten Hopp |
3d1a0d |
* nfa_regmatch(). Submatches are stored in *m, and used in
|
|
Karsten Hopp |
3d1a0d |
* the parent call. */
|
|
Karsten Hopp |
3d1a0d |
! if (start->c == NFA_MOPEN + 0)
|
|
Karsten Hopp |
3d1a0d |
/* TODO: do we ever get here? */
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
--- 3878,3886 ----
|
|
Karsten Hopp |
3d1a0d |
* finished successfully, so return control to the parent
|
|
Karsten Hopp |
3d1a0d |
* nfa_regmatch(). Submatches are stored in *m, and used in
|
|
Karsten Hopp |
3d1a0d |
* the parent call. */
|
|
Karsten Hopp |
3d1a0d |
! if (start->c == NFA_MOPEN)
|
|
Karsten Hopp |
3d1a0d |
/* TODO: do we ever get here? */
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3600,3607 ****
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* do not set submatches for \@! */
|
|
Karsten Hopp |
3d1a0d |
if (!t->state->negated)
|
|
Karsten Hopp |
3d1a0d |
! /* TODO: only copy positions in use. */
|
|
Karsten Hopp |
3d1a0d |
! *m = t->sub;
|
|
Karsten Hopp |
3d1a0d |
nfa_match = TRUE;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
--- 3908,3919 ----
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* do not set submatches for \@! */
|
|
Karsten Hopp |
3d1a0d |
if (!t->state->negated)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! copy_sub(&m->norm, &t->subs.norm);
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! copy_sub(&m->synt, &t->subs.synt);
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
nfa_match = TRUE;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3630,3636 ****
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* Go back the specified number of bytes, or as far as the
|
|
Karsten Hopp |
3d1a0d |
* start of the previous line, to try matching "\@<=" or
|
|
Karsten Hopp |
3d1a0d |
! * not matching "\@
|
|
Karsten Hopp |
3d1a0d |
if (t->state->val <= 0)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
--- 3942,3950 ----
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* Go back the specified number of bytes, or as far as the
|
|
Karsten Hopp |
3d1a0d |
* start of the previous line, to try matching "\@<=" or
|
|
Karsten Hopp |
3d1a0d |
! * not matching "\@
|
|
Karsten Hopp |
3d1a0d |
! * TODO: This is very inefficient! Would be better to
|
|
Karsten Hopp |
3d1a0d |
! * first check for a match with what follows. */
|
|
Karsten Hopp |
3d1a0d |
if (t->state->val <= 0)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3722,3748 ****
|
|
Karsten Hopp |
3d1a0d |
/* for \@! it is a match when result is FALSE */
|
|
Karsten Hopp |
3d1a0d |
if (result != t->state->negated)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
- int j;
|
|
Karsten Hopp |
3d1a0d |
-
|
|
Karsten Hopp |
3d1a0d |
/* Copy submatch info from the recursive call */
|
|
Karsten Hopp |
3d1a0d |
! if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
! for (j = 1; j < m->in_use; j++)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! t->sub.list.multi[j].start = m->list.multi[j].start;
|
|
Karsten Hopp |
3d1a0d |
! t->sub.list.multi[j].end = m->list.multi[j].end;
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
! else
|
|
Karsten Hopp |
3d1a0d |
! for (j = 1; j < m->in_use; j++)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! t->sub.list.line[j].start = m->list.line[j].start;
|
|
Karsten Hopp |
3d1a0d |
! t->sub.list.line[j].end = m->list.line[j].end;
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
! if (m->in_use > t->sub.in_use)
|
|
Karsten Hopp |
3d1a0d |
! t->sub.in_use = m->in_use;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* t->state->out1 is the corresponding END_INVISIBLE node;
|
|
Karsten Hopp |
3d1a0d |
* Add it to the current list (zero-width match). */
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out1->out, &t->sub,
|
|
Karsten Hopp |
3d1a0d |
&listidx);
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
--- 4036,4050 ----
|
|
Karsten Hopp |
3d1a0d |
/* for \@! it is a match when result is FALSE */
|
|
Karsten Hopp |
3d1a0d |
if (result != t->state->negated)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* Copy submatch info from the recursive call */
|
|
Karsten Hopp |
3d1a0d |
! copy_sub_off(&t->subs.norm, &m->norm);
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! copy_sub_off(&t->subs.synt, &m->synt);
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/* t->state->out1 is the corresponding END_INVISIBLE node;
|
|
Karsten Hopp |
3d1a0d |
* Add it to the current list (zero-width match). */
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out1->out, &t->subs,
|
|
Karsten Hopp |
3d1a0d |
&listidx);
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3750,3761 ****
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_BOL:
|
|
Karsten Hopp |
3d1a0d |
if (reginput == regline)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_EOL:
|
|
Karsten Hopp |
3d1a0d |
if (curc == NUL)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_BOW:
|
|
Karsten Hopp |
3d1a0d |
--- 4052,4063 ----
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_BOL:
|
|
Karsten Hopp |
3d1a0d |
if (reginput == regline)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_EOL:
|
|
Karsten Hopp |
3d1a0d |
if (curc == NUL)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_BOW:
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3782,3788 ****
|
|
Karsten Hopp |
3d1a0d |
&& vim_iswordc_buf(reginput[-1], reg_buf)))
|
|
Karsten Hopp |
3d1a0d |
bow = FALSE;
|
|
Karsten Hopp |
3d1a0d |
if (bow)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
--- 4084,4090 ----
|
|
Karsten Hopp |
3d1a0d |
&& vim_iswordc_buf(reginput[-1], reg_buf)))
|
|
Karsten Hopp |
3d1a0d |
bow = FALSE;
|
|
Karsten Hopp |
3d1a0d |
if (bow)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3810,3828 ****
|
|
Karsten Hopp |
3d1a0d |
&& vim_iswordc_buf(curc, reg_buf)))
|
|
Karsten Hopp |
3d1a0d |
eow = FALSE;
|
|
Karsten Hopp |
3d1a0d |
if (eow)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_BOF:
|
|
Karsten Hopp |
3d1a0d |
if (reglnum == 0 && reginput == regline
|
|
Karsten Hopp |
3d1a0d |
&& (!REG_MULTI || reg_firstlnum == 1))
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_EOF:
|
|
Karsten Hopp |
3d1a0d |
if (reglnum == reg_maxline && curc == NUL)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
3d1a0d |
--- 4112,4130 ----
|
|
Karsten Hopp |
3d1a0d |
&& vim_iswordc_buf(curc, reg_buf)))
|
|
Karsten Hopp |
3d1a0d |
eow = FALSE;
|
|
Karsten Hopp |
3d1a0d |
if (eow)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_BOF:
|
|
Karsten Hopp |
3d1a0d |
if (reglnum == 0 && reginput == regline
|
|
Karsten Hopp |
3d1a0d |
&& (!REG_MULTI || reg_firstlnum == 1))
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_EOF:
|
|
Karsten Hopp |
3d1a0d |
if (reglnum == reg_maxline && curc == NUL)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
#ifdef FEAT_MBYTE
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3911,3922 ****
|
|
Karsten Hopp |
3d1a0d |
go_to_nextline = TRUE;
|
|
Karsten Hopp |
3d1a0d |
/* Pass -1 for the offset, which means taking the position
|
|
Karsten Hopp |
3d1a0d |
* at the start of the next line. */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->sub, -1);
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
else if (curc == '\n' && reg_line_lbr)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* match \n as if it is an ordinary character */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->sub, 1);
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
--- 4213,4224 ----
|
|
Karsten Hopp |
3d1a0d |
go_to_nextline = TRUE;
|
|
Karsten Hopp |
3d1a0d |
/* Pass -1 for the offset, which means taking the position
|
|
Karsten Hopp |
3d1a0d |
* at the start of the next line. */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->subs, -1);
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
else if (curc == '\n' && reg_line_lbr)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* match \n as if it is an ordinary character */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->subs, 1);
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 3944,3956 ****
|
|
Karsten Hopp |
3d1a0d |
/* This follows a series of negated nodes, like:
|
|
Karsten Hopp |
3d1a0d |
* CHAR(x), NFA_NOT, CHAR(y), NFA_NOT etc. */
|
|
Karsten Hopp |
3d1a0d |
if (curc > 0)
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->sub, clen);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_ANY:
|
|
Karsten Hopp |
3d1a0d |
/* Any char except '\0', (end of input) does not match. */
|
|
Karsten Hopp |
3d1a0d |
if (curc > 0)
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->sub, clen);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
--- 4246,4258 ----
|
|
Karsten Hopp |
3d1a0d |
/* This follows a series of negated nodes, like:
|
|
Karsten Hopp |
3d1a0d |
* CHAR(x), NFA_NOT, CHAR(y), NFA_NOT etc. */
|
|
Karsten Hopp |
3d1a0d |
if (curc > 0)
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->subs, clen);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_ANY:
|
|
Karsten Hopp |
3d1a0d |
/* Any char except '\0', (end of input) does not match. */
|
|
Karsten Hopp |
3d1a0d |
if (curc > 0)
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->subs, clen);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/*
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4096,4114 ****
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF7:
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF8:
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF9:
|
|
Karsten Hopp |
3d1a0d |
! /* \1 .. \9 */
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! int subidx = t->state->c - NFA_BACKREF1 + 1;
|
|
Karsten Hopp |
3d1a0d |
int bytelen;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! result = match_backref(&t->sub, subidx, &bytelen);
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
if (bytelen == 0)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* empty match always works, add NFA_SKIP with zero to
|
|
Karsten Hopp |
3d1a0d |
* be used next */
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub,
|
|
Karsten Hopp |
3d1a0d |
&listidx);
|
|
Karsten Hopp |
3d1a0d |
thislist->t[listidx + 1].count = 0;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
--- 4398,4439 ----
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF7:
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF8:
|
|
Karsten Hopp |
3d1a0d |
case NFA_BACKREF9:
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZREF1:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZREF2:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZREF3:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZREF4:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZREF5:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZREF6:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZREF7:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZREF8:
|
|
Karsten Hopp |
3d1a0d |
! case NFA_ZREF9:
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
! /* \1 .. \9 \z1 .. \z9 */
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! int subidx;
|
|
Karsten Hopp |
3d1a0d |
int bytelen;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! if (t->state->c <= NFA_BACKREF9)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! subidx = t->state->c - NFA_BACKREF1 + 1;
|
|
Karsten Hopp |
3d1a0d |
! result = match_backref(&t->subs.norm, subidx, &bytelen);
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! else
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! subidx = t->state->c - NFA_ZREF1 + 1;
|
|
Karsten Hopp |
3d1a0d |
! result = match_zref(subidx, &bytelen);
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
!
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
if (bytelen == 0)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* empty match always works, add NFA_SKIP with zero to
|
|
Karsten Hopp |
3d1a0d |
* be used next */
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs,
|
|
Karsten Hopp |
3d1a0d |
&listidx);
|
|
Karsten Hopp |
3d1a0d |
thislist->t[listidx + 1].count = 0;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4116,4134 ****
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* match current character, jump ahead to out of
|
|
Karsten Hopp |
3d1a0d |
* NFA_SKIP */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out->out, &t->sub, clen);
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subexpr(&nextlist->t[nextlist->n - 1].sub);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* skip ofer the matched characters, set character
|
|
Karsten Hopp |
3d1a0d |
* count in NFA_SKIP */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->sub, bytelen);
|
|
Karsten Hopp |
3d1a0d |
nextlist->t[nextlist->n - 1].count = bytelen - clen;
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subexpr(&nextlist->t[nextlist->n - 1].sub);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
--- 4441,4459 ----
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* match current character, jump ahead to out of
|
|
Karsten Hopp |
3d1a0d |
* NFA_SKIP */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out->out, &t->subs, clen);
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subsexpr(&nextlist->t[nextlist->n - 1].subs);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* skip ofer the matched characters, set character
|
|
Karsten Hopp |
3d1a0d |
* count in NFA_SKIP */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->subs, bytelen);
|
|
Karsten Hopp |
3d1a0d |
nextlist->t[nextlist->n - 1].count = bytelen - clen;
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subsexpr(&nextlist->t[nextlist->n - 1].subs);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4140,4157 ****
|
|
Karsten Hopp |
3d1a0d |
if (t->count - clen <= 0)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* end of match, go to what follows */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->sub, clen);
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subexpr(&nextlist->t[nextlist->n - 1].sub);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* add state again with decremented count */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state, &t->sub, 0);
|
|
Karsten Hopp |
3d1a0d |
nextlist->t[nextlist->n - 1].count = t->count - clen;
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subexpr(&nextlist->t[nextlist->n - 1].sub);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
--- 4465,4482 ----
|
|
Karsten Hopp |
3d1a0d |
if (t->count - clen <= 0)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* end of match, go to what follows */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state->out, &t->subs, clen);
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subsexpr(&nextlist->t[nextlist->n - 1].subs);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
/* add state again with decremented count */
|
|
Karsten Hopp |
3d1a0d |
! addstate(nextlist, t->state, &t->subs, 0);
|
|
Karsten Hopp |
3d1a0d |
nextlist->t[nextlist->n - 1].count = t->count - clen;
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
! log_subsexpr(&nextlist->t[nextlist->n - 1].subs);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4169,4175 ****
|
|
Karsten Hopp |
3d1a0d |
nfa_re_num_cmp(t->state->val, t->state->c - NFA_LNUM,
|
|
Karsten Hopp |
3d1a0d |
(long_u)(reglnum + reg_firstlnum)));
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_COL:
|
|
Karsten Hopp |
3d1a0d |
--- 4494,4500 ----
|
|
Karsten Hopp |
3d1a0d |
nfa_re_num_cmp(t->state->val, t->state->c - NFA_LNUM,
|
|
Karsten Hopp |
3d1a0d |
(long_u)(reglnum + reg_firstlnum)));
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_COL:
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4178,4184 ****
|
|
Karsten Hopp |
3d1a0d |
result = nfa_re_num_cmp(t->state->val, t->state->c - NFA_COL,
|
|
Karsten Hopp |
3d1a0d |
(long_u)(reginput - regline) + 1);
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_VCOL:
|
|
Karsten Hopp |
3d1a0d |
--- 4503,4509 ----
|
|
Karsten Hopp |
3d1a0d |
result = nfa_re_num_cmp(t->state->val, t->state->c - NFA_COL,
|
|
Karsten Hopp |
3d1a0d |
(long_u)(reginput - regline) + 1);
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_VCOL:
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4189,4195 ****
|
|
Karsten Hopp |
3d1a0d |
reg_win == NULL ? curwin : reg_win,
|
|
Karsten Hopp |
3d1a0d |
regline, (colnr_T)(reginput - regline)) + 1);
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_CURSOR:
|
|
Karsten Hopp |
3d1a0d |
--- 4514,4520 ----
|
|
Karsten Hopp |
3d1a0d |
reg_win == NULL ? curwin : reg_win,
|
|
Karsten Hopp |
3d1a0d |
regline, (colnr_T)(reginput - regline)) + 1);
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
case NFA_CURSOR:
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4198,4204 ****
|
|
Karsten Hopp |
3d1a0d |
&& ((colnr_T)(reginput - regline)
|
|
Karsten Hopp |
3d1a0d |
== reg_win->w_cursor.col));
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->sub, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
default: /* regular character */
|
|
Karsten Hopp |
3d1a0d |
--- 4523,4529 ----
|
|
Karsten Hopp |
3d1a0d |
&& ((colnr_T)(reginput - regline)
|
|
Karsten Hopp |
3d1a0d |
== reg_win->w_cursor.col));
|
|
Karsten Hopp |
3d1a0d |
if (result)
|
|
Karsten Hopp |
3d1a0d |
! addstate_here(thislist, t->state->out, &t->subs, &listidx);
|
|
Karsten Hopp |
3d1a0d |
break;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
default: /* regular character */
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4238,4244 ****
|
|
Karsten Hopp |
3d1a0d |
* Unless "endp" is not NULL, then we match the end position.
|
|
Karsten Hopp |
3d1a0d |
* Also don't start a match past the first line. */
|
|
Karsten Hopp |
3d1a0d |
if (nfa_match == FALSE
|
|
Karsten Hopp |
3d1a0d |
! && ((start->c == NFA_MOPEN + 0
|
|
Karsten Hopp |
3d1a0d |
&& reglnum == 0
|
|
Karsten Hopp |
3d1a0d |
&& clen != 0
|
|
Karsten Hopp |
3d1a0d |
&& (ireg_maxcol == 0
|
|
Karsten Hopp |
3d1a0d |
--- 4563,4569 ----
|
|
Karsten Hopp |
3d1a0d |
* Unless "endp" is not NULL, then we match the end position.
|
|
Karsten Hopp |
3d1a0d |
* Also don't start a match past the first line. */
|
|
Karsten Hopp |
3d1a0d |
if (nfa_match == FALSE
|
|
Karsten Hopp |
3d1a0d |
! && ((start->c == NFA_MOPEN
|
|
Karsten Hopp |
3d1a0d |
&& reglnum == 0
|
|
Karsten Hopp |
3d1a0d |
&& clen != 0
|
|
Karsten Hopp |
3d1a0d |
&& (ireg_maxcol == 0
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4305,4322 ****
|
|
Karsten Hopp |
3d1a0d |
* Returns 0 for failure, number of lines contained in the match otherwise.
|
|
Karsten Hopp |
3d1a0d |
*/
|
|
Karsten Hopp |
3d1a0d |
static long
|
|
Karsten Hopp |
3d1a0d |
! nfa_regtry(start, col)
|
|
Karsten Hopp |
3d1a0d |
! nfa_state_T *start;
|
|
Karsten Hopp |
3d1a0d |
! colnr_T col;
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int i;
|
|
Karsten Hopp |
3d1a0d |
! regsub_T sub, m;
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
FILE *f;
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
reginput = regline + col;
|
|
Karsten Hopp |
3d1a0d |
need_clear_subexpr = TRUE;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
f = fopen(NFA_REGEXP_RUN_LOG, "a");
|
|
Karsten Hopp |
3d1a0d |
--- 4630,4653 ----
|
|
Karsten Hopp |
3d1a0d |
* Returns 0 for failure, number of lines contained in the match otherwise.
|
|
Karsten Hopp |
3d1a0d |
*/
|
|
Karsten Hopp |
3d1a0d |
static long
|
|
Karsten Hopp |
3d1a0d |
! nfa_regtry(prog, col)
|
|
Karsten Hopp |
3d1a0d |
! nfa_regprog_T *prog;
|
|
Karsten Hopp |
3d1a0d |
! colnr_T col;
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
int i;
|
|
Karsten Hopp |
3d1a0d |
! regsubs_T subs, m;
|
|
Karsten Hopp |
3d1a0d |
! nfa_state_T *start = prog->start;
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
FILE *f;
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
reginput = regline + col;
|
|
Karsten Hopp |
3d1a0d |
need_clear_subexpr = TRUE;
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ /* Clear the external match subpointers if necessary. */
|
|
Karsten Hopp |
3d1a0d |
+ if (prog->reghasz == REX_SET)
|
|
Karsten Hopp |
3d1a0d |
+ need_clear_zsubexpr = TRUE;
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
#ifdef ENABLE_LOG
|
|
Karsten Hopp |
3d1a0d |
f = fopen(NFA_REGEXP_RUN_LOG, "a");
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4337,4366 ****
|
|
Karsten Hopp |
3d1a0d |
EMSG(_("Could not open temporary log file for writing "));
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! /* Use 0xff to set lnum to -1 */
|
|
Karsten Hopp |
3d1a0d |
! vim_memset(sub.list.multi, 0xff, sizeof(struct multipos) * nfa_nsubexpr);
|
|
Karsten Hopp |
3d1a0d |
! vim_memset(m.list.multi, 0xff, sizeof(struct multipos) * nfa_nsubexpr);
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
! else
|
|
Karsten Hopp |
3d1a0d |
! {
|
|
Karsten Hopp |
3d1a0d |
! vim_memset(sub.list.line, 0, sizeof(struct linepos) * nfa_nsubexpr);
|
|
Karsten Hopp |
3d1a0d |
! vim_memset(m.list.line, 0, sizeof(struct linepos) * nfa_nsubexpr);
|
|
Karsten Hopp |
3d1a0d |
! }
|
|
Karsten Hopp |
3d1a0d |
! sub.in_use = 0;
|
|
Karsten Hopp |
3d1a0d |
! m.in_use = 0;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! if (nfa_regmatch(start, &sub, &m, NULL) == FALSE)
|
|
Karsten Hopp |
3d1a0d |
return 0;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
cleanup_subexpr();
|
|
Karsten Hopp |
3d1a0d |
if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! for (i = 0; i < sub.in_use; i++)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! reg_startpos[i] = sub.list.multi[i].start;
|
|
Karsten Hopp |
3d1a0d |
! reg_endpos[i] = sub.list.multi[i].end;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
if (reg_startpos[0].lnum < 0)
|
|
Karsten Hopp |
3d1a0d |
--- 4668,4690 ----
|
|
Karsten Hopp |
3d1a0d |
EMSG(_("Could not open temporary log file for writing "));
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! clear_sub(&subs.norm);
|
|
Karsten Hopp |
3d1a0d |
! clear_sub(&m.norm);
|
|
Karsten Hopp |
3d1a0d |
! #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
! clear_sub(&subs.synt);
|
|
Karsten Hopp |
3d1a0d |
! clear_sub(&m.synt);
|
|
Karsten Hopp |
3d1a0d |
! #endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! if (nfa_regmatch(start, &subs, &m, NULL) == FALSE)
|
|
Karsten Hopp |
3d1a0d |
return 0;
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
cleanup_subexpr();
|
|
Karsten Hopp |
3d1a0d |
if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! for (i = 0; i < subs.norm.in_use; i++)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! reg_startpos[i] = subs.norm.list.multi[i].start;
|
|
Karsten Hopp |
3d1a0d |
! reg_endpos[i] = subs.norm.list.multi[i].end;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
if (reg_startpos[0].lnum < 0)
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4380,4389 ****
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! for (i = 0; i < sub.in_use; i++)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! reg_startp[i] = sub.list.line[i].start;
|
|
Karsten Hopp |
3d1a0d |
! reg_endp[i] = sub.list.line[i].end;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
if (reg_startp[0] == NULL)
|
|
Karsten Hopp |
3d1a0d |
--- 4704,4713 ----
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
else
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! for (i = 0; i < subs.norm.in_use; i++)
|
|
Karsten Hopp |
3d1a0d |
{
|
|
Karsten Hopp |
3d1a0d |
! reg_startp[i] = subs.norm.list.line[i].start;
|
|
Karsten Hopp |
3d1a0d |
! reg_endp[i] = subs.norm.list.line[i].end;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
if (reg_startp[0] == NULL)
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4392,4397 ****
|
|
Karsten Hopp |
3d1a0d |
--- 4716,4758 ----
|
|
Karsten Hopp |
3d1a0d |
reg_endp[0] = reginput;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ /* Package any found \z(...\) matches for export. Default is none. */
|
|
Karsten Hopp |
3d1a0d |
+ unref_extmatch(re_extmatch_out);
|
|
Karsten Hopp |
3d1a0d |
+ re_extmatch_out = NULL;
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
+ if (prog->reghasz == REX_SET)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ int i;
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
+ cleanup_zsubexpr();
|
|
Karsten Hopp |
3d1a0d |
+ re_extmatch_out = make_extmatch();
|
|
Karsten Hopp |
3d1a0d |
+ for (i = 0; i < subs.synt.in_use; i++)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ if (REG_MULTI)
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ struct multipos *mpos = &subs.synt.list.multi[i];
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
+ /* Only accept single line matches. */
|
|
Karsten Hopp |
3d1a0d |
+ if (mpos->start.lnum >= 0 && mpos->start.lnum == mpos->end.lnum)
|
|
Karsten Hopp |
3d1a0d |
+ re_extmatch_out->matches[i] =
|
|
Karsten Hopp |
3d1a0d |
+ vim_strnsave(reg_getline(mpos->start.lnum)
|
|
Karsten Hopp |
3d1a0d |
+ + mpos->start.col,
|
|
Karsten Hopp |
3d1a0d |
+ mpos->end.col - mpos->start.col);
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ else
|
|
Karsten Hopp |
3d1a0d |
+ {
|
|
Karsten Hopp |
3d1a0d |
+ struct linepos *lpos = &subs.synt.list.line[i];
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
+ if (lpos->start != NULL && lpos->end != NULL)
|
|
Karsten Hopp |
3d1a0d |
+ re_extmatch_out->matches[i] =
|
|
Karsten Hopp |
3d1a0d |
+ vim_strnsave(lpos->start,
|
|
Karsten Hopp |
3d1a0d |
+ (int)(lpos->end - lpos->start));
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ }
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
+
|
|
Karsten Hopp |
3d1a0d |
return 1 + reglnum;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4461,4467 ****
|
|
Karsten Hopp |
3d1a0d |
prog->state[i].lastlist = 0;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! retval = nfa_regtry(prog->start, col);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
theend:
|
|
Karsten Hopp |
3d1a0d |
return retval;
|
|
Karsten Hopp |
3d1a0d |
--- 4822,4828 ----
|
|
Karsten Hopp |
3d1a0d |
prog->state[i].lastlist = 0;
|
|
Karsten Hopp |
3d1a0d |
}
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
! retval = nfa_regtry(prog, col);
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
theend:
|
|
Karsten Hopp |
3d1a0d |
return retval;
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 4552,4557 ****
|
|
Karsten Hopp |
3d1a0d |
--- 4913,4922 ----
|
|
Karsten Hopp |
3d1a0d |
nfa_postfix_dump(expr, OK);
|
|
Karsten Hopp |
3d1a0d |
nfa_dump(prog);
|
|
Karsten Hopp |
3d1a0d |
#endif
|
|
Karsten Hopp |
3d1a0d |
+ #ifdef FEAT_SYN_HL
|
|
Karsten Hopp |
3d1a0d |
+ /* Remember whether this pattern has any \z specials in it. */
|
|
Karsten Hopp |
3d1a0d |
+ prog->reghasz = re_has_z;
|
|
Karsten Hopp |
3d1a0d |
+ #endif
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
out:
|
|
Karsten Hopp |
3d1a0d |
vim_free(post_start);
|
|
Karsten Hopp |
3d1a0d |
*** ../vim-7.3.1089/src/version.c 2013-06-01 20:32:09.000000000 +0200
|
|
Karsten Hopp |
3d1a0d |
--- src/version.c 2013-06-01 22:29:51.000000000 +0200
|
|
Karsten Hopp |
3d1a0d |
***************
|
|
Karsten Hopp |
3d1a0d |
*** 730,731 ****
|
|
Karsten Hopp |
3d1a0d |
--- 730,733 ----
|
|
Karsten Hopp |
3d1a0d |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
3d1a0d |
+ /**/
|
|
Karsten Hopp |
3d1a0d |
+ 1090,
|
|
Karsten Hopp |
3d1a0d |
/**/
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
--
|
|
Karsten Hopp |
3d1a0d |
Despite the cost of living, have you noticed how it remains so popular?
|
|
Karsten Hopp |
3d1a0d |
|
|
Karsten Hopp |
3d1a0d |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
3d1a0d |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
3d1a0d |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
3d1a0d |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|