mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* re.c (rb_reg_to_s): remove redundant shy group.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8c3157e43f
commit
e7daa72a6a
2 changed files with 10 additions and 20 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Fri Apr 19 14:57:44 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||||
|
|
||||||
|
* re.c (rb_reg_to_s): remove redundant shy group.
|
||||||
|
|
||||||
Fri Apr 19 01:08:20 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Fri Apr 19 01:08:20 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_thread_cleanup): current thread may be THREAD_STOPPED,
|
* eval.c (rb_thread_cleanup): current thread may be THREAD_STOPPED,
|
||||||
|
|
26
re.c
26
re.c
|
@ -368,7 +368,7 @@ rb_reg_to_s(re)
|
||||||
ptr = RREGEXP(re)->str;
|
ptr = RREGEXP(re)->str;
|
||||||
len = RREGEXP(re)->len;
|
len = RREGEXP(re)->len;
|
||||||
if (len >= 4 && ptr[0] == '(' && ptr[1] == '?' && ptr[len-1] == ')') {
|
if (len >= 4 && ptr[0] == '(' && ptr[1] == '?' && ptr[len-1] == ')') {
|
||||||
int nest = 0;
|
int err = 1;
|
||||||
ptr += 2;
|
ptr += 2;
|
||||||
if ((len -= 3) > 0) {
|
if ((len -= 3) > 0) {
|
||||||
do {
|
do {
|
||||||
|
@ -403,28 +403,14 @@ rb_reg_to_s(re)
|
||||||
} while (--len > 0);
|
} while (--len > 0);
|
||||||
}
|
}
|
||||||
if (*ptr == ':') {
|
if (*ptr == ':') {
|
||||||
const char* p = ++ptr;
|
Regexp *rp = ALLOC(Regexp);
|
||||||
long l = --len;
|
MEMZERO((char *)rp, Regexp, 1);
|
||||||
kcode_set_option(re);
|
kcode_set_option(re);
|
||||||
while (len > 0) {
|
err = re_compile_pattern(++ptr, --len, rp) != 0;
|
||||||
int n;
|
|
||||||
if (*p == '(') {
|
|
||||||
++nest;
|
|
||||||
}
|
|
||||||
else if (*p == ')') {
|
|
||||||
if (--nest < 0) break;
|
|
||||||
}
|
|
||||||
else if (*p == '\\') {
|
|
||||||
--l;
|
|
||||||
++p;
|
|
||||||
}
|
|
||||||
n = mbclen(*p);
|
|
||||||
l -= n;
|
|
||||||
p += n;
|
|
||||||
}
|
|
||||||
kcode_reset_option();
|
kcode_reset_option();
|
||||||
|
re_free_pattern(rp);
|
||||||
}
|
}
|
||||||
if (nest) {
|
if (err) {
|
||||||
options = RREGEXP(re)->ptr->options;
|
options = RREGEXP(re)->ptr->options;
|
||||||
ptr = RREGEXP(re)->str;
|
ptr = RREGEXP(re)->str;
|
||||||
len = RREGEXP(re)->len;
|
len = RREGEXP(re)->len;
|
||||||
|
|
Loading…
Reference in a new issue