aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-20 01:25:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-20 01:25:55 +0000
commitca7e4e033c334ea1b9a676413f759f0e9059fc37 (patch)
tree006f7d88aff9629cb1fae9cc244afec1fb0b1ec8 /parse.y
parent0818b7d4ad638b5d30d7d4b6ddb86ab7c942744d (diff)
downloadruby-ca7e4e033c334ea1b9a676413f759f0e9059fc37.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.y9
1 files changed, 5 insertions, 4 deletions
diff --git a/parse.y b/parse.y
index 2243f69765..56f4d837c5 100644
--- a/parse.y
+++ b/parse.y
@@ -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, ...)
{