ruby-changes:8890
From: yugui <ko1@a...>
Date: Sun, 30 Nov 2008 18:26:26 +0900 (JST)
Subject: [ruby-changes:8890] Ruby:r20426 (ruby_1_9_1): merges r20391 and r20398 from trunk into ruby_1_9_1.
yugui 2008-11-30 18:25:14 +0900 (Sun, 30 Nov 2008) New Revision: 20426 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20426 Log: merges r20391 and r20398 from trunk into ruby_1_9_1. * regparse.c (is_invalid_quantifier_target): Perl and old Ruby accepts quantifier on anchors. [ruby-core:20161] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/regparse.c branches/ruby_1_9_1/test/ruby/test_regexp.rb Index: ruby_1_9_1/regparse.c =================================================================== --- ruby_1_9_1/regparse.c (revision 20425) +++ ruby_1_9_1/regparse.c (revision 20426) @@ -2112,6 +2112,7 @@ return c; } +#if 0 /* no invalid quantifier */ static int is_invalid_quantifier_target(Node* node) { @@ -2143,6 +2144,9 @@ } return 0; } +#else +#define is_invalid_quantifier_target(node) 0 +#endif /* ?:0, *:1, +:2, ??:3, *?:4, +?:5 */ static int Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20425) +++ ruby_1_9_1/ChangeLog (revision 20426) @@ -1,3 +1,8 @@ +Sat Nov 29 19:19:32 2008 Yukihiro Matsumoto <matz@r...> + + * regparse.c (is_invalid_quantifier_target): Perl and old Ruby + accepts quantifier on anchors. [ruby-core:20161] + Sat Nov 29 00:18:30 2008 Yukihiro Matsumoto <matz@r...> * cont.c (fiber_alloc): separate allocation and initialization. Index: ruby_1_9_1/test/ruby/test_regexp.rb =================================================================== --- ruby_1_9_1/test/ruby/test_regexp.rb (revision 20425) +++ ruby_1_9_1/test/ruby/test_regexp.rb (revision 20426) @@ -604,11 +604,13 @@ check(/\Aa{0}+\z/, "", %w(a aa aab)) check(/\Aa{1}+\z/, %w(a aa), ["", "aab"]) check(/\Aa{1,2}b{1,2}\z/, %w(ab aab abb aabb), ["", "aaabb", "abbb"]) + check(/(?!x){0,1}/, [ ['', 'ab'], ['', ''] ]) + check(/c\z{0,1}/, [ ['c', 'abc'], ['c', 'cab']], ['abd']) + check(/\A{0,1}a/, [ ['a', 'abc'], ['a', '____abc']], ['bcd']) failcheck('.{100001}') failcheck('.{0,100001}') failcheck('.{1,0}') failcheck('{0}') - failcheck('(?!x){0,1}') end def test_parse_comment -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/