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

ruby-changes:17027

From: naruse <ko1@a...>
Date: Wed, 18 Aug 2010 01:53:38 +0900 (JST)
Subject: [ruby-changes:17027] Ruby:r29023 (trunk): * regcomp.c: revert r26701; it introduces Bug #3681.

naruse	2010-08-18 01:53:25 +0900 (Wed, 18 Aug 2010)

  New Revision: 29023

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

  Log:
    * regcomp.c: revert r26701; it introduces Bug #3681.
      [ruby-core:31677]

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

Index: regcomp.c
===================================================================
--- regcomp.c	(revision 29022)
+++ regcomp.c	(revision 29023)
@@ -3671,7 +3671,6 @@
 #define IN_NOT        (1<<1)
 #define IN_REPEAT     (1<<2)
 #define IN_VAR_REPEAT (1<<3)
-#define IN_LAST	      (1<<4)
 
 /* setup_tree does the following work.
  1. check empty loop. (set qn->target_empty_info)
@@ -3693,8 +3692,7 @@
     {
       Node* prev = NULL_NODE;
       do {
-	int s = IS_NOT_NULL(NCDR(node)) ? (state & ~IN_LAST) : state;
-	r = setup_tree(NCAR(node), reg, s, env);
+	r = setup_tree(NCAR(node), reg, state, env);
 	if (IS_NOT_NULL(prev) && r == 0) {
 	  r = next_setup(prev, NCAR(node), reg);
 	}
@@ -3825,20 +3823,6 @@
 	}
       }
 #endif
-
-      if ((state & IN_LAST) != 0 && qn->greedy && IS_REPEAT_INFINITE(qn->upper)) {
-	/* automatic posseivation a* (at last) ==> (?>a*) */
-	if (qn->lower <= 1) {
-	  int ttype = NTYPE(qn->target);
-	  if (IS_NODE_TYPE_SIMPLE(ttype)) {
-	    Node* en = onig_node_new_enclose(ENCLOSE_STOP_BACKTRACK);
-	    CHECK_NULL_RETURN_MEMERR(en);
-	    SET_ENCLOSE_STATUS(en, NST_STOP_BT_SIMPLE_REPEAT);
-	    swap_node(node, en);
-	    NENCLOSE(node)->target = en;
-	  }
-	}
-      }
     }
     break;
 
@@ -5393,7 +5377,7 @@
     reg->num_call = 0;
 #endif
 
-  r = setup_tree(root, reg, IN_LAST, &scan_env);
+  r = setup_tree(root, reg, 0, &scan_env);
   if (r != 0) goto err_unset;
 
 #ifdef ONIG_DEBUG_PARSE_TREE
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29022)
+++ ChangeLog	(revision 29023)
@@ -1,3 +1,8 @@
+Wed Aug 18 01:37:49 2010  NARUSE, Yui  <naruse@r...>
+
+	* regcomp.c: revert r26701; it introduces Bug #3681.
+	  [ruby-core:31677]
+
 Tue Aug 17 20:05:29 2010  Tanaka Akira  <akr@f...>
 
 	* test/ruby/test_io.rb (test_threaded_flush): test "hi" is not output
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb	(revision 29022)
+++ test/ruby/test_regexp.rb	(revision 29023)
@@ -816,6 +816,7 @@
     assert_nothing_raised { s.match(/(\d) (.*)/) }
     assert_equal("1", $1)
     assert_equal(" " * 4999999, $2)
+    assert_match(/(?:A.+){2}/, 'AbAb')
   end
 
   def test_invalid_fragment

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

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