Project

General

Profile

Actions

Bug #19399

closed

Ripper::Lexer.parse throws NoMethodError error for some input

Added by tompng (tomoya ishida) over 1 year ago. Updated about 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.0 (2022-12-25 revision a528908271) [x86_64-darwin20]
[ruby-core:112173]

Description

Ripper::Lexer.parse throws undefined method `flatten!' for nil:NilClass (NoMethodError) for this input

require 'ripper'
code = <<~CODE
  a do |b # closing "|" is missing
    <<~C
    C
  end
CODE
Ripper::Lexer.parse code
/Users/tomoya/.rbenv/versions/3.2.0/lib/ruby/3.2.0/ripper/lexer.rb:183:in `parse': undefined method `flatten!' for nil:NilClass (NoMethodError)

        result.concat(@buf) until (@buf = []; super(); @buf.flatten!; @buf.empty?)
                                                           ^^^^^^^^^
	from /Users/tomoya/.rbenv/versions/3.2.0/lib/ruby/3.2.0/ripper/core.rb:19:in `parse'
	from -:8:in `<main>'
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0