diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-14 14:56:40 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-14 14:56:40 +0000 |
commit | ef58a02bc58580def1fb282c595a809d3b0bc31e (patch) | |
tree | a8a2dfa0919de4474ca831af579f936bf4b0ba48 | |
parent | 58adb098ef6db0867f9ae66dd314b3e112e2a41a (diff) | |
download | ruby-ef58a02bc58580def1fb282c595a809d3b0bc31e.tar.gz ruby-ef58a02bc58580def1fb282c595a809d3b0bc31e.tar.xz ruby-ef58a02bc58580def1fb282c595a809d3b0bc31e.zip |
* parse.y (reg_compile_gen): appends error message from
rb_reg_compile() to one from reg_fragment_setenc().
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | parse.y | 11 |
2 files changed, 15 insertions, 3 deletions
@@ -1,3 +1,10 @@ +Thu Feb 14 23:56:38 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@fsij.org> * io.c (io_reopen): check STDIN, STDOUT and STDERR mode according to @@ -8546,7 +8546,7 @@ reg_fragment_setenc_gen(struct parser_params* parser, VALUE str, int options) } 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 @@ static VALUE 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; |