State of the PetitParser

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

State of the PetitParser

Holger Freyther
Hi,

fixing VisualGST helped me to get some more tests passed. From what I can see
now the last fix is to deal with 'Streams' and their offsets. PetitParser is
using internal vars of PositionableStream and my change does not seem to work.

The other part is I had to go away from ==> and >=> and I have picked => and
>< for now but I am looking forward for other options...

I have pushed it to a GST repository on gitorious and hope I will fix the
stream soon and then we have PetitParser that works nicely on GST.

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: State of the PetitParser

Paolo Bonzini-2
On Sat, Aug 28, 2010 at 16:01, Holger Hans Peter Freyther
<[hidden email]> wrote:
> Hi,
>
> fixing VisualGST helped me to get some more tests passed. From what I can see
> now the last fix is to deal with 'Streams' and their offsets. PetitParser is
> using internal vars of PositionableStream and my change does not seem to work.

Which failures are these?  I had ported an older version successfully.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: State of the PetitParser

Holger Freyther
On 08/29/2010 05:30 PM, Paolo Bonzini wrote:

> Which failures are these?  I had ported an older version successfully.

PParserTest is failing trying to copy the string from 0 to 3 which is
obviously wrong. It is something that I have done wrong in the conversion of
PetitParser. As I said it is accessing member variables of PositionableParser
and they are different in GST, I tried to pick selectors and I still have to
understand where PositionableParser starts to count (0 or 1)... so it is more
a learning experience than a tough issue.


The code from the testcase that is failing is below and it fails as "'a'
readStream asPetitStream" is failing..

        parser := $a asParser.
        self assert: (parser parse: 'a' readStream) = $a.

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: State of the PetitParser

Holger Freyther
On 08/29/2010 05:48 PM, Holger Hans Peter Freyther wrote:

> On 08/29/2010 05:30 PM, Paolo Bonzini wrote:
>
>> Which failures are these?  I had ported an older version successfully.
>
> PParserTest is failing trying to copy the string from 0 to 3 which is
> obviously wrong. It is something that I have done wrong in the conversion of
> PetitParser. As I said it is accessing member variables of PositionableParser
> and they are different in GST, I tried to pick selectors and I still have to
> understand where PositionableParser starts to count (0 or 1)... so it is more
> a learning experience than a tough issue.

Okay... self position of a PositionableParser returns 0 on start, so I have
added + 1 and now it seems to work nicely. at least all test cases patch, I
will now update to the latest version of the code.

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: State of the PetitParser

Holger Freyther
On 08/29/2010 05:57 PM, Holger Hans Peter Freyther wrote:

> Okay... self position of a PositionableParser returns 0 on start, so I have
> added + 1 and now it seems to work nicely. at least all test cases patch, I
> will now update to the latest version of the code.

hmmm... so there must be something else that is different from squeak to gst
as 'a' readStream position obviously returns 0 in both cases...

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: State of the PetitParser

Paolo Bonzini-2
On Sun, Aug 29, 2010 at 12:03, Holger Hans Peter Freyther
<[hidden email]> wrote:
> On 08/29/2010 05:57 PM, Holger Hans Peter Freyther wrote:
>
>> Okay... self position of a PositionableParser returns 0 on start, so I have
>> added + 1 and now it seems to work nicely. at least all test cases patch, I
>> will now update to the latest version of the code.
>
> hmmm... so there must be something else that is different from squeak to gst
> as 'a' readStream position obviously returns 0 in both cases...

There are two possible causes:

- The implementation of Streams is different.  The two instance
variables have similar meanings, but the details (e.g. 0- or 1-based)
could differ.

- I don't know if Squeak supports #copyFrom:to: on Streams at all, but
if so that may be different as well.  In GNU Smalltalk, #copyFrom:to:
on Streams is 0-based. While inconsistent with collections, this makes
(a lot of) sense for consistency with the values returned by
#position.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: State of the PetitParser

Holger Freyther
On 08/29/2010 06:08 PM, Paolo Bonzini wrote:

> - I don't know if Squeak supports #copyFrom:to: on Streams at all, but
> if so that may be different as well.  In GNU Smalltalk, #copyFrom:to:
> on Streams is 0-based. While inconsistent with collections, this makes
> (a lot of) sense for consistency with the values returned by
> #position.

The diff is that ReadStream>>on:from:to is assigning vars directly (GST goes
throup the collection and copyFrom:to) and the second diff is that firstIndex
0,1 are treated equally..

e.g. like this (from Pharo 1.1)
position := firstIndex <= 1
                ifTrue: [0]

So next I might copy/merge the SUnit Coverage Changes and then try to figure
out if all my position -> self position calls are correct...

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: State of the PetitParser

Paolo Bonzini-2
On Sun, Aug 29, 2010 at 12:12, Holger Hans Peter Freyther
<[hidden email]> wrote:

> On 08/29/2010 06:08 PM, Paolo Bonzini wrote:
>
>> - I don't know if Squeak supports #copyFrom:to: on Streams at all, but
>> if so that may be different as well.  In GNU Smalltalk, #copyFrom:to:
>> on Streams is 0-based. While inconsistent with collections, this makes
>> (a lot of) sense for consistency with the values returned by
>> #position.
>
> The diff is that ReadStream>>on:from:to is assigning vars directly (GST goes
> throup the collection and copyFrom:to)

This can probably be changed in GST too.  Where/how is this used by PP?

> and the second diff is that firstIndex 0,1 are treated equally..

This seems strange, and I think relying on it is bug-prone...

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk