BUG? RBParser looses some comments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

BUG? RBParser looses some comments

Damien Pollet
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

Reply | Threaded
Open this post in threaded view
|

Re: BUG? RBParser looses some comments

Mathieu SUEN
2006/6/29, Damien Pollet <[hidden email]>:

> 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

Reply | Threaded
Open this post in threaded view
|

Re: BUG? RBParser looses some comments

Damien Pollet
On 6/29/06, Mathieu SUEN <[hidden email]> 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:

--
 Damien Pollet
 type less, do more

Reply | Threaded
Open this post in threaded view
|

Re: BUG? RBParser looses some comments

Andrew Tween
In reply to this post by Damien Pollet
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" <[hidden email]>
To: "The general-purpose Squeak developers list"
<[hidden email]>
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
>
>



RBParserFixes.2.cs (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: BUG? RBParser looses some comments

Damien Pollet
On 6/29/06, Andrew Tween <[hidden email]> wrote:
> If you file in the attached changeset and re-run the above then the comment will
> now be found in ...

Thanks !

--
 Damien Pollet
 type less, do more

Reply | Threaded
Open this post in threaded view
|

Re: BUG? RBParser looses some comments

Mathieu SUEN
In reply to this post by Damien Pollet
2006/6/29, Damien Pollet <[hidden email]>:
> On 6/29/06, Mathieu SUEN <[hidden email]> 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
>
>