Scanner.st
changeset 4479 0e8ec14d0a83
parent 4460 54ff9d1c05bd
child 4484 70690cdc947a
--- a/Scanner.st	Fri Aug 16 18:45:00 2019 +0200
+++ b/Scanner.st	Fri Aug 16 19:27:03 2019 +0200
@@ -3166,6 +3166,45 @@
     type := #Integer.
     pos1 := source position + 1.
 
+    parserFlags allowCIntegers ifTrue:[
+        source peek == $0 ifTrue:[
+            source next.
+            source peek == $x ifTrue:[
+                source next.
+                ((source peek ? $.) isDigitRadix:16) ifFalse:[
+                    self syntaxError:'invalid cStyle integer (hex digit expected)'
+                         position:tokenPosition to:(source position).
+                ].
+                value := Integer readFrom:source radix:16.
+                tokenValue := token := value * sign.
+                tokenType := type.
+                ^ tokenType
+            ].
+            source peek == $o ifTrue:[
+                source next.
+                ((source peek ? $.) isDigitRadix:8) ifFalse:[
+                    self syntaxError:'invalid cStyle integer (octal digit expected)'
+                         position:tokenPosition to:(source position).
+                ].
+                value := Integer readFrom:source radix:8.
+                tokenValue := token := value * sign.
+                tokenType := type.
+                ^ tokenType
+            ].
+            source peek == $b ifTrue:[
+                source next.
+                ((source peek ? $.) isDigitRadix:2) ifFalse:[
+                    self syntaxError:'invalid cStyle integer (binary digit expected)'
+                         position:tokenPosition to:(source position).
+                ].
+                value := Integer readFrom:source radix:2.
+                tokenValue := token := value * sign.
+                tokenType := type.
+                ^ tokenType
+            ].
+        ].
+    ].
+
     value := Integer readFrom:source radix:tokenRadix.
     nextChar := source peekOrNil.
     (nextChar == $r) ifTrue:[