Squeak 3.9: using SqNumberParser in Number>>readFrom:

Matthias Berth matthias.berth at googlemail.com
Sun Mar 25 11:22:46 UTC 2007


I've just tried to remove the check, now I see that you're expecting
nil in those cases.

On 3/25/07, Matthias Berth <matthias.berth at googlemail.com> wrote:
> Looks like empty strings are also not rejected:
>
>   MAStringReader>>read: aStream description: aDescription
>         ^ aStream atEnd
>                 ifFalse: [super read: aStream description: aDescription]
>
> will not use the super method because a stream on an empty string is
> already "atEnd". Would it make sense to remove that check and hand
> over to super anyway?
>
> Matthias
>
> PS: all those subtleties of parsing numbers... SqNumberParser was
> designed for that :-)
>
>
> On 3/25/07, Lukas Renggli <renggli at gmail.com> wrote:
> > > Thanks a lot. I don't know what went wrong with my saving to the
> > > repository, sorry.
> > >
> > > It looks like visitNumberDescription: will raise an error on negative numbers:
> > >
> > >   self contents allSatisfy: [ :each | '0123456789.' includes: each ]
> > >
> > > maybe something like this? :
> > >
> > >   (self contents allButFirst allSatisfy: [ :each | '0123456789.'
> > > includes: each ] )
> > >      and:['-0123456789.' includes self contents first]
> >
> > Indeed, good catch. I will fix this as soon as possible, unless you
> > commit your change ;-)
> >
> > Cheers,
> > Lukas
> >
> > --
> > Lukas Renggli
> > http://www.lukas-renggli.ch
> >
> >
>



More information about the Squeak-dev mailing list