mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* regex.c (re_compile_pattern): should not translate character
class range edge. [ruby-list:38393] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a59f05a455
commit
12196ee24f
3 changed files with 31 additions and 13 deletions
|
@ -2,6 +2,11 @@ Mon Sep 16 22:25:06 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||||
|
|
||||||
* test/csv/test_csv.rb: add negative tests of row_sep.
|
* test/csv/test_csv.rb: add negative tests of row_sep.
|
||||||
|
|
||||||
|
Tue Sep 16 18:02:36 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* regex.c (re_compile_pattern): should not translate character
|
||||||
|
class range edge. [ruby-list:38393]
|
||||||
|
|
||||||
Tue Sep 16 16:47:56 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
Tue Sep 16 16:47:56 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* MANIFEST: add test/csv/mac.csv.
|
* MANIFEST: add test/csv/mac.csv.
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
|
# open3.rb: Spawn a program like popen, but with stderr, too. You might also
|
||||||
|
# want to use this if you want to bypass the shell. (By passing multiple args,
|
||||||
|
# with IO#popen does not allow)
|
||||||
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# require "open3"
|
# require "open3"
|
||||||
#
|
#
|
||||||
# in, out, err = Open3.popen3('nroff -man')
|
# stdin, stdout, stderr = Open3.popen3('nroff -man')
|
||||||
# or
|
# or
|
||||||
# include Open3
|
# include Open3
|
||||||
# in, out, err = popen3('nroff -man')
|
# stdin, stdout, stderr = popen3('nroff -man')
|
||||||
#
|
|
||||||
|
|
||||||
module Open3
|
module Open3
|
||||||
#[stdin, stdout, stderr] = popen3(command);
|
#[stdin, stdout, stderr] = popen3(command);
|
||||||
|
|
30
regex.c
30
regex.c
|
@ -1464,7 +1464,7 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
if (range && had_char_class) {
|
if (range && had_char_class) {
|
||||||
FREE_AND_RETURN(stackb, "invalid regular expression; can't use character class as an end value of range");
|
FREE_AND_RETURN(stackb, "invalid regular expression; can't use character class as an end value of range");
|
||||||
}
|
}
|
||||||
PATFETCH(c);
|
PATFETCH_RAW(c);
|
||||||
|
|
||||||
if (c == ']') {
|
if (c == ']') {
|
||||||
if (p == p0 + 1) {
|
if (p == p0 + 1) {
|
||||||
|
@ -1608,7 +1608,7 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
FREE_AND_RETURN(stackb, "invalid regular expression; re can't end '[[:'");
|
FREE_AND_RETURN(stackb, "invalid regular expression; re can't end '[[:'");
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
PATFETCH (c);
|
PATFETCH_RAW(c);
|
||||||
if (c == ':' || c == ']' || p == pend
|
if (c == ':' || c == ']' || p == pend
|
||||||
|| c1 == CHAR_CLASS_MAX_LENGTH)
|
|| c1 == CHAR_CLASS_MAX_LENGTH)
|
||||||
break;
|
break;
|
||||||
|
@ -1680,8 +1680,14 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
|
|
||||||
range = 0;
|
range = 0;
|
||||||
if (had_mbchar == 0) {
|
if (had_mbchar == 0) {
|
||||||
for (;last<=c;last++)
|
if (TRANSLATE_P()) {
|
||||||
SET_LIST_BIT(last);
|
for (;last<=c;last++)
|
||||||
|
SET_LIST_BIT(translate[last]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (;last<=c;last++)
|
||||||
|
SET_LIST_BIT(last);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (had_mbchar == 2) {
|
else if (had_mbchar == 2) {
|
||||||
set_list_bits(last, c, b);
|
set_list_bits(last, c, b);
|
||||||
|
@ -1693,16 +1699,20 @@ re_compile_pattern(pattern, size, bufp)
|
||||||
}
|
}
|
||||||
else if (p[0] == '-' && p[1] != ']') {
|
else if (p[0] == '-' && p[1] != ']') {
|
||||||
last = c;
|
last = c;
|
||||||
PATFETCH(c1);
|
PATFETCH_RAW(c1);
|
||||||
range = 1;
|
range = 1;
|
||||||
goto range_retry;
|
goto range_retry;
|
||||||
}
|
}
|
||||||
else if (had_mbchar == 0 && (!current_mbctype || !had_num_literal)) {
|
else {
|
||||||
SET_LIST_BIT(c);
|
if (TRANSLATE_P()) c = (unsigned char)translate[c];
|
||||||
had_num_literal = 0;
|
if (had_mbchar == 0 && (!current_mbctype || !had_num_literal)) {
|
||||||
|
SET_LIST_BIT(c);
|
||||||
|
had_num_literal = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
set_list_bits(c, c, b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
set_list_bits(c, c, b);
|
|
||||||
had_mbchar = 0;
|
had_mbchar = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue