[squeak-dev] The Trunk: Collections-bf.502.mcz
Levente Uzonyi
leves at elte.hu
Sun Mar 3 02:16:00 UTC 2013
The last build on CI server showed that #last is still being used from
many places. While it might be ambiguous in PositionableStream, we need an
alternative in ReadStream.
Levente
On Sat, 2 Mar 2013, commits at source.squeak.org wrote:
> Bert Freudenberg uploaded a new version of Collections to project The Trunk:
> http://source.squeak.org/trunk/Collections-bf.502.mcz
>
> ==================== Summary ====================
>
> Name: Collections-bf.502
> Author: bf
> Time: 2 March 2013, 1:45:38.248 pm
> UUID: 87a84004-6bba-4930-acf3-a86574e1f415
> Ancestors: Collections-fbs.501
>
> Sundry changes:
> * deal with "[:" and "{}" in String>>findSelector
> * process numeric entities in String>>asUnHtml
> * remove PositionableStream>>last (unused, buggy)
>
> =============== Diff against Collections-fbs.501 ===============
>
> Item was removed:
> - ----- Method: PositionableStream>>last (in category 'accessing') -----
> - last
> - "Return the final element in the receiver"
> -
> - ^ collection at: position!
>
> Item was changed:
> ----- Method: String>>asUnHtml (in category 'converting') -----
> asUnHtml
> "Strip out all Html stuff (commands in angle brackets <>) and convert
> the characters &<> back to their real value. Leave actual cr and tab as
> they were in text."
> | in out char rest |
> in := ReadStream on: self.
> out := WriteStream on: (String new: self size).
> [in atEnd] whileFalse:
> [in peek = $<
> ifTrue: [in unCommand] "Absorb <...><...>"
> ifFalse: [(char := in next) = $&
> ifTrue: [rest := in upTo: $;.
> out nextPut: (HtmlEntities
> at: rest
> + ifAbsent: [
> + (rest beginsWith: '#')
> + ifTrue: [Character value: rest allButFirst asInteger]
> + ifFalse: [Character space]])]
> - ifAbsent: [Character space])]
> ifFalse: [out nextPut: char]].
> ].
> ^ out contents!
>
> 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 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.
> - level := 0.
> possibleParens do:
> + [:token |
> - [:token | | n |
> (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: [(n := token occurrencesOf: $( ) > 0 ifTrue: [level := level + n].
> - (n := token occurrencesOf: $[ ) > 0 ifTrue: [level := level + n].
> - (n := token occurrencesOf: $] ) > 0 ifTrue: [level := level - n].
> - (n := token occurrencesOf: $) ) > 0 ifTrue: [level := level - n]]]]].
> -
> sel isEmpty ifTrue: [^ nil].
> sel isOctetString ifTrue: [sel := sel asOctetString].
> Symbol hasInterned: sel ifTrue:
> [:aSymbol | ^ aSymbol].
> ^ nil!
>
>
>
More information about the Squeak-dev
mailing list
|