Project

General

Profile

Actions

Bug #19399

closed

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

Added by tompng (tomoya ishida) about 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>'

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Description updated (diff)
  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED
Actions #2

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|fad48fefe19cc282a5b209944244a3713359b47f.


[Bug #19399] Parsing invalid heredoc inside block parameter

Although this is of course invalid as Ruby code, allow to just parse
and tokenize.

Updated by naruse (Yui NARUSE) about 1 year ago

  • Backport changed from 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: REQUIRED to 2.7: DONTNEED, 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONE

ruby_3_2 7246cd0081ec845e1407484fca10439e7868880b merged revision(s) fad48fefe19cc282a5b209944244a3713359b47f.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0