diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-20 01:25:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-20 01:25:55 +0000 |
commit | 97177a2d99f7c38d6085ccba343a980031aec7cf (patch) | |
tree | 006f7d88aff9629cb1fae9cc244afec1fb0b1ec8 /parse.y | |
parent | 51c195948f32e86226d2a45f810e2d830b573435 (diff) | |
download | ruby-97177a2d99f7c38d6085ccba343a980031aec7cf.tar.gz |
refactor syntax error
* compile.c (append_compile_error): use rb_syntax_error_append.
* error.c (rb_syntax_error_append): append messages into a
SyntaxError exception instance.
* parse.y (yycompile0): make new SyntaxError instance in main
mode, otherwize error_buffer should be a SyntaxError if error
has occurred.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -5550,8 +5550,11 @@ yycompile0(VALUE arg) lex_lastline = lex_nextline = 0; if (parser->error_p) { VALUE mesg = parser->error_buffer; - if (!mesg) mesg = rb_fstring_cstr("compile error"); - rb_set_errinfo(rb_exc_new_str(rb_eSyntaxError, mesg)); + if (!mesg) { + mesg = rb_fstring_cstr("compile error"); + mesg = rb_exc_new_str(rb_eSyntaxError, mesg); + } + rb_set_errinfo(mesg); return 0; } tree = ruby_eval_tree; @@ -11074,8 +11077,6 @@ rb_parser_printf(struct parser_params *parser, const char *fmt, ...) } } -extern VALUE rb_syntax_error_append(VALUE exc, VALUE file, int line, int column, rb_encoding *enc, const char *fmt, va_list args); - static void parser_compile_error(struct parser_params *parser, const char *fmt, ...) { |