mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 5de38c41ae
: [Backport #17644]
ripper: fix a bug of Ripper::Lexer with syntax error and heredoc [Bug #17644] --- ext/ripper/lib/ripper/lexer.rb | 2 +- test/ripper/test_lexer.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
This commit is contained in:
parent
713d6d5eb0
commit
a6dec2e144
3 changed files with 14 additions and 2 deletions
|
@ -136,7 +136,7 @@ class Ripper
|
|||
end
|
||||
@buf.flatten!
|
||||
unless (result = @buf).empty?
|
||||
result.concat(@buf) until (@buf = []; super(); @buf.empty?)
|
||||
result.concat(@buf) until (@buf = []; super(); @buf.flatten!; @buf.empty?)
|
||||
end
|
||||
result
|
||||
end
|
||||
|
|
|
@ -215,4 +215,16 @@ class TestRipper::Lexer < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_lex_with_syntax_error_and_heredo
|
||||
bug = '[Bug #17644]'
|
||||
s = <<~EOF
|
||||
foo
|
||||
end
|
||||
<<~EOS
|
||||
bar
|
||||
EOS
|
||||
EOF
|
||||
assert_equal([[5, 0], :on_heredoc_end, "EOS\n", state(:EXPR_BEG)], Ripper.lex(s).last, bug)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 0
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 44
|
||||
#define RUBY_PATCHLEVEL 45
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2021
|
||||
#define RUBY_RELEASE_MONTH 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue