[前][次][番号順一覧][スレッド一覧]

ruby-changes:12818

From: naruse <ko1@a...>
Date: Sun, 16 Aug 2009 01:28:18 +0900 (JST)
Subject: [ruby-changes:12818] Ruby:r24546 (trunk): * regparse.c (add_ctype_to_cc_by_range): fix the first

naruse	2009-08-16 01:27:13 +0900 (Sun, 16 Aug 2009)

  New Revision: 24546

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24546

  Log:
    * regparse.c (add_ctype_to_cc_by_range): fix the first
      character bigger than sb_out was dropped.
    * test/ruby/test_regexp.rb (TestRegexp#test_posix_bracket):
      add tests for above.

  Modified files:
    trunk/ChangeLog
    trunk/regparse.c
    trunk/test/ruby/test_regexp.rb

Index: regparse.c
===================================================================
--- regparse.c	(revision 24545)
+++ regparse.c	(revision 24546)
@@ -3797,8 +3797,7 @@
       for (j  = ONIGENC_CODE_RANGE_FROM(mbr, i);
            j <= ONIGENC_CODE_RANGE_TO(mbr, i); j++) {
 	if (j >= sb_out) {
-	  if (j == ONIGENC_CODE_RANGE_TO(mbr, i)) i++;
-	  else if (j > ONIGENC_CODE_RANGE_FROM(mbr, i)) {
+	  if (j > ONIGENC_CODE_RANGE_FROM(mbr, i)) {
 	    r = add_code_range_to_buf(&(cc->mbuf), env, j,
 				      ONIGENC_CODE_RANGE_TO(mbr, i));
 	    if (r != 0) return r;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 24545)
+++ ChangeLog	(revision 24546)
@@ -1,3 +1,11 @@
+Sun Aug 16 01:10:00 2009  NARUSE, Yui  <naruse@r...>
+
+	* regparse.c (add_ctype_to_cc_by_range): fix the first
+	  character bigger than sb_out was dropped.
+
+	* test/ruby/test_regexp.rb (TestRegexp#test_posix_bracket):
+	  add tests for above.
+
 Sun Aug 16 00:30:33 2009  NARUSE, Yui  <naruse@r...>
 
 	* include/ruby/oniguruma.h
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 24545)
+++ test/ruby/test_regexp.rb	(revision 24546)
@@ -684,6 +684,12 @@
     failcheck('[[:alpha')
     failcheck('[[:alpha:')
     failcheck('[[:alp:]]')
+
+    assert_match(/\A[[:digit:]]+\z/, "\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19")
+    assert_match(/\A[[:alnum:]]+\z/, "\uff10\uff19\uff41\uff5a\uff21\uff3a")
+    assert_match(/\A[[:space:]]+\z/, "\r\n\v\f\r\s\u0085")
+    assert_match(/\A[[:ascii:]]+\z/, "\x00\x7F")
+    assert_no_match(/[[:ascii:]]/, "\x80\xFF")
   end
 
   def test_backward

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]