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

ruby-changes:29728

From: nagachika <ko1@a...>
Date: Fri, 5 Jul 2013 01:30:34 +0900 (JST)
Subject: [ruby-changes:29728] nagachika:r41780 (ruby_2_0_0): merge revision(s) 41764,41765,41767: [Backport #8583]

nagachika	2013-07-05 01:30:19 +0900 (Fri, 05 Jul 2013)

  New Revision: 41780

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

  Log:
    merge revision(s) 41764,41765,41767: [Backport #8583]
    
    * regcomp.c (): Merge Onigmo 5.13.5 23b523076d6f1161.
      https://bugs.ruby-lang.org/issues/8583
      * [bug]  (thanks Akinori MUSHA and Ippei Obayashi)
               Fix a renumbering bug in condition regexp with a named
               capture. [Bug #8583]
      * [spec] (thanks Akinori MUSHA)
        Allow ENCLOSE_OPTION in look-behind.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/include/ruby/oniguruma.h
    branches/ruby_2_0_0/regcomp.c
    branches/ruby_2_0_0/test/ruby/test_regexp.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/regcomp.c
===================================================================
--- ruby_2_0_0/regcomp.c	(revision 41779)
+++ ruby_2_0_0/regcomp.c	(revision 41780)
@@ -1943,7 +1943,12 @@ renumber_by_map(Node* node, GroupNumRema https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/regcomp.c#L1943
     r = renumber_by_map(NQTFR(node)->target, map);
     break;
   case NT_ENCLOSE:
-    r = renumber_by_map(NENCLOSE(node)->target, map);
+    {
+      EncloseNode* en = NENCLOSE(node);
+      if (en->type == ENCLOSE_CONDITION)
+        en->regnum = map[en->regnum].new_val;
+      r = renumber_by_map(en->target, map);
+    }
     break;
 
   case NT_BREF:
@@ -4090,8 +4095,8 @@ restart: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/regcomp.c#L4095
   ( BIT_NT_LIST | BIT_NT_ALT | BIT_NT_STR | BIT_NT_CCLASS | BIT_NT_CTYPE | \
     BIT_NT_CANY | BIT_NT_ANCHOR | BIT_NT_ENCLOSE | BIT_NT_QTFR | BIT_NT_CALL )
 
-#define ALLOWED_ENCLOSE_IN_LB       ( ENCLOSE_MEMORY )
-#define ALLOWED_ENCLOSE_IN_LB_NOT   0
+#define ALLOWED_ENCLOSE_IN_LB       ( ENCLOSE_MEMORY | ENCLOSE_OPTION )
+#define ALLOWED_ENCLOSE_IN_LB_NOT   ENCLOSE_OPTION
 
 #define ALLOWED_ANCHOR_IN_LB \
 ( ANCHOR_LOOK_BEHIND | ANCHOR_LOOK_BEHIND_NOT | ANCHOR_BEGIN_LINE | \
@@ -6646,7 +6651,7 @@ print_indent_tree(FILE* f, Node* node, i https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/regcomp.c#L6651
     fprintf(f, "<enclose:%"PRIxPTR"> ", (intptr_t)node);
     switch (NENCLOSE(node)->type) {
     case ENCLOSE_OPTION:
-      fprintf(f, "option:%d\n", NENCLOSE(node)->option);
+      fprintf(f, "option:%d", NENCLOSE(node)->option);
       break;
     case ENCLOSE_MEMORY:
       fprintf(f, "memory:%d", NENCLOSE(node)->regnum);
Index: ruby_2_0_0/include/ruby/oniguruma.h
===================================================================
--- ruby_2_0_0/include/ruby/oniguruma.h	(revision 41779)
+++ ruby_2_0_0/include/ruby/oniguruma.h	(revision 41780)
@@ -40,7 +40,7 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/include/ruby/oniguruma.h#L40
 #define ONIGURUMA
 #define ONIGURUMA_VERSION_MAJOR   5
 #define ONIGURUMA_VERSION_MINOR   13
-#define ONIGURUMA_VERSION_TEENY   4
+#define ONIGURUMA_VERSION_TEENY   5
 
 #ifdef __cplusplus
 # ifndef  HAVE_PROTOTYPES
Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 41779)
+++ ruby_2_0_0/ChangeLog	(revision 41780)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Fri Jul  5 00:55:05 2013  NARUSE, Yui  <naruse@r...>
+
+	* regcomp.c (): Merge Onigmo 5.13.5 23b523076d6f1161.
+
+	  * [bug]  (thanks Akinori MUSHA and Ippei Obayashi)
+	           Fix a renumbering bug in condition regexp with a named
+	           capture. [Bug #8583]
+	  * [spec] (thanks Akinori MUSHA)
+	    Allow ENCLOSE_OPTION in look-behind.
+
 Wed Jul  3 23:31:26 2013  Shota Fukumori  <sorah@c...>
 
 	* lib/mkmf.rb (try_config): Fix to not replace $LDFLAGS with $libs
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 41779)
+++ ruby_2_0_0/version.h	(revision 41780)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-07-03"
-#define RUBY_PATCHLEVEL 250
+#define RUBY_RELEASE_DATE "2013-07-05"
+#define RUBY_PATCHLEVEL 251
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 7
-#define RUBY_RELEASE_DAY 3
+#define RUBY_RELEASE_DAY 5
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/ruby/test_regexp.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_regexp.rb	(revision 41779)
+++ ruby_2_0_0/test/ruby/test_regexp.rb	(revision 41780)
@@ -942,4 +942,21 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_regexp.rb#L942
     err = assert_raise(TypeError){ Regexp.quote(42) }
     assert_equal 'no implicit conversion of Fixnum into String', err.message, bug7539
   end
+
+  def test_conditional_expression
+    bug8583 = '[ruby-dev:47480] [Bug #8583]'
+
+    conds = {"xy"=>true, "yx"=>true, "xx"=>false, "yy"=>false}
+    assert_match_each(/\A((x)|(y))(?(2)y|x)\z/, conds, bug8583)
+    assert_match_each(/\A((?<x>x)|(?<y>y))(?(<x>)y|x)\z/, conds, bug8583)
+  end
+
+  def assert_match_each(re, conds, msg = nil)
+    errs = conds.select {|str, match| match ^ (re =~ str)}
+    msg = message(msg) {
+      "Expected #{re.inspect} to\n" +
+      errs.map {|str, match| "\t#{'not ' unless match}match #{str.inspect}"}.join(",\n")
+    }
+    assert(errs.empty?, msg)
+  end
 end

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r41764-41765,41767


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

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