[Pkg] The Trunk: Collections-mt.860.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Nov 18 10:46:32 UTC 2019


Marcel Taeumel uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-mt.860.mcz

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

Name: Collections-mt.860
Author: mt
Time: 18 November 2019, 11:46:33.642051 am
UUID: 53878a25-899e-1d4a-8612-70ebbfefb9fc
Ancestors: Collections-mt.859, Collections-ct.849

Merges and refines Collections-ct.849. Complements CollectionsTests-mt.325.

=============== Diff against Collections-mt.859 ===============

Item was changed:
  ----- Method: String>>findSelector (in category 'converting') -----
  findSelector
  	"Dan's code for hunting down selectors with keyword parts; while this doesn't give a true parse, in most cases it does what we want, in where it doesn't, we're none the worse for it."
  	| sel possibleParens |
  	sel := self withBlanksTrimmed.
+ 	(sel includes: $:)
+ 		ifTrue:
+ 			[sel := sel copyWithRegex: '''[^'']*''' matchesReplacedWith: '''a string'''.
+ 			sel := sel copyWithRegex: '#[^\s\.$]*' matchesReplacedWith: '#aSymbol'.
+ 			sel := sel copyReplaceAll: ':' with: ': '.	"for the style (aa max:bb) with no space"
+ 			sel := sel copyReplaceAll: '[:' with: '[ :'.    "for the style ([:a) with no space"  
+ 			possibleParens := sel substrings.
+ 			sel := self class streamContents:
+ 				[:s | | level |
+ 				level := 0.
+ 				possibleParens do:
+ 					[:token |
+ 					(level = 0 and: [token endsWith: ':'])
+ 						ifTrue: [s nextPutAll: token]
+ 						ifFalse: [level := level
+ 								+ (token occurrencesOf: $() - (token occurrencesOf: $))
+ 								+ (token occurrencesOf: $[) - (token occurrencesOf: $])
+ 								+ (token occurrencesOf: ${) - (token occurrencesOf: $})]]]]
+ 		ifFalse:
+ 			[sel := self substrings ifNotEmpty: [:tokens | tokens last]].
+ 	sel ifEmpty: [^ nil].
+ 	sel first = $# ifTrue:
+ 		[sel := sel allButFirst.
+ 		sel ifEmpty: [^ nil]].
- 	(sel includes: $:) ifTrue:
- 		[sel := sel copyReplaceAll: ':' with: ': '.	"for the style (aa max:bb) with no space"
- 		sel := sel copyReplaceAll: '[:' with: '[ :'.    "for the style ([:a) with no space"  
- 		possibleParens := sel findTokens: Character separators.
- 		sel := self class streamContents:
- 			[:s | | level |
- 			level := 0.
- 			possibleParens do:
- 				[:token |
- 				(level = 0 and: [token endsWith: ':'])
- 					ifTrue: [s nextPutAll: token]
- 					ifFalse: [level := level
- 							+ (token occurrencesOf: $() - (token occurrencesOf: $))
- 							+ (token occurrencesOf: $[) - (token occurrencesOf: $])
- 							+ (token occurrencesOf: ${) - (token occurrencesOf: $})]]]].
- 	sel isEmpty ifTrue: [^ nil].
  	sel isOctetString ifTrue: [sel := sel asOctetString].
+ 	^ Symbol lookup: sel!
- 	Symbol hasInterned: sel ifTrue:
- 		[:aSymbol | ^ aSymbol].
- 	^ nil!



More information about the Packages mailing list