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

ruby-changes:16652

From: naruse <ko1@a...>
Date: Thu, 15 Jul 2010 15:55:58 +0900 (JST)
Subject: [ruby-changes:16652] Ruby:r28648 (trunk): * regexec.c (onig_search): don't skip non-ANYCHARs when

naruse	2010-07-15 15:55:42 +0900 (Thu, 15 Jul 2010)

  New Revision: 28648

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

  Log:
    * regexec.c (onig_search): don't skip non-ANYCHARs when
      .* fails to match. This causes to fail matching
      ANYCHAR_STAR with LOOK_BEHIND. This fix is workaround
      and disable the optimization. [ruby-dev:41851]

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 28647)
+++ ChangeLog	(revision 28648)
@@ -1,3 +1,10 @@
+Thu Jul 15 15:47:32 2010  NARUSE, Yui  <naruse@r...>
+
+	* regexec.c (onig_search): don't skip non-ANYCHARs when
+	  .* fails to match. This causes to fail matching
+	  ANYCHAR_STAR with LOOK_BEHIND. This fix is workaround
+	  and disable the optimization. [ruby-dev:41851]
+
 Thu Jul 15 06:11:29 2010  Aaron Patterson <aaron@t...>
 
 	* lib/rdoc/markup/attribute_manager.rb: fixing ri output when special
Index: regexec.c
===================================================================
--- regexec.c	(revision 28647)
+++ regexec.c	(revision 28648)
@@ -3636,11 +3636,6 @@
             MATCH_AND_RETURN_CHECK(orig_range);
             prev = s;
             s += enclen(reg->enc, s, end);
-
-            while (!ONIGENC_IS_MBC_NEWLINE(reg->enc, prev, end) && s < range) {
-              prev = s;
-              s += enclen(reg->enc, s, end);
-            }
           } while (s < range);
           goto mismatch;
         }
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 28647)
+++ test/ruby/test_regexp.rb	(revision 28648)
@@ -11,6 +11,11 @@
     $VERBOSE = @verbose
   end
 
+  def test_ruby_dev_999
+    assert_match(/(?<=a).*b/, "aab")
+    assert_match(/(?<=\u3042).*b/, "\u3042ab")
+  end
+
   def test_ruby_core_27247
     assert_match(/(a){2}z/, "aaz")
   end

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

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