Scanner.st
changeset 982 f0cc45f113b3
parent 947 5d1d5931e9ee
child 983 bf808a409fd5
--- a/Scanner.st	Mon Oct 04 13:15:43 1999 +0200
+++ b/Scanner.st	Wed Oct 06 15:28:14 1999 +0200
@@ -1553,7 +1553,7 @@
         ].
         value := Integer readFrom:source radix:tokenRadix.
         value := value * s.
-        nextChar := source peekOrNil
+        nextChar := source peekOrNil.
     ].
 
     (nextChar == $.) ifTrue:[
@@ -1576,7 +1576,7 @@
 
     ((nextChar == $e) or:[nextChar == $E]) ifTrue:[
         nextChar := source nextPeek.
-        (nextChar notNil and:[(nextChar isDigitRadix:tokenRadix) or:['+-' includes:nextChar]]) ifTrue:[
+        (nextChar notNil and:[(nextChar isDigit"Radix:tokenRadix") or:['+-' includes:nextChar]]) ifTrue:[
             s := 1.
             (nextChar == $+) ifTrue:[
                 nextChar := source nextPeek
@@ -1586,9 +1586,16 @@
                     s := s negated
                 ]
             ].
-            value := value asFloat
-                     * (10.0 raisedToInteger:((Integer readFrom:source radix:tokenRadix) * s))
-        ]
+            tokenRadix == 10 ifTrue:[
+                "/ for backward compatibility, generate a float with base 10
+                value := value asFloat
+                         * (10 raisedToInteger:((Integer readFrom:source) * s)).
+            ] ifFalse:[
+                value := value
+                         * (tokenRadix raisedToInteger:((Integer readFrom:source) * s)).
+            ].
+            nextChar := source nextPeek.
+        ].
     ].
     nextChar == $- ifTrue:[
         self
@@ -2016,6 +2023,6 @@
 !Scanner class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.107 1999-08-26 11:55:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.108 1999-10-06 13:28:14 cg Exp $'
 ! !
 Scanner initialize!