#FEATURE by cg
class: Scanner
changed: #nextNumber
option to generate single precision floats.
--- a/Scanner.st Sun May 26 11:33:51 2019 +0200
+++ b/Scanner.st Sun May 26 11:37:08 2019 +0200
@@ -3110,16 +3110,18 @@
Allows for
e, d or q to be used as exponent limiter (for float or long float),
s for scaled fixpoint numbers,
- f for single precision floats.
+ f for single precision floats (controlled by parserFlags).
+
i.e. 1e5 -> float (technically a double precision IEEE)
1d5 -> float (also, a double precision IEEE)
1q5 -> long float (a c-long double / quad precision IEEE)
1s -> a fixed point with precision from number of digits given.
1s5 -> a fixed point with 5 digits precision.
- 1f5 -> shortFloat (technically a single precision IEEE float).
- 1f -> shortFloat (technically a single precision IEEE float).
1d -> float (technically a double precision IEEE float).
1q -> long float (technically a c-long double / quad precision IEEE float).
+
+ 1f5 -> shortFloat (technically a single precision IEEE float) or float.
+ 1f -> shortFloat (technically a single precision IEEE float) or float.
support for scaled decimals can be disabled, if code needs to be read,
which does not know about them (very unlikely)"
@@ -3182,7 +3184,7 @@
(nextChar == $q or:[nextChar == $Q]) ifTrue:[
value := value asLongFloat
] ifFalse:[
- false "(nextChar == $f or:[nextChar == $F])" ifTrue:[
+ ((nextChar == $f or:[nextChar == $F]) and:[parserFlags singlePrecisionFloatF]) ifTrue:[
value := value asShortFloat
] ifFalse:[
value := value asFloat.
@@ -3262,7 +3264,7 @@
^ tokenType
"Modified: / 15-06-2017 / 11:07:52 / cg"
- "Modified: / 20-11-2018 / 17:06:15 / Claus Gittinger"
+ "Modified: / 26-05-2019 / 11:36:02 / Claus Gittinger"
!
nextPrimitive