Symbol.st
changeset 5941 e194c325bee8
parent 5896 444e6b63acb5
child 6001 315a853c51cd
equal deleted inserted replaced
5940:804fb27727a6 5941:e194c325bee8
   527 
   527 
   528 storeString
   528 storeString
   529     "return a String for storing the receiver"
   529     "return a String for storing the receiver"
   530 
   530 
   531     |sz "{Class: SmallInteger }" 
   531     |sz "{Class: SmallInteger }" 
   532      c|
   532      c anyColon|
   533 
   533 
   534     (sz := self size) > 0 ifTrue:[  "/ sigh
   534     (sz := self size) > 0 ifTrue:[  "/ sigh
   535         (self at:1) isLetter ifTrue:[
   535         (self at:1) isLetter ifTrue:[
       
   536             anyColon := false.
   536             2 to:sz do:[:index |
   537             2 to:sz do:[:index |
   537                 ((c := self at:index) isLetterOrDigit 
   538                 c := self at:index.
       
   539                 c == $: ifTrue:[ anyColon := true ].
       
   540                 (c isLetterOrDigit 
   538                  or:[c == $: 
   541                  or:[c == $: 
   539                      and:[index == sz 
   542                      and:[index == sz 
   540                           or:[(self at:(index+1)) isLetterOrDigit]]]
   543                           or:[(self at:(index+1)) isLetterOrDigit]]]
   541                 ) ifFalse:[
   544                 ) ifFalse:[
   542                     ^ '#' , super storeString 
   545                     ^ '#' , super storeString 
   543                 ].
   546                 ].
       
   547             ].
       
   548             anyColon ifTrue:[
       
   549                 self last == $: ifFalse:[
       
   550                     ^ '#' , super storeString 
       
   551                 ]
   544             ].
   552             ].
   545             ^ '#' , self
   553             ^ '#' , self
   546         ]
   554         ]
   547     ].
   555     ].
   548     ^ '#' , super storeString
   556     ^ '#' , super storeString
   557       #'abcdef::'  storeString  
   565       #'abcdef::'  storeString  
   558       #'hello''world'  storeString  
   566       #'hello''world'  storeString  
   559       #'' storeString               
   567       #'' storeString               
   560       #'''' storeString               
   568       #'''' storeString               
   561       #'_hello' storeString     
   569       #'_hello' storeString     
       
   570       #'abcdef:'  storeString   
       
   571       #'abc:def:'  storeString  
       
   572       #'abc:def'  storeString  
   562     "
   573     "
   563 
   574 
   564     "Modified: / 13.2.1998 / 22:06:15 / stefan"
   575     "Modified: / 13.2.1998 / 22:06:15 / stefan"
   565 ! !
   576 ! !
   566 
   577 
   684 ! !
   695 ! !
   685 
   696 
   686 !Symbol class methodsFor:'documentation'!
   697 !Symbol class methodsFor:'documentation'!
   687 
   698 
   688 version
   699 version
   689     ^ '$Header: /cvs/stx/stx/libbasic/Symbol.st,v 1.66 2001-07-31 15:05:59 cg Exp $'
   700     ^ '$Header: /cvs/stx/stx/libbasic/Symbol.st,v 1.67 2001-09-03 16:13:53 cg Exp $'
   690 ! !
   701 ! !