summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2019-07-27 14:49:57 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2019-07-27 15:00:46 +0900
commitb58f769c96462fb8b3b2453ba2aae8c83932f84b (patch)
treea349b8457473906275613d149d96f0dba06f6f74
parent42fb251d0affd83215c2a6f318550ccfc04dbcd7 (diff)
downloadmruby-b58f769c96462fb8b3b2453ba2aae8c83932f84b.tar.gz
mruby-b58f769c96462fb8b3b2453ba2aae8c83932f84b.zip
Fix line number bug; fix #4513
Also fix the misfeature introduced in 23783a4, that ignores newlines between method chains.
-rw-r--r--mrbgems/mruby-compiler/core/parse.y8
1 files changed, 3 insertions, 5 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y
index b7a7d315d..f6d543c5d 100644
--- a/mrbgems/mruby-compiler/core/parse.y
+++ b/mrbgems/mruby-compiler/core/parse.y
@@ -4731,6 +4731,7 @@ parser_yylex(parser_state *p)
case '\n':
maybe_heredoc:
heredoc_treat_nextline(p);
+ p->column = 0;
switch (p->lstate) {
case EXPR_BEG:
case EXPR_FNAME:
@@ -4738,7 +4739,6 @@ parser_yylex(parser_state *p)
case EXPR_CLASS:
case EXPR_VALUE:
p->lineno++;
- p->column = 0;
if (p->parsing_heredoc != NULL) {
if (p->lex_strterm) {
return parse_string(p);
@@ -4759,15 +4759,12 @@ parser_yylex(parser_state *p)
break;
case '#': /* comment as a whitespace */
pushback(p, '#');
- goto retry;
- case '\n': /* consecutive newlines */
p->lineno++;
- p->column = 0;
- pushback(p, '\n');
goto retry;
case '.':
if (!peek(p, '.')) {
pushback(p, '.');
+ p->lineno++;
goto retry;
}
pushback(p, c);
@@ -4775,6 +4772,7 @@ parser_yylex(parser_state *p)
case '&':
if (peek(p, '.')) {
pushback(p, '&');
+ p->lineno++;
goto retry;
}
pushback(p, c);