Actions
Bug #20186
openRipper does not generate AST for some keywords in Ruby 3.3
Description
Ripper does not generate AST for the below keyword:
- break
- next
- redo
- retry
- yield
Ruby 3.2
$ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
$ ruby -rripper -e "p Ripper.sexp('break')"
[:program, [[:break, []]]]
$ ruby -rripper -e "p Ripper.sexp('next')"
[:program, [[:next, []]]]
$ ruby -rripper -e "p Ripper.sexp('redo')"
[:program, [[:redo]]]
$ ruby -rripper -e "p Ripper.sexp('retry')"
[:program, [[:retry]]]
$ ruby -rripper -e "p Ripper.sexp('yield')"
[:program, [[:yield0]]]
Ruby 3.3
$ ruby -v
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-linux]
$ ruby -rripper -e "p Ripper.sexp('break')"
nil
$ ruby -rripper -e "p Ripper.sexp('next')"
nil
$ ruby -rripper -e "p Ripper.sexp('redo')"
nil
$ ruby -rripper -e "p Ripper.sexp('retry')"
nil
$ ruby -rripper -e "p Ripper.sexp('yield')"
nil
EDIT)
Here is a case of real-world problem: https://github.com/ruby-formatter/rufo/issues/319
Updated by rdimartino (Robert DiMartino) 7 months ago
Another case of this causing a problem https://github.com/davidwessman/syntax_tree-erb/issues/81
Relevant commits, I believe:
https://github.com/ruby/ruby/commit/e1250a5f9778f463a541bc1ee5a951f64c131bbf
https://github.com/ruby/ruby/commit/29e5fca7181de5f0db372374d5f39704f81f2731
https://github.com/ruby/ruby/commit/b5e23d3e3b5ff2f5328aa43a2392ebe7c951a222
Actions
Like1
Like0Like0