Levente Uzonyi uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-ul.713.mcz==================== Summary ====================
Name: System-ul.713
Author: ul
Time: 1 April 2015, 11:14:28.116 pm
UUID: 226e90db-d97f-4958-9fa6-97a0b23cfff3
Ancestors: System-eem.712
Use a custom CharacterSet for separators instead of modifying the one in CharacterSet - which may be shared. Cache it for better performance, and get rid of it during cleanUp.
=============== Diff against System-eem.712 ===============
Item was changed:
TextDiffBuilder subclass: #ClassDiffBuilder
instanceVariableNames: ''
+ classVariableNames: 'SeparatorSet'
- classVariableNames: ''
poolDictionaries: ''
category: 'System-FilePackage'!
+ !ClassDiffBuilder commentStamp: 'ul 4/1/2015 23:10' prior: 0!
+ I'm like TextDiffBuilder, but I split the input text by my own set of separator characters (see #separatorSet), instead of new lines. I'm meant to create diffs of class definitions.!
- !ClassDiffBuilder commentStamp: 'fbs 9/23/2013 08:58' prior: 0!
- I'm like TextDiffBuilder, but I split the input text by Character >> #separators, instead of new lines. I'm probably meant to create diffs of class definitions.!
Item was added:
+ ----- Method: ClassDiffBuilder class>>cleanUp: (in category 'as yet unclassified') -----
+ cleanUp: aggressive
+
+ SeparatorSet := nil!
Item was added:
+ ----- Method: ClassDiffBuilder class>>separatorSet (in category 'as yet unclassified') -----
+ separatorSet
+
+ ^SeparatorSet ifNil: [
+ SeparatorSet := CharacterSet separators copy
+ add: $'; "for variables"
+ add: $"; "for comments in mc"
+ yourself ]!
Item was changed:
----- Method: ClassDiffBuilder>>split: (in category 'private') -----
split: aString
"I return an Array or DiffElements containing aString splitted by whitespace ' and ""."
^Array streamContents: [ :stream |
| input separators |
input := aString readStream.
+ separators := self class separatorSet.
- separators := CharacterSet separators
- add: $'; "for variables"
- add: $"; "for comments in mc"
- yourself.
[ input atEnd ] whileFalse: [
| word separator |
word := input
upToAnyOf: separators
+ do: [ :matchingSeparator | separator := matchingSeparator ].
- do: [ :matchingSeparator |
- separator := matchingSeparator ].
stream nextPut: (DiffElement string: word).
separator ifNotNil: [
stream nextPut: (DiffElement string: separator asString) ] ] ]!