* regex.c (re_match_exec): fix odd \G behavior based on the patch
from Nobu. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
25fa63dc04
commit
1b07582fcc
@ -1,3 +1,8 @@
|
|||||||
|
Wed Dec 25 16:41:16 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* regex.c (re_match_exec): fix odd \G behavior based on the patch
|
||||||
|
from Nobu.
|
||||||
|
|
||||||
Wed Dec 25 11:05:11 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
Wed Dec 25 11:05:11 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||||
|
|
||||||
* bcc32/setup.mak (-generic-): removed garbages.
|
* bcc32/setup.mak (-generic-): removed garbages.
|
||||||
|
19
regex.c
19
regex.c
@ -3089,6 +3089,9 @@ re_adjust_startpos(bufp, string, size, startpos, range)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int re_match_exec _((struct re_pattern_buffer *, const char *, int, int, int,
|
||||||
|
struct re_registers *));
|
||||||
|
|
||||||
/* Using the compiled pattern in BUFP->buffer, first tries to match
|
/* Using the compiled pattern in BUFP->buffer, first tries to match
|
||||||
STRING, starting first at index STARTPOS, then at STARTPOS + 1, and
|
STRING, starting first at index STARTPOS, then at STARTPOS + 1, and
|
||||||
so on. RANGE is the number of places to try before giving up. If
|
so on. RANGE is the number of places to try before giving up. If
|
||||||
@ -3109,7 +3112,7 @@ re_search(bufp, string, size, startpos, range, regs)
|
|||||||
struct re_registers *regs;
|
struct re_registers *regs;
|
||||||
{
|
{
|
||||||
register char *fastmap = bufp->fastmap;
|
register char *fastmap = bufp->fastmap;
|
||||||
int val, anchor = 0;
|
int val, anchor = 0, initpos = startpos;
|
||||||
|
|
||||||
/* Check for out-of-range starting position. */
|
/* Check for out-of-range starting position. */
|
||||||
if (startpos < 0 || startpos > size)
|
if (startpos < 0 || startpos > size)
|
||||||
@ -3238,7 +3241,7 @@ re_search(bufp, string, size, startpos, range, regs)
|
|||||||
if (startpos > size) return -1;
|
if (startpos > size) return -1;
|
||||||
if ((anchor || !bufp->can_be_null) && range > 0 && size > 0 && startpos == size)
|
if ((anchor || !bufp->can_be_null) && range > 0 && size > 0 && startpos == size)
|
||||||
return -1;
|
return -1;
|
||||||
val = re_match(bufp, string, size, startpos, regs);
|
val = re_match_exec(bufp, string, size, startpos, initpos, regs);
|
||||||
if (val >= 0) return startpos;
|
if (val >= 0) return startpos;
|
||||||
if (val == -2) return -2;
|
if (val == -2) return -2;
|
||||||
|
|
||||||
@ -3472,6 +3475,16 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||||||
const char *string_arg;
|
const char *string_arg;
|
||||||
int size, pos;
|
int size, pos;
|
||||||
struct re_registers *regs;
|
struct re_registers *regs;
|
||||||
|
{
|
||||||
|
return re_match_exec(bufp, string_arg, size, pos, 0, regs);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
re_match_exec(bufp, string_arg, size, pos, beg, regs)
|
||||||
|
struct re_pattern_buffer *bufp;
|
||||||
|
const char *string_arg;
|
||||||
|
int size, pos, beg;
|
||||||
|
struct re_registers *regs;
|
||||||
{
|
{
|
||||||
register unsigned char *p = (unsigned char*)bufp->buffer;
|
register unsigned char *p = (unsigned char*)bufp->buffer;
|
||||||
unsigned char *p1;
|
unsigned char *p1;
|
||||||
@ -3884,7 +3897,7 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||||||
|
|
||||||
/* Match at the starting position. */
|
/* Match at the starting position. */
|
||||||
case begpos:
|
case begpos:
|
||||||
if (d - string == pos)
|
if (d - string == beg)
|
||||||
break;
|
break;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#define RUBY_VERSION "1.8.0"
|
#define RUBY_VERSION "1.8.0"
|
||||||
#define RUBY_RELEASE_DATE "2002-12-24"
|
#define RUBY_RELEASE_DATE "2002-12-25"
|
||||||
#define RUBY_VERSION_CODE 180
|
#define RUBY_VERSION_CODE 180
|
||||||
#define RUBY_RELEASE_CODE 20021224
|
#define RUBY_RELEASE_CODE 20021225
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
#define RUBY_VERSION_MINOR 8
|
#define RUBY_VERSION_MINOR 8
|
||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2002
|
#define RUBY_RELEASE_YEAR 2002
|
||||||
#define RUBY_RELEASE_MONTH 12
|
#define RUBY_RELEASE_MONTH 12
|
||||||
#define RUBY_RELEASE_DAY 24
|
#define RUBY_RELEASE_DAY 25
|
||||||
|
Loading…
x
Reference in New Issue
Block a user