mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8fa641a664
commit
4fd078646b
3 changed files with 14 additions and 1 deletions
|
@ -83,6 +83,12 @@ class Ripper
|
|||
|
||||
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
|
||||
|
|
|
@ -881,6 +881,13 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
|
|||
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__', "")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#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
|
||||
|
|
Loading…
Add table
Reference in a new issue