Skip to content

Commit

Permalink
merges r20391 and r20398 from trunk into ruby_1_9_1.
Browse files Browse the repository at this point in the history
* regparse.c (is_invalid_quantifier_target): Perl and old Ruby
  accepts quantifier on anchors.  [ruby-core:20161]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
yugui committed Nov 30, 2008
1 parent 4623d0c commit 1914564
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ChangeLog
@@ -1,3 +1,8 @@
Sat Nov 29 19:19:32 2008 Yukihiro Matsumoto <matz@ruby-lang.org>

* 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@ruby-lang.org>

* cont.c (fiber_alloc): separate allocation and initialization.
Expand Down
4 changes: 4 additions & 0 deletions regparse.c
Expand Up @@ -2112,6 +2112,7 @@ conv_backslash_value(int c, ScanEnv* env)
return c;
}

#if 0 /* no invalid quantifier */
static int
is_invalid_quantifier_target(Node* node)
{
Expand Down Expand Up @@ -2143,6 +2144,9 @@ is_invalid_quantifier_target(Node* node)
}
return 0;
}
#else
#define is_invalid_quantifier_target(node) 0
#endif

/* ?:0, *:1, +:2, ??:3, *?:4, +?:5 */
static int
Expand Down
4 changes: 3 additions & 1 deletion test/ruby/test_regexp.rb
Expand Up @@ -604,11 +604,13 @@ def test_parse_curly_brace
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
Expand Down

0 comments on commit 1914564

Please sign in to comment.