mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix Ripper.lex error in dedenting squiggly heredoc
* ext/ripper/lib/ripper/lexer.rb (on_heredoc_dedent): Fix Ripper.lex error in dedenting squiggly heredoc. heredoc tree is also an array of Elem in the outer tree. [Fix GH-1234] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
922d359e65
commit
a43f2cbaa1
3 changed files with 13 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Wed Feb 3 08:21:32 2016 Seiei Miyagi <hanachin@gmail.com>
|
||||
|
||||
* ext/ripper/lib/ripper/lexer.rb (on_heredoc_dedent): Fix
|
||||
Ripper.lex error in dedenting squiggly heredoc. heredoc tree is
|
||||
also an array of Elem in the outer tree. [Fix GH-1234]
|
||||
|
||||
Wed Feb 3 02:33:39 2016 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* re.c (rb_reg_prepare_enc): use already compiled US-ASCII regexp
|
||||
|
|
|
@ -66,7 +66,7 @@ class Ripper
|
|||
private
|
||||
|
||||
def on_heredoc_dedent(v, w)
|
||||
@buf.each do |e|
|
||||
@buf.last.each do |e|
|
||||
if e.event == :on_tstring_content
|
||||
if (n = dedent_string(e.tok, w)) > 0
|
||||
e.pos[1] += n
|
||||
|
|
|
@ -103,6 +103,12 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
|
|||
[[5, 0], :on_imaginary, "5.6ri"],
|
||||
],
|
||||
Ripper.lex("1r\n2i\n3ri\n4.2r\n5.6ri")
|
||||
assert_equal [[[1, 0], :on_heredoc_beg, "<<~EOS"],
|
||||
[[1, 6], :on_nl, "\n"],
|
||||
[[2, 2], :on_tstring_content, "heredoc\n"],
|
||||
[[3, 0], :on_heredoc_end, "EOS"]
|
||||
],
|
||||
Ripper.lex("<<~EOS\n heredoc\nEOS")
|
||||
end
|
||||
|
||||
def test_location
|
||||
|
|
Loading…
Add table
Reference in a new issue