#REFACTORING by stefan cvs_MAIN
authorStefan Vogel <sv@exept.de>
Sun, 10 Jul 2016 21:30:36 +0200
branchcvs_MAIN
changeset 3592 7c908a023933
parent 3590 365bd823e3d1
child 3593 6734b9db3e23
#REFACTORING by stefan class: JavaScanner changed: #exponentPart: #hexponentPart: #nextIdentifier (send #nextPeekOrNil instead of #nextPeek) #nextNumber (send #nextPeekOrNil instead of #nextPeek)
tools/JavaScanner.st
--- a/tools/JavaScanner.st	Thu Jul 07 20:21:19 2016 +0200
+++ b/tools/JavaScanner.st	Sun Jul 10 21:30:36 2016 +0200
@@ -11,6 +11,8 @@
 "
 "{ Package: 'stx:libjava/tools' }"
 
+"{ NameSpace: Smalltalk }"
+
 JavaScannerBase subclass:#JavaScanner
 	instanceVariableNames:'allowDegeneratedMantissa allowRunawayString keywordTable'
 	classVariableNames:'Verbose'
@@ -410,32 +412,32 @@
 !
 
 exponentPart:initialValue
-    |nextChar value s|
+    |nextChar value signum|
 
     value := initialValue.
     nextChar := source peekOrNil.
 
     ((nextChar == $e) or:[nextChar == $E]) ifTrue:[
-	nextChar := source nextPeek.
-	(nextChar notNil and:[(nextChar isDigitRadix:10) or:['+-' includes:nextChar]]) ifTrue:[
-	    s := 1.
-	    (nextChar == $+) ifTrue:[
-		nextChar := source nextPeek
-	    ] ifFalse:[
-		(nextChar == $-) ifTrue:[
-		    nextChar := source nextPeek.
-		    s := s negated
-		]
-	    ].
-	    value := value asFloat
-		     * (10.0 raisedToInteger:((Integer readFrom:source radix:10) * s))
-	]
+        nextChar := source nextPeekOrNil.
+        (nextChar notNil and:[(nextChar isDigitRadix:10) or:['+-' includes:nextChar]]) ifTrue:[
+            signum := 1.
+            (nextChar == $+) ifTrue:[
+                source next.
+            ] ifFalse:[
+                (nextChar == $-) ifTrue:[
+                    source next.
+                    signum := signum negated
+                ]
+            ].
+            value := value asFloat
+                     * (10 raisedToInteger:((Integer readFrom:source radix:10) * signum))
+        ]
     ].
     ^ value
 !
 
 hexponentPart:initialValue
-    |nextChar value s|
+    |nextChar value signum|
 
     value := initialValue.
     nextChar := source peekOrNil.
@@ -443,17 +445,17 @@
     ((nextChar == $p) or:[nextChar == $P]) ifTrue:[
         nextChar := source nextPeek.
         (nextChar notNil and:[(nextChar isDigitRadix:16) or:['+-' includes:nextChar]]) ifTrue:[
-            s := 1.
+            signum := 1.
             (nextChar == $+) ifTrue:[
-                nextChar := source nextPeek
+                source next.
             ] ifFalse:[
                 (nextChar == $-) ifTrue:[
-                    nextChar := source nextPeek.
-                    s := s negated
+                    source next.
+                    signum := signum negated
                 ]
             ].
             value := value asFloat
-                     * (16.0 raisedToInteger:((Integer readFrom:source radix:16) * s))
+                     * (16 raisedToInteger:((Integer readFrom:source radix:16) * signum))
         ]
     ].
     ^ value
@@ -602,11 +604,11 @@
     |nextChar string ok pos|
 
     hereChar == $_ ifTrue:[
-        nextChar := source nextPeek.
+        nextChar := source nextPeekOrNil.
         string := '_'.
         [nextChar == $_] whileTrue:[
             string := string copyWith:$_.
-            nextChar := source nextPeek.
+            nextChar := source nextPeekOrNil.
         ].
         nextChar isAlphaNumeric ifTrue:[
             string := string , source nextAlphaNumericWord.
@@ -621,7 +623,7 @@
         ok := true.
         [ok] whileTrue:[
             string := string copyWith:nextChar.
-            nextChar := source nextPeek.
+            nextChar := source nextPeekOrNil.
             nextChar isNil ifTrue:[
                 ok := false
             ] ifFalse:[
@@ -798,7 +800,7 @@
     ].
 
     (nextChar == $.) ifTrue:[
-        nextChar := source nextPeek.
+        nextChar := source nextPeekOrNil.
         (nextChar notNil and:[nextChar isDigitRadix:10]) ifTrue:[
             value := value asFloat + (self nextMantissa:10).
             nextChar := source peekOrNil
@@ -1059,7 +1061,7 @@
 !
 
 version_SVN
-    ^ 'Id'
+    ^ '$Id$'
 ! !
 
 !JavaScanner::Token methodsFor:'accessing'!
@@ -1123,7 +1125,7 @@
 !JavaScanner class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libjava/tools/JavaScanner.st,v 1.5 2015-03-20 13:29:52 vrany Exp $'
+    ^ '$Header$'
 !
 
 version_HG
@@ -1132,6 +1134,6 @@
 !
 
 version_SVN
-    ^ 'Id'
+    ^ '$Id$'
 ! !