From f6347e38e3a9dfaca322e41b403c48d6f52e02d9 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 3 Mar 2016 07:42:32 +0000 Subject: 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 --- parse.y | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'parse.y') 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"); } } -- cgit v1.2.3