ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: naruse@airemix.jp
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:51029] [Ruby master Bug#17644] Ripper.lex fails with syntax error and heredoc
Date: Tue, 02 Mar 2021 09:28:45 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-90700.20210302092845.12@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-17644.20210219073225.12@ruby-lang.org>

Issue #17644 has been updated by naruse (Yui NARUSE).

Backport changed from 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONTNEED, 3.0: REQUIRED to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONE

ruby_3_0 a6dec2e144d65011d49f272e494bf62daf3d7531 merged revision(s) 5de38c41ae7bf17ae599fdfa9f8face87f16d8bb.

----------------------------------------
Bug #17644: Ripper.lex fails with syntax error and heredoc
https://bugs.ruby-lang.org/issues/17644#change-90700

* Author: shugo (Shugo Maeda)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-02-18T13:35:34Z master 7b9476fbfa) [x86_64-darwin19]
* Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONE
----------------------------------------
`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.




-- 
https://bugs.ruby-lang.org/

           reply	other threads:[~2021-03-02  9:28 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <redmine.issue-17644.20210219073225.12@ruby-lang.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-90700.20210302092845.12@ruby-lang.org \
    --to=naruse@airemix.jp \
    --cc=ruby-dev@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).