Hi Stef, I'm reporting a bug in PetitSmalltalk, so why don't we concentrate on that?
frank On 11 August 2011 21:56, Stéphane Ducasse <[email protected]> wrote: > frank > just to be clear, we do not like the GNU syntax for Coral, else we > would have done it before. > See my reply to your question in the coral mailing-lits > > I think that > Eval [] > Class [] > Import [] > > > but I do not want nested definition nor class extension or class definition > as in GNU. So if you want a GNU syntax > then make sure that it is optional and that we can get coral without it. > > Stef > > On Aug 11, 2011, at 10:48 PM, Frank Shearar wrote: > >> I'm extending Coral to support Gnu Smalltalk syntax, and ran into >> something strange. >> >> I asked Lukas and he said that since others would be interested, I >> should repost the question here. So: >> >> 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 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). >> >> Indeed, ripping out the parser of #number: >> >> n := ($- asParser optional , #digit asParser plus , ($. asParser , >> #digit asParser plus) optional) end. >> n parse: '1.' "=> end of input expected at 1" >> >> So I experimented a bit, and it seems like#number is being overly >> eager in consuming that $. character, and Number >> #readFrom:'s >> reading '1.': >> >> Number readFrom: '1.' readStream "=> 1.0" >> >> p := PPSmalltalkParser new. >> p number end parse: '1' "=> #(#(nil #($1) nil) 1)" >> >> p := PPSmalltalkParser new. >> p number end parse: '1.0' "=> #(#(nil #($1) #($. #($0))) 1.0)" >> >> p := PPSmalltalkParser new. >> p number end parse: '1. ' "=> end of input expected at 2" >> >> Or am I being silly? >> >> frank >> > >
