summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-26 17:28:37 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-26 17:28:37 +0000
commit660a3298f5f19c136b530789c63ac2f6d422d771 (patch)
tree05247cc59a4f329acde9b1bfb4dc4b015580020d
parent331d6b341817370d51bf21a4ea74d59fed828c4d (diff)
merge revision(s) 34821:
* regparse.c (add_code_range_to_buf0): wrong condition of duplicated warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--regparse.c7
-rw-r--r--test/ruby/test_regexp.rb17
-rw-r--r--version.h6
4 files changed, 26 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 603769b6ea..2a24f138f8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Feb 27 02:28:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regparse.c (add_code_range_to_buf0): wrong condition of duplicated
+ warnings.
+
Sun Feb 26 12:26:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* compile.c (iseq_compile_each): call on special object instead of
diff --git a/regparse.c b/regparse.c
index b3f34b03f2..1489f0e58d 100644
--- a/regparse.c
+++ b/regparse.c
@@ -1744,13 +1744,18 @@ add_code_range_to_buf0(BBuf** pbuf, ScanEnv* env, OnigCodePoint from, OnigCodePo
else
bound = x;
}
+ /* data[(low-1)*2+1] << from <= data[low*2]
+ * data[(high-1)*2+1] <= to << data[high*2]
+ */
inc_n = low + 1 - high;
if (n + inc_n > ONIG_MAX_MULTI_BYTE_RANGES_NUM)
return ONIGERR_TOO_MANY_MULTI_BYTE_RANGES;
if (inc_n != 1) {
- if (checkdup && to >= data[low*2]) CC_DUP_WARN(env);
+ if (checkdup && from <= data[low*2+1]
+ && (data[low*2] <= from || data[low*2+1] <= to))
+ CC_DUP_WARN(env);
if (from > data[low*2])
from = data[low*2];
if (to < data[(high - 1)*2 + 1])
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 9626f61eb3..3c1662efba 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -843,11 +843,18 @@ class TestRegexp < Test::Unit::TestCase
end
def test_dup_warn
- assert_in_out_err(%w/-w -U/, "#coding:utf-8\nx=/[\u3042\u3041]/\n!x", [], [])
- assert_in_out_err(%w/-w -U/, "#coding:utf-8\nx=/[\u3042\u3042]/\n!x", [], /duplicated/u, nil,
- encoding: Encoding::UTF_8)
- assert_in_out_err(%w/-w -U/, "#coding:utf-8\nx=/[\u3042\u3041-\u3043]/\n!x", [], /duplicated/u, nil,
- encoding: Encoding::UTF_8)
+ assert_warn(/duplicated/) { Regexp.new('[\u3042\u3043\u3042]') }
+ assert_warn(/duplicated/) { Regexp.new('[\u3042\u3043\u3043]') }
+ assert_warn(/\A\z/) { Regexp.new('[\u3042\u3044\u3043]') }
+ assert_warn(/\A\z/) { Regexp.new('[\u3042\u3045\u3043]') }
+ assert_warn(/\A\z/) { Regexp.new('[\u3042\u3045\u3044]') }
+ assert_warn(/\A\z/) { Regexp.new('[\u3042\u3045\u3043-\u3044]') }
+ assert_warn(/duplicated/) { Regexp.new('[\u3042\u3045\u3042-\u3043]') }
+ assert_warn(/duplicated/) { Regexp.new('[\u3042\u3045\u3044-\u3045]') }
+ assert_warn(/\A\z/) { Regexp.new('[\u3042\u3046\u3044]') }
+ assert_warn(/duplicated/) { Regexp.new('[\u1000-\u2000\u3042-\u3046\u3044]') }
+ assert_warn(/duplicated/) { Regexp.new('[\u3044\u3041-\u3047]') }
+ assert_warn(/duplicated/) { Regexp.new('[\u3042\u3044\u3046\u3041-\u3047]') }
end
def test_property_warn
diff --git a/version.h b/version.h
index 7237f6a4d7..af20149bc7 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 150
+#define RUBY_PATCHLEVEL 151
-#define RUBY_RELEASE_DATE "2012-02-26"
+#define RUBY_RELEASE_DATE "2012-02-27"
#define RUBY_RELEASE_YEAR 2012
#define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 26
+#define RUBY_RELEASE_DAY 27
#include "ruby/version.h"