ruby-changes:16065
From: naruse <ko1@a...>
Date: Wed, 26 May 2010 00:12:32 +0900 (JST)
Subject: [ruby-changes:16065] Ruby:r28013 (trunk): * regparse.c (add_code_range_to_buf0): fix false negative
naruse 2010-05-26 00:12:19 +0900 (Wed, 26 May 2010) New Revision: 28013 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28013 Log: * regparse.c (add_code_range_to_buf0): fix false negative warning when given range is just before previous range. [ruby-dev:41406] Modified files: trunk/ChangeLog trunk/regparse.c trunk/test/ruby/test_regexp.rb Index: regparse.c =================================================================== --- regparse.c (revision 28012) +++ regparse.c (revision 28013) @@ -1750,12 +1750,11 @@ return ONIGERR_TOO_MANY_MULTI_BYTE_RANGES; if (inc_n != 1) { + if (checkdup && to >= data[low*2]) CC_DUP_WARN(env); if (from > data[low*2]) from = data[low*2]; - else if (checkdup) CC_DUP_WARN(env); if (to < data[(high - 1)*2 + 1]) to = data[(high - 1)*2 + 1]; - else if (checkdup) CC_DUP_WARN(env); } if (inc_n != 0 && (OnigCodePoint )high < n) { Index: ChangeLog =================================================================== --- ChangeLog (revision 28012) +++ ChangeLog (revision 28013) @@ -1,3 +1,9 @@ +Tue May 25 14:00:51 2010 NARUSE, Yui <naruse@r...> + + * regparse.c (add_code_range_to_buf0): fix false negative + warning when given range is just before previous range. + [ruby-dev:41406] + Tue May 25 16:37:39 2010 Nobuyoshi Nakada <nobu@r...> * misc/ruby-style.el (ruby-style-version): take revision if Index: test/ruby/test_regexp.rb =================================================================== --- test/ruby/test_regexp.rb (revision 28012) +++ test/ruby/test_regexp.rb (revision 28013) @@ -1,4 +1,5 @@ require 'test/unit' +require_relative 'envutil' class TestRegexp < Test::Unit::TestCase def setup @@ -816,4 +817,10 @@ bug2547 = '[ruby-core:27374]' assert_raise(SyntaxError, bug2547) {eval('/#{"\\\\"}y/')} end + + def test_dup_warn + assert_in_out_err('-w', 'x=/[\u3042\u3041]/', [], /\A\z/) + assert_in_out_err('-w', 'x=/[\u3042\u3042]/', [], /duplicated/) + assert_in_out_err('-w', 'x=/[\u3042\u3041-\u3043]/', [], /duplicated/) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/