1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) b84b253a69: [Backport #17547]

Fix Ripper with heredoc.

	---
	 ext/ripper/lib/ripper/lexer.rb |  1 +
	 test/ripper/test_lexer.rb      | 10 ++++++++++
	 2 files changed, 11 insertions(+)
This commit is contained in:
NARUSE, Yui 2021-02-01 23:07:02 +09:00
parent 138f0ba6da
commit 17986daf6e
3 changed files with 12 additions and 1 deletions

View file

@ -130,6 +130,7 @@ class Ripper
@buf = []
@stack = []
super()
@buf = @stack.pop unless @stack.empty?
if raise_errors and !@errors.empty?
raise SyntaxError, @errors.map(&:message).join(' ;')
end

View file

@ -90,6 +90,16 @@ class TestRipper::Lexer < Test::Unit::TestCase
assert_equal expect, Ripper.lex(src).map {|e| e[1]}
end
def test_stack_at_on_heredoc_beg
src = "a <<b"
expect = %I[
on_ident
on_sp
on_heredoc_beg
]
assert_equal expect, Ripper.lex(src).map {|e| e[1]}
end
def test_slice
assert_equal "string\#{nil}\n",
Ripper.slice(%(<<HERE\nstring\#{nil}\nHERE), "heredoc_beg .*? nl $(.*?) heredoc_end", 1)

View file

@ -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 22
#define RUBY_PATCHLEVEL 23
#define RUBY_RELEASE_YEAR 2021
#define RUBY_RELEASE_MONTH 2