WAJsonParser: crossplatform readStream questions

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

WAJsonParser: crossplatform readStream questions

DiegoLont
Hi all,

Nice to see that more people are working on json at the moment. I currently am working on it to move my data from pharo to gemstone, using magritte json. As Gemstone does not have a String readStream implementation, I decided to take a better look into the parsing done by seaside: and I refactored this a bit, so it only uses the core streaming methods ( peek, next, next: ) and no longer requires the stream to be positionable. I checked the tests: and they are all green, so I committed this change.

Note that I assume that "next: anInteger” conforms to the “c” standard. It returns the next … characters, and if not available a shorter string. If this is not the case, it will cause that on invalid json a different error may be thrown than a WAJsonSyntaxError. Is this a problem for other platforms? And if this is a problem, do you have suggestions how to solve this cross-platform?

Next step is that I add a readstreamFromString: method to grease, since I have to read my json from a string, and the seaside UI only allows me to read it from a stream.
- The pharo implementation will be easy: “^aString readStream”
- I guess I will need to add a basic stream to Gemstone that allows me to “stream” a string. If someone knows a better (easier) solution: let me know.

Cheers,
Diego_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: WAJsonParser: crossplatform readStream questions

Philippe Marschall
On Wed, Feb 26, 2014 at 11:36 AM, Diego Lont <[hidden email]> wrote:
> Hi all,
>
> Nice to see that more people are working on json at the moment. I currently am working on it to move my data from pharo to gemstone, using magritte json. As Gemstone does not have a String readStream implementation, …

Really? Because for example WAUrl class >> #decodePercent: sends
aString readStream

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
Reply | Threaded
Open this post in threaded view
|

Re: WAJsonParser: crossplatform readStream questions

Johan Brichau-2
Exactly:
'foobar' readStream returns an AnsiReadStream in Gemstone.

Diego, is that missing in your Gemstone?

Johan

On 26 Feb 2014, at 21:53, Philippe Marschall <[hidden email]> wrote:

> On Wed, Feb 26, 2014 at 11:36 AM, Diego Lont <[hidden email]> wrote:
>> Hi all,
>>
>> Nice to see that more people are working on json at the moment. I currently am working on it to move my data from pharo to gemstone, using magritte json. As Gemstone does not have a String readStream implementation, …
>
> Really? Because for example WAUrl class >> #decodePercent: sends
> aString readStream
>
> Cheers
> Philippe
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev

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

Re: WAJsonParser: crossplatform readStream questions

DiegoLont
Johan, Philippe,

Sorry for the confusion: I forgot to decode the string from the WAFile, and just used the raw contents. In pharo this resulted in a string, so everything worked fine, but in Gemstone this was a byte array, so I got errors all over the place. And in Gemstone a string gives me a perfectly good read stream.

Now that I fixed this problem I have got it running. I can move my model using Magritte from Pharo to gemstone and vice versa using a json export / import.

Diego

On 26 Feb 2014, at 23:43, Johan Brichau <[hidden email]> wrote:

> Exactly:
> 'foobar' readStream returns an AnsiReadStream in Gemstone.
>
> Diego, is that missing in your Gemstone?
>
> Johan
>
> On 26 Feb 2014, at 21:53, Philippe Marschall <[hidden email]> wrote:
>
>> On Wed, Feb 26, 2014 at 11:36 AM, Diego Lont <[hidden email]> wrote:
>>> Hi all,
>>>
>>> Nice to see that more people are working on json at the moment. I currently am working on it to move my data from pharo to gemstone, using magritte json. As Gemstone does not have a String readStream implementation, …
>>
>> Really? Because for example WAUrl class >> #decodePercent: sends
>> aString readStream
>>
>> Cheers
>> Philippe
>> _______________________________________________
>> seaside-dev mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev

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

Re: WAJsonParser: crossplatform readStream questions

Philippe Marschall
On Fri, Feb 28, 2014 at 9:01 AM, Diego Lont <[hidden email]> wrote:
> Johan, Philippe,
>
> Sorry for the confusion: I forgot to decode the string from the WAFile, and just used the raw contents. In pharo this resulted in a string, so everything worked fine, but in Gemstone this was a byte array, so I got errors all over the place. And in Gemstone a string gives me a perfectly good read stream.

WAFile >> #contentsDecoded
should give you a String always.

Cheers
Philippe
_______________________________________________
seaside-dev mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev