From d9274e7d6bbffd15291ffc6bdd5fefbde79f5cb8 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 2 Aug 2007 14:36:25 +0000 Subject: * 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 --- re.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 're.c') diff --git a/re.c b/re.c index f8af10a7f3..b3d05e5b8f 100644 --- a/re.c +++ b/re.c @@ -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; -- cgit v1.2.3