If you assign to a workspace var ...
x := RBParser parseExpression: 'aReceiver aMessage "foo" do: [Transcript show: 42]' onError: [:s :p|^nil].
then you can find the comment in ...
x arguments first body comments
which seems like the wrong place for it to be :(
I had a brief look at the RBParser implementation in VisualWorks, and it seems a bit better. The RBParser>>addCommentsTo: method is called from more places in the code. If you file in the attached changeset and re-run the above then the comment will now be found in ...
x receiver receiver comments
which seems more appropriate.
The second example will also work in a consistent manner...
y := RBParser parseExpression: 'aReceiver aMessage "foo" anotherMessage' onError: [:s :p|^nil]. y receiver receiver comments
rather than "y comments", as before.
Hope that helps, Cheers, Andy
----- Original Message ----- From: "Damien Pollet" damien.pollet@gmail.com To: "The general-purpose Squeak developers list" squeak-dev@lists.squeakfoundation.org Sent: Thursday, June 29, 2006 4:08 PM Subject: BUG? RBParser looses some comments
I can't find the comment when exploring the result of this: RBParser parseExpression: 'aReceiver aMessage "foo" do: [Transcript show: 42]' onError: [:s :p|^nil].
But for this it's OK: RBParser parseExpression: 'aReceiver aMessage "foo" anotherMessage' onError: [:s :p|^nil].
(I'm porting a pretty printer from VW: package Gutenberg on SqueakSource)
Damien Pollet type less, do more