The Trunk: Kernel-nice.404.mcz

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

The Trunk: Kernel-nice.404.mcz

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

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

Name: Kernel-nice.404
Author: nice
Time: 23 February 2010, 3:14:34.835 pm
UUID: 602205a3-29f5-9240-9436-c42070a48cea
Ancestors: Kernel-nice.403

Connect ExtendedNumberParser in Number class>>#readFrom: and some variants

Current behavior is:
'' asNumber -> Error (used to be 0)
'1.' asNumber -> 1.0 (used to be 1)
'1.e2' asNumber -> 100.0
'1.e+2' asNumber -> 100.0 (NEW)
'+1' asNumber -> 1 (NEW)

OLD weird squeak behaviour preserved for sign position:
'-16rFF' asNumber ->-255
'16r-FF' asNumber ->-255
-16r-FF' asNumber -> 255
(NOW has same with +)

These ones used to fail:
'1r0' asNumber -> 1 (ignore the rest from $r to end)
'2r3' asNumber -> 2 (ignore the rest from $r to end)

Changes due to 16rff from Andreas
'16r1.e2' asNumber  -> 1.8828125 (used to be 4096.0)

Now time to raise your voice...


=============== Diff against Kernel-nice.403 ===============

Item was changed:
  ----- Method: Integer class>>readFrom:ifFail: (in category 'instance creation') -----
  readFrom: aStringOrStream ifFail: aBlock
  "Answer an instance of one of the concrete subclasses if Integer.
+ Initial plus or minus sign accepted.
+ Imbedded radix specifiers not allowed;  use Number class readFrom: for that.
- Initial minus sign accepted.
- Imbedded radix specifiers not allowed;  use Number
- class readFrom: for that.
  Execute aBlock if there are no digits."
 
+ ^(ExtendedNumberParser on: aStringOrStream) nextIntegerBase: 10 ifFail: aBlock!
- ^(SqNumberParser on: aStringOrStream) nextIntegerBase: 10 ifFail: aBlock!

Item was changed:
  ----- Method: Number class>>readFrom: (in category 'instance creation') -----
  readFrom: stringOrStream
  "Answer a number as described on aStream.  The number may
  be any accepted Smalltalk literal Number format.
  It can include a leading radix specification, as in 16rFADE.
  It can as well be NaN, Infinity or -Infinity for conveniency.
  If stringOrStream does not start with a valid number description, fail."
 
+ ^(ExtendedNumberParser on: stringOrStream) nextNumber!
- ^(SqNumberParser on: stringOrStream) nextNumber!

Item was changed:
  ----- Method: Number class>>readFrom:ifFail: (in category 'instance creation') -----
  readFrom: stringOrStream ifFail: aBlock
  "Answer a number as described on aStream.  The number may
  be any accepted Smalltalk literal Number format.
  It can include a leading radix specification, as in 16rFADE.
  It can as well be NaN, Infinity or -Infinity for conveniency.
  If input does not represent a valid number, then execute fail block
  and leave the stream positioned before offending character"
 
+ ^(ExtendedNumberParser on: stringOrStream) failBlock: aBlock; nextNumber!
- ^(SqNumberParser on: stringOrStream) failBlock: aBlock; nextNumber!

Item was changed:
  ----- Method: Integer class>>readFrom:base: (in category 'instance creation') -----
  readFrom: aStringOrStream base: base
  "Answer an instance of one of the concrete subclasses if Integer.
+ Initial plus or minus sign accepted, and bases > 10 use letters A-Z.
+ Imbedded radix specifiers not allowed;  use Number class readFrom: for that.
- Initial minus sign accepted, and bases > 10 use letters A-Z.
- Imbedded radix specifiers not allowed;  use Number
- class readFrom: for that.
  Raise an Error if there are no digits."
 
+ ^(ExtendedNumberParser on: aStringOrStream) nextIntegerBase: base!
- ^(SqNumberParser on: aStringOrStream) nextIntegerBase: base!

Item was removed:
- ----- Method: Number class>>readExactlyFrom: (in category 'instance creation') -----
- readExactlyFrom: stringOrStream
- "Answer a number as described on aStream. The number may
- include a leading radix specification, as in 16rFADE"
-
- ^(SqNumberParser on: stringOrStream) nextNumber!