summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-19 08:42:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-19 08:42:50 +0000
commit51c195948f32e86226d2a45f810e2d830b573435 (patch)
treea4df94058a4eb2ffee9c16426b4921b3870c26bd /parse.y
parent51612505f722e1e7d801e42c6bb5af6766bd874b (diff)
refactor parser error
* error.c (err_vcatf): rename, and separate appending message from creating a string buffer. * error.c (rb_syntax_error_append): merge rb_error_vsprintf and rb_compile_err_append. * parse.y (parser_compile_error): use rb_syntax_error_append. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y13
1 files changed, 7 insertions, 6 deletions
diff --git a/parse.y b/parse.y
index b8b4a21fa6..2243f69765 100644
--- a/parse.y
+++ b/parse.y
@@ -11074,21 +11074,22 @@ rb_parser_printf(struct parser_params *parser, const char *fmt, ...)
}
}
-extern VALUE rb_error_vsprintf(VALUE, int, void *, const char *, va_list);
-extern VALUE rb_compile_err_append(VALUE buffer, VALUE mesg);
+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, ...)
{
- VALUE str;
va_list ap;
parser->error_p = 1;
va_start(ap, fmt);
- str = rb_error_vsprintf(ruby_sourcefile_string, ruby_sourceline,
- (void *)current_enc, fmt, ap);
+ parser->error_buffer =
+ rb_syntax_error_append(parser->error_buffer,
+ ruby_sourcefile_string,
+ ruby_sourceline,
+ rb_long2int(lex_p - lex_pbeg),
+ current_enc, fmt, ap);
va_end(ap);
- parser->error_buffer = rb_compile_err_append(parser->error_buffer, str);
}
#endif