>According to the Blue Book, #; is not a valid symbol constant.
Yes; the current Squeak Scanner is a bit lax about accepting erroneous
tokens following the hash.
>Now, according to ANSI, #';' is a valid string constant, so
^^^^^^^^^^^^^^^^
to clarify, ';' is a String constant, #';' is a hashed String constant
which is a Symbol.
>the code:
> ';' asSymbol == #';'
>in Dolphin gives 'true' but in Squeak, it is ' false'.
>Who's right?
Squeak currently treats a hashed String constant as the String constant,
rather than it's associated Symbol. This should be fixed to bring it
more in line with the ANSI requirements.
Both of these changes are fairly easy, and can be done within
Scanner>>xLitQuote:
----
'From Squeak 1.31 of Feb 4, 1998 on 9 April 1998 at 1:22:23 pm'!
!Scanner methodsFor: 'multi-character scans' stamp: 'tao 4/9/98 13:20'!
xLitQuote
"UniqueStrings and vectors: #(1 (4 5) 2 3) #ifTrue:ifFalse:.
For ##x answer #x->nil. For ###x answer nil->#x."
| start |
self step. "litQuote"
self scanToken.
tokenType = #leftParenthesis
ifTrue:
[start _ mark.
self scanToken; scanLitVec.
tokenType == #doIt
ifTrue: [mark _ start.
self offEnd: 'Unmatched parenthesis']]
ifFalse:
[tokenType = #string
ifTrue: [token _ token asSymbol]
ifFalse:
[(#(word keyword colon ) includes: tokenType)
ifTrue:
[self scanLitWord]
ifFalse:
[(tokenType==#literal)
ifTrue:
[(token isMemberOf: Association)
ifTrue: "###word"
[token _ nil->token key].
(token isMemberOf: Symbol)
ifTrue: "##word"
[token _ token->nil]]
ifFalse:
[^ self offEnd: 'selector, string, or array constant
expected']]]].
tokenType _ #literal
" #(Pen)
#'Pen'
#Pen
##Pen
###Pen
"! !
-- tim