Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Apr 24, 2024
1 parent d66a573 commit 85ff2c4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -7443,6 +7443,23 @@ parser_precise_mbclen(struct parser_params *p, const char *ptr)
}

#ifndef RIPPER
static inline void
parser_show_error_line(struct parser_params *p, const YYLTYPE *yylloc)
{
rb_parser_string_t *str;
int lineno = p->ruby_sourceline;
if (!yylloc) {
return;
}
else if (yylloc->beg_pos.lineno == lineno) {
str = p->lex.lastline;
}
else {
return;
}
ruby_show_error_line(p, p->error_buffer, Qnil, yylloc, lineno, str);
}

static int
parser_yyerror(struct parser_params *p, const rb_code_location_t *yylloc, const char *msg)
{
Expand Down Expand Up @@ -16243,6 +16260,7 @@ parser_compile_error(struct parser_params *p, const rb_code_location_t *loc, con
p->ruby_sourcefile_string,
lineno, column,
p->enc, fmt, ap);
parser_show_error_line(p, loc);
}
else {
VALUE str = rb_enc_str_new(0, 0, p->enc);
Expand Down

0 comments on commit 85ff2c4

Please sign in to comment.