[squeak-dev] The Trunk: Collections-nice.296.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Feb 8 09:25:59 UTC 2010


Nicolas Cellier uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-nice.296.mcz

==================== Summary ====================

Name: Collections-nice.296
Author: nice
Time: 8 February 2010, 10:25:43.56 am
UUID: dacf815d-700c-8142-96be-528521efc1a4
Ancestors: Collections-ar.295

Change String>>initialize to force an initialization.
An initialization is required because current definition of CSNonSeparators class var does not handle WideString correctly.
Example: (String with: 375 asCharacter) withBlanksTrimmed should not be empty...

=============== Diff against Collections-ar.295 ===============

Item was changed:
  ----- Method: String class>>initialize (in category 'initialization') -----
  initialize   "self initialize"
  
  	| order |
  	AsciiOrder := (0 to: 255) as: ByteArray.
  
  	CaseInsensitiveOrder := AsciiOrder copy.
  	($a to: $z) do:
  		[:c | CaseInsensitiveOrder at: c asciiValue + 1
  				put: (CaseInsensitiveOrder at: c asUppercase asciiValue +1)].
  
  	"Case-sensitive compare sorts space, digits, letters, all the rest..."
  	CaseSensitiveOrder := ByteArray new: 256 withAll: 255.
  	order := -1.
  	' 0123456789' do:  "0..10"
  		[:c | CaseSensitiveOrder at: c asciiValue + 1 put: (order := order+1)].
  	($a to: $z) do:     "11-64"
  		[:c | CaseSensitiveOrder at: c asUppercase asciiValue + 1 put: (order := order+1).
  		CaseSensitiveOrder at: c asciiValue + 1 put: (order := order+1)].
  	1 to: CaseSensitiveOrder size do:
  		[:i | (CaseSensitiveOrder at: i) = 255 ifTrue:
  			[CaseSensitiveOrder at: i put: (order := order+1)]].
  	order = 255 ifFalse: [self error: 'order problem'].
  
  	"a table for translating to lower case"
  	LowercasingTable := String withAll: (Character allByteCharacters collect: [:c | c asLowercase]).
  
  	"a table for translating to upper case"
  	UppercasingTable := String withAll: (Character allByteCharacters collect: [:c | c asUppercase]).
  
  	"a table for testing tokenish (for fast numArgs)"
  	Tokenish := String withAll: (Character allByteCharacters collect:
  									[:c | c tokenish ifTrue: [c] ifFalse: [$~]]).
  
  	"CR and LF--characters that terminate a line"
+ 	CSLineEnders := CharacterSet crlf.
- 	CSLineEnders := CharacterSet empty.
- 	CSLineEnders add: Character cr.
- 	CSLineEnders add: Character lf.
  
   	"separators and non-separators"
  	CSSeparators := CharacterSet separators.
  	CSNonSeparators := CSSeparators complement.!




More information about the Squeak-dev mailing list