ruby-changes:48046
From: nobu <ko1@a...>
Date: Wed, 11 Oct 2017 14:34:29 +0900 (JST)
Subject: [ruby-changes:48046] nobu:r60160 (trunk): parse.y: token info with BOM
nobu 2017-10-11 14:34:24 +0900 (Wed, 11 Oct 2017) New Revision: 60160 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60160 Log: parse.y: token info with BOM * parse.y (parser_prepare): set token_info_enabled flag first, before returning at BOM. [ruby-dev:50288] [Bug #13998] Modified files: trunk/parse.y trunk/test/ruby/test_rubyoptions.rb Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 60159) +++ test/ruby/test_rubyoptions.rb (revision 60160) @@ -450,6 +450,17 @@ class TestRubyOptions < Test::Unit::Test https://github.com/ruby/ruby/blob/trunk/test/ruby/test_rubyoptions.rb#L450 t.flush assert_in_out_err(["-w", t.path], "", [], [], '[ruby-core:25442]') end + + a.for("BOM with #{b}") do + err = ["#{t.path}:2: warning: mismatched indentations at '#{e}' with '#{k}' at 1"] + t.rewind + t.truncate(0) + t.print "\u{feff}" + t.puts src + t.flush + assert_in_out_err(["-w", t.path], "", [], err) + assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err) + end end end end Index: parse.y =================================================================== --- parse.y (revision 60159) +++ parse.y (revision 60160) @@ -7148,6 +7148,7 @@ static void https://github.com/ruby/ruby/blob/trunk/parse.y#L7148 parser_prepare(struct parser_params *parser) { int c = nextc(); + parser->token_info_enabled = !compile_for_eval && RTEST(ruby_verbose); switch (c) { case '#': if (peek('!')) parser->has_shebang = 1; @@ -7167,7 +7168,6 @@ parser_prepare(struct parser_params *par https://github.com/ruby/ruby/blob/trunk/parse.y#L7168 } pushback(c); parser->enc = rb_enc_get(lex_lastline); - parser->token_info_enabled = !compile_for_eval && RTEST(ruby_verbose); } #ifndef RIPPER -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/