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

ruby-changes:47457

From: nobu <ko1@a...>
Date: Fri, 11 Aug 2017 11:05:30 +0900 (JST)
Subject: [ruby-changes:47457] nobu:r59574 (trunk): re.c: options for sub-regexp

nobu	2017-08-11 11:05:24 +0900 (Fri, 11 Aug 2017)

  New Revision: 59574

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59574

  Log:
    re.c: options for sub-regexp
    
    * re.c (rb_reg_to_s): needs embedded options to check syntax of
      sub-regexp.  [ruby-core:82328] [Bug #13798]

  Modified files:
    trunk/re.c
    trunk/test/ruby/test_regexp.rb
Index: re.c
===================================================================
--- re.c	(revision 59573)
+++ re.c	(revision 59574)
@@ -606,7 +606,7 @@ rb_reg_to_s(VALUE re) https://github.com/ruby/ruby/blob/trunk/re.c#L606
 
 	    ++ptr;
 	    len -= 2;
-            err = onig_new(&rp, ptr, ptr + len, ONIG_OPTION_DEFAULT,
+            err = onig_new(&rp, ptr, ptr + len, options,
 			   enc, OnigDefaultSyntax, NULL);
 	    onig_free(rp);
 	    ruby_verbose = verbose;
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 59573)
+++ test/ruby/test_regexp.rb	(revision 59574)
@@ -74,6 +74,12 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L74
     end
   end
 
+  def test_to_s_extended_subexp
+    re = /#\g#{"\n"}/x
+    re = /#{re}/
+    assert_warn('', '[ruby-core:82328] [Bug #13798]') {re.to_s}
+  end
+
   def test_union
     assert_equal :ok, begin
       Regexp.union(

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

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