Project

General

Profile

Bug #20186

Updated by kzkn (Kazuki Nishikawa) 10 months ago

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

Back