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:
parent
138f0ba6da
commit
17986daf6e
3 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue