[ENH] ANSI QuotedStringSymbolsPatch
R. A. Harmon
harmonra at webname.com
Thu Oct 7 21:09:19 UTC 1999
This is Stefan Matthias Aust's ANSI QuotedStringSymbolsPatch originally for
2.4 but modified and reposted by me for 2.5 (I just dropped his Symbol
class<<#intern: method).
I'd also like to see it incorporated into the base system.
'From Squeak 2.5 of August 6, 1999 on 27 September 1999 at 4:49:32 pm'!
"Change Set: QuotedStringSymbolsPatch
Date: 31 December 1998
Author: Stefan Matthias Aust (sma at kiel.netsurf.de)
Add support for quoted symbols (#'abc'). I'd love to see this
change getting incorporated into the base system. It slightly
extends the system without breaking compatibility.
!Scanner methodsFor: 'multi-character scans' stamp: 'sma 12/31/1998 11:25'!
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:
[(#(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:
[tokenType==#string ifTrue: [token _ token asSymbol]]]].
tokenType _ #literal
" #(Pen)
#Pen
#'Pen'
##Pen
###Pen
"! !
--
Richard A. Harmon "The only good zombie is a dead zombie"
harmonra at webname.com E. G. McCarthy
Spencer, Iowa
More information about the Squeak-dev
mailing list
|