[BUG][FIX] Symbol parsing and printing

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Thu Apr 27 11:36:50 UTC 2000


Hi,

now that Scanner>>#isLiteralSymbol: finds a good use in Symbol printing,
I found out it's wrong. And it seems it was wrong for ages ;-)

The problem is that #'3' prints as #3. Oops! Okay, print calls store,
store tests if this is a literal symbol.

There is a comment (really!) that goes like "isLiteralSymbol: Test whether
a symbol can be stored as # followed by its characters.  Symbols created
internally with asSymbol may not have this property, e.g. '3' asSymbol."

So, I evaluate (Scanner isLiteralSymbol: '3' asSymbol). It answers true!
Now, who's responsible for checking if examples do what say claim? ;-)
It seems like single char symbols need special treatment ... A fix is
attached. It explicitely tests for digits - I'm not sure if there are
other bad chars. 

It also includes $#, because #'#' didn't print like this, and ## produces 
a strange symbol with char value 30. I guess that's a scanner bug. Also,
both #$ and #3 give a walkback in Parser>>#previousTokenSize instead of a
syntax error. No fix for that though ... :-(

  -Bert-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: digitSymbols-bf.1.cs.gz
Type: application/octet-stream
Size: 646 bytes
Desc: 
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20000427/6235188e/digitSymbols-bf.1.cs.obj


More information about the Squeak-dev mailing list