Scanner.st
changeset 4610 addf2512f74f
parent 4604 531818d94f92
child 4611 d24d3658cc98
--- a/Scanner.st	Wed Dec 11 13:47:50 2019 +0100
+++ b/Scanner.st	Wed Dec 18 15:15:33 2019 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
               All Rights Reserved
@@ -145,7 +143,7 @@
 extendedBinarySelectorCharacters
     "return a collection of characters which are optionally allowed in binary selectors"
 
-    "/ ^ '±×·÷«»'.
+    "/ ^ '±×·÷«»'.
     ^ String
         with:(Character value:16rB1)  "/ plus-minus
         with:(Character value:16rD7)  "/ times
@@ -1876,13 +1874,13 @@
 !
 
 warnParagraphAt:position
-    "warn about §-character in an identifier"
+    "warn about §-character in an identifier"
 
     ignoreWarnings ifFalse:[
         "/ didWarnAboutParagraphInIdentifier ifFalse:[
             parserFlags warnParagraphInIdentifier ifTrue:[
                 self
-                    warning:'§-characters in identifiers/symbols are nonportable'
+                    warning:'§-characters in identifiers/symbols are nonportable'
                     doNotShowAgainAction:[ ParserFlags warnParagraphInIdentifier:false ]
                     position:position to:position.
                 "
@@ -3035,7 +3033,7 @@
 
     (((nextChar == $_) and:[allowUnderscoreInIdentifier])
       or:[ (allowDollarInIdentifier and:[nextChar == $$ ])
-      or:[ (nextChar == $§ and:[ allowParagraphInIdentifier])
+      or:[ (nextChar == $§ and:[ allowParagraphInIdentifier])
       or:[ (allowNationalCharactersInIdentifier and:[ nextChar notNil and:[nextChar isNationalLetter]])
       or:[ (allowGreekCharactersInIdentifier and:[ nextChar notNil and:[nextChar isNationalLetter]])
     ]]]]) ifTrue:[
@@ -3046,7 +3044,7 @@
             nextChar == $$ ifTrue:[
                 self warnDollarAt:pos.
             ] ifFalse:[
-                nextChar == $§ ifTrue:[
+                nextChar == $§ ifTrue:[
                     self warnParagraphAt:pos.
                 ] ifFalse:[
                     "/ self warnNationalCharacterAt:pos.
@@ -3066,7 +3064,7 @@
                 ].
                 ok := ((nextChar == $_) and:[allowUnderscoreInIdentifier])
                         or:[((nextChar == $$ ) and:[allowDollarInIdentifier])
-                        or:[((nextChar == $§ ) and:[allowParagraphInIdentifier])
+                        or:[((nextChar == $§ ) and:[allowParagraphInIdentifier])
                         or:[(nextChar notNil and:[allowNationalCharactersInIdentifier and:[nextChar isNationalLetter]])
                         or:[(nextChar notNil and:[allowGreekCharactersInIdentifier and:[nextChar isGreekLetter]])
                       ]]]].
@@ -3180,7 +3178,7 @@
 
     |pos1 nextChar value integerPart sign
      expSign tokenRadix mantissaAndScaledPart d type exp scale 
-     kindChar kindClass chars|
+     kindChar kindClass chars |
 
     tokenRadix := 10.
     sign := 1.
@@ -3189,8 +3187,8 @@
 
     parserFlags allowCIntegers ifTrue:[
         source peek == $0 ifTrue:[
-            source next.
-            source peek == $x ifTrue:[
+            nextChar := source nextPeek.
+            nextChar == $x ifTrue:[
                 source next.
                 ((source peek ? $.) isDigitRadix:16) ifFalse:[
                     self syntaxError:'invalid cStyle integer (hex digit expected)'
@@ -3202,7 +3200,7 @@
                 tokenType := type.
                 ^ tokenType
             ].
-            source peek == $o ifTrue:[
+            nextChar == $o ifTrue:[
                 source next.
                 ((source peek ? $.) isDigitRadix:8) ifFalse:[
                     self syntaxError:'invalid cStyle integer (octal digit expected)'
@@ -3214,7 +3212,7 @@
                 tokenType := type.
                 ^ tokenType
             ].
-            source peek == $b ifTrue:[
+            nextChar == $b ifTrue:[
                 source next.
                 ((source peek ? $.) isDigitRadix:2) ifFalse:[
                     self syntaxError:'invalid cStyle integer (binary digit expected)'
@@ -3226,6 +3224,11 @@
                 tokenType := type.
                 ^ tokenType
             ].
+            nextChar isDigit ifFalse:[
+                tokenValue := token := 0.
+                tokenType := type.
+                ^ tokenType
+            ].
         ].
     ].
 
@@ -3868,7 +3871,7 @@
             "/ a nil token means: continue reading
         ] ifFalse:[
             ((ch isNationalLetter and:[parserFlags allowNationalCharactersInIdentifier])
-              or:[ (ch == $§ and:[parserFlags allowParagraphInIdentifier]) 
+              or:[ (ch == $§ and:[parserFlags allowParagraphInIdentifier]) 
               or:[ (ch isGreekLetter and:[parserFlags allowGreekCharactersInIdentifier]) 
             ]]) ifTrue:[
                 tok := self nextIdentifier.