From: "Iñaki Baz Castillo" Date: 2011-08-22T08:12:31+09:00 Subject: Possble bug in Ruby parser (Fixnum#times within "case" statement) Hi, I cannot find an explanation for the following issue so I think it's a bug: ----------------------- def kk while case @state when :init 10.times do |index| puts "index = #{index}" end @state = :end true when :end puts "END" end end end @state = :init kk ----------------------- Running the above code gives an error: ~# ruby1.9.3 kk.rb kk.rb:6: syntax error, unexpected keyword_do_cond, expecting keyword_end 10.times do |index| ^ kk.rb:7: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '(' puts "index = #{index}" ^ kk.rb:12: syntax error, unexpected keyword_when, expecting $end when :end ^ Why???? If I replace: 10.times do |index| puts "index = #{index}" end with: 10.times { |index| puts "index = #{index}" } but of course using "do - end" is valid for Fixnum#times !! What is happening? This issue occurs in Ruby 1.8 and 1.9. Any comment please? -- Iñaki Baz Castillo