diff options
author | stanton <stanton> | 1999-06-02 01:53:29 (GMT) |
---|---|---|
committer | stanton <stanton> | 1999-06-02 01:53:29 (GMT) |
commit | 21c3baed52eba908b3e56f33f9d0f9541495616e (patch) | |
tree | 02591dac73223fda831014e215800dee4b75d811 /generic/tclRegexp.c | |
parent | a045db4812c23138a2f998a7f827f46a30558a79 (diff) | |
download | tcl-21c3baed52eba908b3e56f33f9d0f9541495616e.zip tcl-21c3baed52eba908b3e56f33f9d0f9541495616e.tar.gz tcl-21c3baed52eba908b3e56f33f9d0f9541495616e.tar.bz2 |
* tests/reg.test:
* generic/regc_color.c:
* generic/regc_cvec.c:
* generic/regc_lex.c:
* generic/regc_locale.c:
* generic/regc_nfa.c:
* generic/regcomp.c:
* generic/regcustom.h:
* generic/rege_dfa.c:
* generic/regerror.c:
* generic/regerrs.h:
* generic/regex.h:
* generic/regexec.c:
* generic/regfree.c:
* generic/regfronts.c:
* generic/regguts.h:
* generic/tclCmdMZ.c:
* generic/tclRegexp.c:
* generic/tclRegexp.h:
* generic/tclTest.c: Applied Henry Spencer's latest regexp patches
that fix an infinite loop bug and add support for testing whether
a string could match with additional input. [Bug: 2117]
Diffstat (limited to 'generic/tclRegexp.c')
-rw-r--r-- | generic/tclRegexp.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index 22e1db0..2318780 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclRegexp.c,v 1.5 1999/05/22 01:20:13 stanton Exp $ + * RCS: @(#) $Id: tclRegexp.c,v 1.6 1999/06/02 01:53:31 stanton Exp $ */ #include "tclInt.h" @@ -287,13 +287,14 @@ TclRegExpExecUniChar(interp, re, wString, numChars, nmatches, flags) { int status; TclRegexp *regexpPtr = (TclRegexp *) re; - size_t nm = regexpPtr->re.re_nsub + 1; + size_t last = regexpPtr->re.re_nsub + 1; + size_t nm = last; if (nmatches >= 0 && (size_t) nmatches < nm) nm = (size_t) nmatches; status = TclReExec(®expPtr->re, wString, (size_t) numChars, - (rm_detail_t *)NULL, nm, regexpPtr->matches, flags); + ®expPtr->details, nm, regexpPtr->matches, flags); /* * Check for errors. @@ -318,12 +319,13 @@ TclRegExpExecUniChar(interp, re, wString, numChars, nmatches, flags) * TclRegExpRangeUniChar -- * * Returns pointers describing the range of a regular expression match, - * or one of the subranges within the match. + * or one of the subranges within the match, or the hypothetical range + * represented by the rm_extend field of the rm_detail_t. * * Results: * The variables at *startPtr and *endPtr are modified to hold the - * addresses of the endpoints of the range given by index. If the - * specified range doesn't exist then NULLs are returned. + * offsets of the endpoints of the range given by index. If the + * specified range doesn't exist then -1s are supplied. * * Side effects: * None. @@ -337,7 +339,8 @@ TclRegExpRangeUniChar(re, index, startPtr, endPtr) * been passed to Tcl_RegExpExec. */ int index; /* 0 means give the range of the entire * match, > 0 means give the range of - * a matching subrange. */ + * a matching subrange, -1 means the + * range of the rm_extend field. */ int *startPtr; /* Store address of first character in * (sub-) range here. */ int *endPtr; /* Store address of character just after last @@ -345,7 +348,10 @@ TclRegExpRangeUniChar(re, index, startPtr, endPtr) { TclRegexp *regexpPtr = (TclRegexp *) re; - if ((size_t) index > regexpPtr->re.re_nsub) { + if ((regexpPtr->flags®_EXPECT) && index == -1) { + *startPtr = regexpPtr->details.rm_extend.rm_so; + *endPtr = regexpPtr->details.rm_extend.rm_eo; + } else if ((size_t) index > regexpPtr->re.re_nsub) { *startPtr = -1; *endPtr = -1; } else { |