aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-03 07:42:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-03 07:42:32 +0000
commitea05de7a3f55081fd30a16f7bd0c69c73be68f82 (patch)
treeb4dd2d1dc1193c2d9e9b2edb90740c54988f657b /parse.y
parente4e3ead316a3790f7ec4fd41d824d5b405dc19df (diff)
downloadruby-ea05de7a3f55081fd30a16f7bd0c69c73be68f82.tar.gz
parse.y: cr_seen flag
* parse.y (parser_params): turn last_cr_line into cr_seen flag. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y10
1 files changed, 5 insertions, 5 deletions
diff --git a/parse.y b/parse.y
index a4a57e260b..97e265d188 100644
--- a/parse.y
+++ b/parse.y
@@ -287,8 +287,6 @@ struct parser_params {
ID cur_arg;
- int last_cr_line;
-
unsigned int command_start:1;
unsigned int eofp: 1;
unsigned int ruby__end__seen: 1;
@@ -305,6 +303,7 @@ struct parser_params {
unsigned int past_scope_enabled: 1;
# endif
unsigned int error_p: 1;
+ unsigned int cr_seen: 1;
#ifndef RIPPER
/* Ruby core only */
@@ -5532,7 +5531,6 @@ yycompile0(VALUE arg)
ruby_coverage = coverage(ruby_sourcefile_string, ruby_sourceline);
}
}
- parser->last_cr_line = ruby_sourceline - 1;
parser_prepare(parser);
#ifndef RIPPER
@@ -5782,6 +5780,7 @@ parser_nextc(struct parser_params *parser)
lex_goto_eol(parser);
return -1;
}
+ parser->cr_seen = FALSE;
}
{
#ifdef RIPPER
@@ -5818,8 +5817,9 @@ parser_nextc(struct parser_params *parser)
lex_p++;
c = '\n';
}
- else if (ruby_sourceline > parser->last_cr_line) {
- parser->last_cr_line = ruby_sourceline;
+ else if (!parser->cr_seen) {
+ parser->cr_seen = TRUE;
+ /* carried over with lex_nextline for nextc() */
rb_warn0("encountered \\r in middle of line, treated as a mere space");
}
}