diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-02 14:36:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-08-02 14:36:25 +0000 |
commit | d9274e7d6bbffd15291ffc6bdd5fefbde79f5cb8 (patch) | |
tree | b611b62f1dccaaaaf76d013e3fab3569c1b0b395 /re.c | |
parent | 46e848a65a866663161edecc81d1b46aa3e36de3 (diff) | |
download | ruby-d9274e7d6bbffd15291ffc6bdd5fefbde79f5cb8.tar.gz |
* parse.y (reg_compile_gen): set error if failed to compile regexp
literal. [ruby-dev:31336]
* re.c (rb_reg_compile): should not use regexp which could not get
initialized. [ruby-dev:31333]
return error message to let the parser know it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1521,14 +1521,14 @@ rb_reg_new(const char *s, long len, int options) } VALUE -rb_reg_compile(const char *s, long len, int options, const char *file, int line) +rb_reg_compile(const char *s, long len, int options) { VALUE re = rb_reg_s_alloc(rb_cRegexp); char err[ONIG_MAX_ERROR_MESSAGE_LEN]; if (rb_reg_initialize(re, s, len, options, err) != 0) { - VALUE desc = rb_reg_desc(s, len, re); - rb_compile_error(file, line, "%s: %s", err, RSTRING_PTR(desc)); + VALUE desc = rb_reg_desc(s, len, 0); + return rb_sprintf("%s: %s", err, RSTRING_PTR(desc)); } FL_SET(re, REG_LITERAL); return re; |