The Trunk: Collections-nice.306.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Collections-nice.306.mcz

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

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

Name: Collections-nice.306
Author: nice
Time: 13 February 2010, 3:16:04.05 am
UUID: d06e4f5d-dcea-0748-a4b9-191ff89dcff1
Ancestors: Collections-cmm.305

Patch the ugly RunArray scanFrom: which did expect reading an invalid integer would answer 0.
Note: i find it ugly for other reasons...

=============== Diff against Collections-cmm.305 ===============

Item was changed:
  ----- Method: RunArray class>>scanFrom: (in category 'instance creation') -----
  scanFrom: strm
  "Read the style section of a fileOut or sources file.  nextChunk has already been done.  We need to return a RunArray of TextAttributes of various kinds.  These are written by the implementors of writeScanOn:"
  | rr vv aa this |
  (strm peekFor: $( ) ifFalse: [^ nil].
  rr := OrderedCollection new.
  [strm skipSeparators.
  strm peekFor: $)] whileFalse:
  [rr add: (Number readFrom: strm)].
  vv := OrderedCollection new. "Value array"
  aa := OrderedCollection new. "Attributes list"
  [(this := strm next) == nil] whileFalse: [
  this == $, ifTrue: [vv add: aa asArray.  aa := OrderedCollection new].
  this == $a ifTrue: [aa add:
+ (TextAlignment new alignment: (Integer readFrom: strm ifFail: [0]))].
- (TextAlignment new alignment: (Integer readFrom: strm))].
  this == $f ifTrue: [aa add:
+ (TextFontChange new fontNumber: (Integer readFrom: strm ifFail: [0]))].
- (TextFontChange new fontNumber: (Integer readFrom: strm))].
  this == $F ifTrue: [aa add: (TextFontReference toFont:
+ (StrikeFont familyName: (strm upTo: $#) size: (Integer readFrom: strm ifFail: [0])))].
- (StrikeFont familyName: (strm upTo: $#) size: (Integer readFrom: strm)))].
  this == $b ifTrue: [aa add: (TextEmphasis bold)].
  this == $i ifTrue: [aa add: (TextEmphasis italic)].
  this == $u ifTrue: [aa add: (TextEmphasis underlined)].
  this == $= ifTrue: [aa add: (TextEmphasis struckOut)].
  this == $n ifTrue: [aa add: (TextEmphasis normal)].
  this == $- ifTrue: [aa add: (TextKern kern: -1)].
  this == $+ ifTrue: [aa add: (TextKern kern: 1)].
  this == $c ifTrue: [aa add: (TextColor scanFrom: strm)]. "color"
  this == $L ifTrue: [aa add: (TextLink scanFrom: strm)]. "L not look like 1"
  this == $R ifTrue: [aa add: (TextURL scanFrom: strm)].
  "R capitalized so it can follow a number"
  this == $q ifTrue: [aa add: (TextSqkPageLink scanFrom: strm)].
  this == $p ifTrue: [aa add: (TextSqkProjectLink scanFrom: strm)].
  this == $P ifTrue: [aa add: (TextPrintIt scanFrom: strm)].
  this == $d ifTrue: [aa add: (TextDoIt scanFrom: strm)].
  "space, cr do nothing"
  ].
  aa size > 0 ifTrue: [vv add: aa asArray].
  ^ self runs: rr asArray values: vv asArray
  "
  RunArray scanFrom: (ReadStream on: '(14 50 312)f1,f1b,f1LInteger +;i')
  "!