summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-15 00:44:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-15 00:44:13 +0000
commit04e7cc64115715f47d602114194c65d0e8471eee (patch)
tree09cbce206c163abf9c83cff14467b6248e3ca64f /parse.y
parentab3e8e6143049662cf724c8574cd9fb8e248a4a0 (diff)
* parse.y (reg_compile_gen): reg_fragment_setenc might not raise an
exception before rb_reg_compile. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 7 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index 90098a6f99..0c8eb7ab9a 100644
--- a/parse.y
+++ b/parse.y
@@ -8655,10 +8655,14 @@ reg_compile_gen(struct parser_params* parser, VALUE str, int options)
re = rb_reg_compile(str, options & RE_OPTION_MASK);
if (NIL_P(re)) {
ID mesg = rb_intern("mesg");
- VALUE m = rb_attr_get(err, mesg);
- rb_str_cat(m, "\n", 1);
- rb_str_append(m, rb_attr_get(rb_errinfo(), mesg));
+ VALUE m = rb_attr_get(rb_errinfo(), mesg);
rb_set_errinfo(err);
+ if (!NIL_P(err)) {
+ rb_str_append(rb_str_cat(rb_attr_get(err, mesg), "\n", 1), m);
+ }
+ else {
+ compile_error(PARSER_ARG "%s", RSTRING_PTR(m));
+ }
return Qnil;
}
return re;