Project

General

Profile

Actions

Bug #3116

closed

block call with `do' keyword in `until' condition causes parse error

Added by mame (Yusuke Endoh) over 14 years ago. Updated over 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2dev (2010-04-09 trunk 27030) [i686-linux]
Backport:
[ruby-core:29383]

Description

=begin
(derived from #1240)

I noticed that block call with do' keyword does not work in until' condition:

until begin 1.times { } end do end # ok
until begin 1.times do end end do end # parse error
~~
until if true then 1.times { } end do end # ok
until if true then 1.times do end end do end # parse error
~~
until until true do 1.times { } end do end # ok
until until true do 1.times do end end do end # parse error
~~
until class Foo; 1.times { } ; end do end # ok
until class Foo; 1.times do end; end do end # parse error
~~
until case; when true; 1.times { } ; end do end # ok
until case; when true; 1.times do end; end do end # parse error
~~

This is because the underlined do's are not considered as block call but beginning of until' body.

Although this is confusing a little and can be actually fixed, the fix
needs many COND_PUSH(0)/COND_POP(), which may decrease performance and
code maintenability. In addition, writing such a long and complex
condition directly is absolutely bad (even insane) style.

So, I think there is no need to fix.

--
Yusuke Endoh
=end

No data to display

Actions

Also available in: Atom PDF

Like0