ruby-changes:55035
From: nagachika <ko1@a...>
Date: Wed, 13 Mar 2019 09:32:20 +0900 (JST)
Subject: [ruby-changes:55035] nagachika:r67242 (ruby_2_5): merge revision(s) 67200: [Backport #15648]
nagachika 2019-03-13 09:32:12 +0900 (Wed, 13 Mar 2019) New Revision: 67242 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67242 Log: merge revision(s) 67200: [Backport #15648] Add ignored_sp event * ext/ripper/lib/ripper/lexer.rb (Ripper::Lexer): add ignored_sp event which will be fired from Ripper::Lexer#on_heredoc_dedent method. [ruby-core:91727] [Bug #15648] Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/ext/ripper/lib/ripper/lexer.rb branches/ruby_2_5/test/ripper/test_scanner_events.rb branches/ruby_2_5/version.h Index: ruby_2_5/ext/ripper/lib/ripper/lexer.rb =================================================================== --- ruby_2_5/ext/ripper/lib/ripper/lexer.rb (revision 67241) +++ ruby_2_5/ext/ripper/lib/ripper/lexer.rb (revision 67242) @@ -83,6 +83,12 @@ class Ripper https://github.com/ruby/ruby/blob/trunk/ruby_2_5/ext/ripper/lib/ripper/lexer.rb#L83 private + unless SCANNER_EVENT_TABLE.key?(:ignored_sp) + SCANNER_EVENT_TABLE[:ignored_sp] = 1 + SCANNER_EVENTS << :ignored_sp + EVENTS << :ignored_sp + end + def on_heredoc_dedent(v, w) ignored_sp = [] heredoc = @buf.last Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 67241) +++ ruby_2_5/version.h (revision 67242) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1 #define RUBY_VERSION "2.5.4" #define RUBY_RELEASE_DATE "2019-03-13" -#define RUBY_PATCHLEVEL 154 +#define RUBY_PATCHLEVEL 155 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_5/test/ripper/test_scanner_events.rb =================================================================== --- ruby_2_5/test/ripper/test_scanner_events.rb (revision 67241) +++ ruby_2_5/test/ripper/test_scanner_events.rb (revision 67242) @@ -881,6 +881,13 @@ class TestRipper::ScannerEvents < Test:: https://github.com/ruby/ruby/blob/trunk/ruby_2_5/test/ripper/test_scanner_events.rb#L881 scan('ignored_nl', "1;\r\n") end + def test_ignored_sp + assert_equal [], + scan('ignored_sp', "<<~EOS\nheredoc\nEOS") + assert_equal [" "], + scan('ignored_sp', "<<~EOS\n heredoc\nEOS") + end + def test___end__ assert_equal [], scan('__end__', "") Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 67241) +++ ruby_2_5 (revision 67242) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r67200 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/