Bug #17644
Updated by nobu (Nobuyoshi Nakada) over 3 years ago
`Ripper.lex` Ripper.lex fails with syntax error and heredoc: ``` $ cat t.rb require "ripper" s = <<~EOF foo end <<~EOS bar EOS EOF p Ripper.lex(s) $ ruby t.rb /Users/shugo/.rbenv/versions/master/lib/ruby/3.1.0/ripper/lexer.rb:110:in `each': undefined method `pos' for [#<Ripper::Lexer::Elem: on_heredoc_beg@3:0:BEG: "<<~EOS">, #<Ripper::Lexer::Elem: on_ignored_sp@4:0:BEG: " ">, #<Ripper::Lexer::Elem: on_tstring_content@4:2:BEG: "bar\\n">, #<Ripper::Lexer::Elem: on_heredoc_end@5:0:BEG: "EOS\\n">]:Array (NoMethodError) Did you mean? pop from /Users/shugo/.rbenv/versions/master/lib/ruby/3.1.0/ripper/lexer.rb:110:in `sort_by' from /Users/shugo/.rbenv/versions/master/lib/ruby/3.1.0/ripper/lexer.rb:110:in `lex' from /Users/shugo/.rbenv/versions/master/lib/ruby/3.1.0/ripper/lexer.rb:52:in `lex' from t.rb:9:in `<main>' ``` It seems that this bug was introduced by commit:69d871eeeb2. 69d871eeeb2.