From: Jeremy Walker Date: 2012-05-16T09:53:08+09:00 Subject: Re: Command vs method in Ripper --f46d043d67edc7112604c01cbdf1 Content-Type: text/plain; charset=ISO-8859-1 On 16 May 2012 00:17, Ryan Davis wrote: > > On May 13, 2012, at 16:53 , Jeremy W. wrote: > > > Hi guys, > > > > I've been playing around with Ripper for the first time today. Parsing > > method calls with and without parentheses gives me different output and > > I'm not sure why. When using brackets, Ripper outputs a 'method', > > without them gives me a 'command'. > > > > Are these actually different things inside Ruby, or is this just a > > difference in the way Ripper outputs them? > > > > If there is a internal difference between them, could someone please > > point me to either some more information, or the relevant bit of the > > Ruby source code I need to read to learn more. > > > > If they are not different internally, what is the reason that Ripper > > displays them as such? > > Because ripper shows too much detail about the way the parse tree is > engineered and not about the semantics of the language itself. This is (I > suspect) because ripper was done "on the cheap" by reusing the parse.y file > and injecting different terminal actions using #ifdef's. > > Right, that was all exceedingly helpful - thank you. My issue with ruby_parser was that it didn't seem to support things like Ruby 1.9 hashes. Would I be right in presuming that the new release will support 1.9 and that in the interim I can just get the source from Github and use that? If so then I'll use ruby_parser instead of ripper and move forward from there. Its output seems to be cleaner and clearer, and I can work through the repos on Github, especially ruby2ruby, to get a good grasp of the sexp that it is outputting. Thanks again for your help. If I do have any more questions regarding your projects, is there a preferred method for me to ask (this list, email, etc)? Jeremy --f46d043d67edc7112604c01cbdf1 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 16 May 2012 00:17, Ryan Davis <ryand-= ruby@zenspider.com> wrote:

On May 13, 2012, at 16:53 , Jeremy W. wrote:

> Hi guys,
>
> I've been playing around with Ripper for the first time today. =A0= Parsing
> method calls with and without parentheses gives me different output an= d
> I'm not sure why. When using brackets, Ripper outputs a 'metho= d',
> without them gives me a 'command'.
>
> Are these actually different things inside Ruby, or is this just a
> difference in the way Ripper outputs them?
>
> If there is a internal difference between them, could someone please > point me to either some more information, or the relevant bit of the > Ruby source code I need to read to learn more.
>
> If they are not different internally, what is the reason that Ripper > displays them as such?

Because ripper shows too much detail about the way the parse tree is = engineered and not about the semantics of the language itself. This is (I s= uspect) because ripper was done "on the cheap" by reusing the par= se.y file and injecting different terminal actions using #ifdef's.

=A0
Right, that was all exceedingly helpful= - thank you.

My issue with ruby_parser was that i= t didn't seem to support things like Ruby 1.9 hashes. Would I be right = in presuming that the new release will support 1.9 and that=A0in the interi= m I can=A0just get the source from Github and use that?

If so then I'll use ruby_parser instead of ripper a= nd move forward from there. Its output seems to be cleaner and clearer, and= I can work through the repos on Github, especially ruby2ruby, to get a goo= d grasp of the sexp that it is outputting.

Thanks again for your help. If I do have any more quest= ions regarding your projects, is there a preferred method for me to ask (th= is list, email, etc)?
Jeremy
--f46d043d67edc7112604c01cbdf1--