aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-26 13:43:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-26 13:43:32 +0000
commit60023cf4521ce86803b9d328982e679962d448cc (patch)
tree0f2025a0870e85a02675146729d119553626a6e5 /parse.y
parent0a5b4c13ad16bacfa5659f7ac92eb7abf9416261 (diff)
downloadruby-60023cf4521ce86803b9d328982e679962d448cc.tar.gz
parse.y: trim newline in erred code
* parse.y (parser_yyerror): trim a newline at the end of the erred code which was replaced with an extra space in the succeeding cursor line. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y1
1 files changed, 1 insertions, 0 deletions
diff --git a/parse.y b/parse.y
index cbebc6ed8f..50ae02e71a 100644
--- a/parse.y
+++ b/parse.y
@@ -4689,6 +4689,7 @@ parser_yyerror(struct parser_params *p, const YYLTYPE *yylloc, const char *msg)
pt = (p->ruby_sourceline == yylloc->end_pos.lineno) ?
p->lex.pbeg + yylloc->end_pos.column : p->lex.pend;
+ if ((p->lex.pbeg < pt) && (*(pt-1) == '\n')) pt--;
ptr = ptr_end = pt < pend ? pt : pend;
lim = ptr - p->lex.pbeg > max_line_margin ? ptr - max_line_margin : p->lex.pbeg;
while ((lim < ptr) && (*(ptr-1) != '\n')) ptr--;