From: Eric Hodel Date: 2006-04-10T15:18:37+09:00 Subject: Re: Ruby Grammar - "do" On Apr 9, 2006, at 11:06 PM, Bihal wrote: > Hey everyone > > I work for a software development company that is currently writing an > in-house grammar for parsing Ruby. I've been frustrated by it many, > many, many times. Maybe it's easy to program in, but it's a > nightmare to > parse. This list may help you: http://rubyforge.org/mailman/listinfo/rubygrammar-grammarians > My particular question (right now :P) is in reference to the do > keyword. > I was sure that if there was a "do" eg. > > expression.each do | [ > name > ]+ > | > body > end > > there would be an "end". But now I've run into this particular > example. Every do has an end in your example. > def _tags > rv = [ [...] > ].delete_if do |x| ^^ > send(x).nil? > end.collect do |elem| ^^^ ^^ > [nil, elem] > end ^^^ > > @item.each do ^^ > rv << [nil, "item"] > end ^^^ > rv > end This is def's end. PS: Whoever wrote that example code should be taken out for parking- lot therapy. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com