This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 93044 - redundant "end" generated
Summary: redundant "end" generated
Status: NEW
Alias: None
Product: ruby
Classification: Unclassified
Component: Editing (show other bugs)
Version: 6.x
Hardware: PC Windows Vista
: P3 blocker (vote)
Assignee: issues@ruby
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-23 15:24 UTC by Tomas Danek
Modified: 2011-01-28 20:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Danek 2007-01-23 15:24:41 UTC
#229:

type a line in main.rb

th = Thread.new{while true do c+=1 end}

and push ENTER. Redundant "end" generated below, editor does not show syntax error.
Comment 1 Torbjorn Norbye 2007-01-23 20:09:06 UTC
Same happens for the simpler

while true do c+=1 end

This occurs because in this case, the "do" does NOT have a matching "end";
apparently the grammar for while lets you have a newline, a colon or a do there. 

The same thing is true for until (until false do c+=1 end).

I think the root bug here is that JRuby returns the wrong token for "do" in the
above case - I get a Tokens.kDO instead of a Tokens.kDO_COND. Since I get a kDO
I look for a matching "end", which "while" also does, so it's missing an extra end.
Comment 2 Jiri Kovalsky 2007-07-03 14:04:29 UTC
Reassigning this issue to newly created 'ruby' component.
Comment 3 Torbjorn Norbye 2007-08-04 19:42:10 UTC
This is fixed for the simpler case (while true do c +=1 end) but still broken for the case where while is not first on the line.
Comment 4 pkondzior 2007-08-21 14:16:01 UTC
Try to put this code inline:
th = Thread.new{while true do c+=1 end}

then push enter in between while and true for example:
th = Thread.new{while <enter> true do c+=1 end}

It will produce sth like this
th = Thread.new{while 
    
endtrue do c+=1 end}
Comment 5 Erno Mononen 2009-05-20 09:47:10 UTC
Still valid, needs to be fixed in jruby-parser.
Comment 6 Erno Mononen 2010-04-28 14:01:53 UTC
Still there. My previous comment about that this needs to be fixed in jruby-parser is not right; I guess the comment was meant for another issue.