Hi Frank,

> I asked Lukas and he said that since others would be interested, I
> should repost the question here. So:

Thanks!

> Gnu Smalltalk's class variable declarations take the form of
> [<identifier> := <expression>.]* at the end of an object definition.
> To that end I wrote a #classVars production like so:
>
>   classVars
>       ^ (assignment , expression , $. asParser) star
>       "Possibly I need to support the lack of a dot on the last
> expression. Not relevant at the moment"

This seems to be indeed the same problem as the simpler case below ...

> This didn't work as expected. Looking further, I found this oddity:
>
>   p := PPSmalltalkParser new.
>   p number end parse: '1.' "=> #(#(nil #($1) nil) 1.0)"
>
> I would expect this to fail, because "1." isn't a number (but see below).

This fails in Pharo 1.3. In fact, in Pharo the following statements
return 'false':

  | s |
  s := '1.' readStream.
  Number readFrom: s.
  s atEnd

That is, #readFrom: really only consumes what it can. I don't know
what Smalltalk you use, but I guess your image consumes the $. and
returns 'true'. Not sure if this can be called a bug, but it is
definitely a bit strange. The definition of a valid number literal is
quite different among different Smalltalk dialects, thus I decided to
rely on the built-in implementation of Number class>>#readFrom:.

Lukas

-- 
Lukas Renggli
www.lukas-renggli.ch

Reply via email to