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)
2006/6/29, Damien Pollet damien.pollet@gmail.com:
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
Hi,
I'm intrested in your problème. Can you tell me what "comment" for Thx
Math
On 6/29/06, Mathieu SUEN mathk.sue@gmail.com wrote:
Can you tell me what "comment" for
What do you mean ?
The "foo" comment in the code string does (or does not) appear in the AST returned by #parseExpression:onError:
2006/6/29, Damien Pollet damien.pollet@gmail.com:
On 6/29/06, Mathieu SUEN mathk.sue@gmail.com wrote:
Can you tell me what "comment" for
What do you mean ?
The "foo" comment in the code string does (or does not) appear in the AST returned by #parseExpression:onError:
Ok Sorry I thought you were talking about the atribut "comment" in the node of the AST :-) Math
-- Damien Pollet type less, do more
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
On 6/29/06, Andrew Tween amtween@hotmail.com wrote:
If you file in the attached changeset and re-run the above then the comment will now be found in ...
Thanks !
squeak-dev@lists.squeakfoundation.org