ruby-changes:41914
From: nobu <ko1@a...>
Date: Thu, 3 Mar 2016 16:42:41 +0900 (JST)
Subject: [ruby-changes:41914] nobu:r53988 (trunk): parse.y: cr_seen flag
nobu 2016-03-03 16:42:32 +0900 (Thu, 03 Mar 2016) New Revision: 53988 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53988 Log: parse.y: cr_seen flag * parse.y (parser_params): turn last_cr_line into cr_seen flag. Modified files: trunk/parse.y Index: parse.y =================================================================== --- parse.y (revision 53987) +++ parse.y (revision 53988) @@ -287,8 +287,6 @@ struct parser_params { https://github.com/ruby/ruby/blob/trunk/parse.y#L287 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 { https://github.com/ruby/ruby/blob/trunk/parse.y#L303 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) https://github.com/ruby/ruby/blob/trunk/parse.y#L5531 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 *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L5780 lex_goto_eol(parser); return -1; } + parser->cr_seen = FALSE; } { #ifdef RIPPER @@ -5818,8 +5817,9 @@ parser_nextc(struct parser_params *parse https://github.com/ruby/ruby/blob/trunk/parse.y#L5817 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"); } } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/