mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
extended regexp bug fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
15281f2e23
commit
ae08a031a6
3 changed files with 10 additions and 6 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Wed Mar 18 17:46:31 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
|
* regex.c (re_match): forwading failure point popped too much.
|
||||||
|
|
||||||
Tue Mar 17 18:23:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
Tue Mar 17 18:23:06 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||||
|
|
||||||
* math.c (math_frexp): newly added.
|
* math.c (math_frexp): newly added.
|
||||||
|
|
6
regex.c
6
regex.c
|
@ -1848,7 +1848,7 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
|
|
||||||
c1 = 0;
|
c1 = 0;
|
||||||
GET_UNSIGNED_NUMBER(c1);
|
GET_UNSIGNED_NUMBER(c1);
|
||||||
if (p < pend) PATUNFETCH;
|
if (!ISDIGIT(c)) PATUNFETCH;
|
||||||
|
|
||||||
if (c1 >= regnum) {
|
if (c1 >= regnum) {
|
||||||
/* need to get octal */
|
/* need to get octal */
|
||||||
|
@ -2892,6 +2892,8 @@ re_match(bufp, string_arg, size, pos, regs)
|
||||||
/* If not end of string, try backtracking. Otherwise done. */
|
/* If not end of string, try backtracking. Otherwise done. */
|
||||||
if (d != dend)
|
if (d != dend)
|
||||||
{
|
{
|
||||||
|
while (stackp != stackb && (int)stackp[-1] == 1)
|
||||||
|
POP_FAILURE_POINT();
|
||||||
if (stackp != stackb)
|
if (stackp != stackb)
|
||||||
{
|
{
|
||||||
/* More failure points to try. */
|
/* More failure points to try. */
|
||||||
|
@ -3419,8 +3421,6 @@ re_match(bufp, string_arg, size, pos, regs)
|
||||||
SET_REGS_MATCHED;
|
SET_REGS_MATCHED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (stackp != stackb && (int)stackp[-1] == 1)
|
|
||||||
POP_FAILURE_POINT();
|
|
||||||
continue; /* Successfully executed one pattern command; keep going. */
|
continue; /* Successfully executed one pattern command; keep going. */
|
||||||
|
|
||||||
/* Jump here if any matching operation fails. */
|
/* Jump here if any matching operation fails. */
|
||||||
|
|
|
@ -120,7 +120,7 @@ $bad = false
|
||||||
tmp = open("while_tmp", "r")
|
tmp = open("while_tmp", "r")
|
||||||
while tmp.gets()
|
while tmp.gets()
|
||||||
if gsub!('vt100', 'VT100')
|
if gsub!('vt100', 'VT100')
|
||||||
p gsub!('VT100', 'Vt100')
|
gsub!('VT100', 'Vt100')
|
||||||
redo;
|
redo;
|
||||||
end
|
end
|
||||||
$bad = 1 if /vt100/;
|
$bad = 1 if /vt100/;
|
||||||
|
@ -296,7 +296,7 @@ ok(defined? "a".chomp)
|
||||||
ok("abc".scan(/./) == ["a", "b", "c"])
|
ok("abc".scan(/./) == ["a", "b", "c"])
|
||||||
ok("1a2b3c".scan(/(\d.)/) == [["1a"], ["2b"], ["3c"]])
|
ok("1a2b3c".scan(/(\d.)/) == [["1a"], ["2b"], ["3c"]])
|
||||||
# non-greedy match
|
# non-greedy match
|
||||||
ok("a=12;b=22".scan(/(.*?)=(\d*?);?/) == [["a", "12"], ["b", "22"]])
|
ok("a=12;b=22".scan(/(.*?)=(\d*);?/) == [["a", "12"], ["b", "22"]])
|
||||||
|
|
||||||
$x = [1]
|
$x = [1]
|
||||||
ok(($x * 5).join(":") == '1:1:1:1:1')
|
ok(($x * 5).join(":") == '1:1:1:1:1')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue