Scanner.st
changeset 1673 3f64c0d10a4e
parent 1663 804edcc95bd7
child 1676 b8122adeb8a6
equal deleted inserted replaced
1672:56c0720718f4 1673:3f64c0d10a4e
  2303     "Modified: / 5.3.1998 / 02:54:11 / cg"
  2303     "Modified: / 5.3.1998 / 02:54:11 / cg"
  2304 !
  2304 !
  2305 
  2305 
  2306 nextNumber
  2306 nextNumber
  2307     "scan a number; handles radix prefix, mantissa and exponent.
  2307     "scan a number; handles radix prefix, mantissa and exponent.
  2308      Does not yet handle fixNums. Allows for e, d or q to be used as exponent
  2308      Allows for e, d or q to be used as exponent limiter."
  2309      limiter."
       
  2310 
  2309 
  2311     |pos1 nextChar value integerPart s tokenRadix mantissaAndScaledPart d type exp|
  2310     |pos1 nextChar value integerPart s tokenRadix mantissaAndScaledPart d type exp|
  2312 
  2311 
  2313     tokenRadix := 10.
  2312     tokenRadix := 10.
  2314     type := #Integer.
  2313     type := #Integer.
  2385         value isLimitedPrecisionReal ifTrue:[
  2384         value isLimitedPrecisionReal ifTrue:[
  2386             "/ no type specified - makes it a float
  2385             "/ no type specified - makes it a float
  2387             value := value asFloat.
  2386             value := value asFloat.
  2388         ].
  2387         ].
  2389 
  2388 
  2390         AllowFixedPointLiterals == true ifTrue:[
  2389         parserFlags allowFixedPointLiterals == true ifTrue:[
  2391             "/ Dolphin scaledDecimal numbers
  2390             "/ Dolphin scaledDecimal numbers
  2392             ('s' includes:nextChar) ifTrue:[
  2391             ('s' includes:nextChar) ifTrue:[
  2393                 nextChar := source nextPeek.
  2392                 nextChar := source nextPeek.
  2394                 mantissaAndScaledPart isNil ifTrue:[
  2393                 mantissaAndScaledPart isNil ifTrue:[
  2395                     value := value asFixedPoint:1 
  2394                     value := value asFixedPoint:1 
  3039 ! !
  3038 ! !
  3040 
  3039 
  3041 !Scanner class methodsFor:'documentation'!
  3040 !Scanner class methodsFor:'documentation'!
  3042 
  3041 
  3043 version
  3042 version
  3044     ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.210 2006-02-08 15:32:49 cg Exp $'
  3043     ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.211 2006-02-13 22:03:45 cg Exp $'
  3045 ! !
  3044 ! !
  3046 
  3045 
  3047 Scanner initialize!
  3046 Scanner initialize!