ruby-changes:3985
From: ko1@a...
Date: Thu, 14 Feb 2008 23:57:00 +0900 (JST)
Subject: [ruby-changes:3985] nobu - Ruby:r15475 (trunk): * parse.y (reg_compile_gen): appends error message from
nobu 2008-02-14 23:56:40 +0900 (Thu, 14 Feb 2008) New Revision: 15475 Modified files: trunk/ChangeLog trunk/parse.y Log: * parse.y (reg_compile_gen): appends error message from rb_reg_compile() to one from reg_fragment_setenc(). http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=15475&r2=15474&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15475&r2=15474&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 15474) +++ ChangeLog (revision 15475) @@ -1,3 +1,10 @@ +Thu Feb 14 23:56:38 2008 Nobuyoshi Nakada <nobu@r...> + + * eval_error.c (error_print): append a newline to rest lines. + + * parse.y (reg_compile_gen): appends error message from + rb_reg_compile() to one from reg_fragment_setenc(). + Thu Feb 14 21:00:14 2008 Tanaka Akira <akr@f...> * io.c (io_reopen): check STDIN, STDOUT and STDERR mode according to Index: parse.y =================================================================== --- parse.y (revision 15474) +++ parse.y (revision 15475) @@ -8546,7 +8546,7 @@ } return; -error: + error: compile_error(PARSER_ARG "regexp encoding option '%c' differs from source encoding '%s'", c, rb_enc_name(rb_enc_get(str))); @@ -8648,12 +8648,17 @@ reg_compile_gen(struct parser_params* parser, VALUE str, int options) { VALUE re; + VALUE err; reg_fragment_setenc(str, options); + err = rb_errinfo(); re = rb_reg_compile(str, options & RE_OPTION_MASK); if (NIL_P(re)) { - RB_GC_GUARD(re) = rb_obj_as_string(rb_errinfo()); - compile_error(PARSER_ARG "%s", RSTRING_PTR(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)); + rb_set_errinfo(err); return Qnil; } return re; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/