1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* regparse.c (add_ctype_to_cc_by_range): fix the first

character bigger than sb_out was dropped.

* test/ruby/test_regexp.rb (TestRegexp#test_posix_bracket):
  add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2009-08-15 16:27:13 +00:00
parent c6fcb8ab9a
commit c0ec326b7b
3 changed files with 15 additions and 2 deletions

View file

@ -1,3 +1,11 @@
Sun Aug 16 01:10:00 2009 NARUSE, Yui <naruse@ruby-lang.org>
* regparse.c (add_ctype_to_cc_by_range): fix the first
character bigger than sb_out was dropped.
* test/ruby/test_regexp.rb (TestRegexp#test_posix_bracket):
add tests for above.
Sun Aug 16 00:30:33 2009 NARUSE, Yui <naruse@ruby-lang.org>
* include/ruby/oniguruma.h

View file

@ -3797,8 +3797,7 @@ add_ctype_to_cc_by_range(CClassNode* cc, int ctype ARG_UNUSED, int not,
for (j = ONIGENC_CODE_RANGE_FROM(mbr, i);
j <= ONIGENC_CODE_RANGE_TO(mbr, i); j++) {
if (j >= sb_out) {
if (j == ONIGENC_CODE_RANGE_TO(mbr, i)) i++;
else if (j > ONIGENC_CODE_RANGE_FROM(mbr, i)) {
if (j > ONIGENC_CODE_RANGE_FROM(mbr, i)) {
r = add_code_range_to_buf(&(cc->mbuf), env, j,
ONIGENC_CODE_RANGE_TO(mbr, i));
if (r != 0) return r;

View file

@ -684,6 +684,12 @@ class TestRegexp < Test::Unit::TestCase
failcheck('[[:alpha')
failcheck('[[:alpha:')
failcheck('[[:alp:]]')
assert_match(/\A[[:digit:]]+\z/, "\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19")
assert_match(/\A[[:alnum:]]+\z/, "\uff10\uff19\uff41\uff5a\uff21\uff3a")
assert_match(/\A[[:space:]]+\z/, "\r\n\v\f\r\s\u0085")
assert_match(/\A[[:ascii:]]+\z/, "\x00\x7F")
assert_no_match(/[[:ascii:]]/, "\x80\xFF")
end
def test_backward