* regparse.c (parse_char_class): also need to check the type of token

after raw hyphen in regexp class, because the charcter code area
  is union'ed with the property of TK_CHAR_TYPE.
  reported by Bushi Zhang at [ruby-core:47115] [Backport #6853].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2012-10-12 16:47:05 +00:00
parent cc251c2f9f
commit 88e264d23d
3 changed files with 12 additions and 2 deletions

View file

@ -4491,7 +4491,10 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
if (IS_SYNTAX_BV(env->syntax, ONIG_SYN_ALLOW_DOUBLE_RANGE_OP_IN_CC)) {
CC_ESC_WARN(env, (UChar* )"-");
goto sb_char; /* [0-9-a] is allowed as [0-9\-a] */
if (tok->type == TK_CHAR_TYPE)
goto next_class; /* [0-9-\s] is allowed as [0-9\-\s] */
else
goto sb_char; /* [0-9-a] is allowed as [0-9\-a] */
}
r = ONIGERR_UNMATCHED_RANGE_SPECIFIER_IN_CHAR_CLASS;
goto err;