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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2013-07-04 16:30:19 +00:00
parent 4090bd7b51
commit 16f70c0e89
5 changed files with 40 additions and 8 deletions

View file

@ -1,3 +1,13 @@
Fri Jul 5 00:55:05 2013 NARUSE, Yui <naruse@ruby-lang.org>
* 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@cookpad.com>
* lib/mkmf.rb (try_config): Fix to not replace $LDFLAGS with $libs

View file

@ -40,7 +40,7 @@ extern "C" {
#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

View file

@ -1943,7 +1943,12 @@ renumber_by_map(Node* node, GroupNumRemap* map)
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:
( 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, int indent)
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);

View file

@ -942,4 +942,21 @@ class TestRegexp < Test::Unit::TestCase
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

View file

@ -1,10 +1,10 @@
#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"