Parser.st
changeset 4310 243003f8ac27
parent 4307 db43461213ad
child 4319 24940ea40fa6
--- a/Parser.st	Mon Oct 01 09:46:08 2018 +0200
+++ b/Parser.st	Thu Oct 04 19:14:13 2018 +0200
@@ -5483,6 +5483,7 @@
     selector := aParser selector.
 ! !
 
+
 !Parser methodsFor:'obsolete'!
 
 correctByDeleting
@@ -6686,6 +6687,25 @@
         ].
         ^ tokenValue
     ].
+    ((tokenType == $;) or:[(tokenType == $.)]) ifTrue:[
+        parserFlags allowSqueakExtensions == true ifFalse:[
+            self parseError:'non-Standard Squeak/Pharo array elements: "." or ";". Please enable in settings.' position:tokenPosition to:tokenPosition+1.
+        ].
+        parserFlags warnAboutPossibleSTCCompilationProblems ifTrue:[
+            self
+                warning:'stc will not compile this'
+                line:lineNr.
+        ].        
+        self warnPossibleIncompatibility:'non-Standard Squeak/Pharo array elements: "." or ";"' position:tokenPosition to:tokenPosition+token size - 1.
+        tokenValue := tokenType asSymbol.
+        parseForCode ifFalse:[
+            self rememberSymbolUsed:tokenValue.
+        ].
+        ^ tokenValue
+    ].
+    (tokenType == $.) ifTrue:[
+    ].
+    
     (tokenType == #EOF) ifTrue:[
         "just for the better error-hilight; let caller handle error"
         self syntaxError:'EOF unexpected in array-constant'.
@@ -6697,6 +6717,7 @@
     ^ ParseError raiseRequest.
 
     "Modified: / 22-08-2006 / 14:21:16 / cg"
+    "Modified: / 04-10-2018 / 19:10:09 / Claus Gittinger"
 !
 
 arrayIndexingExpression
@@ -9975,7 +9996,27 @@
                     self parseError:'primitive number expected (V''Age-primitives not allowed - see settings)'.
                 ]
             ] ifFalse:[
-                self parseError:'primitive number expected'.
+                "/ new in Pharo
+                "/ <primitive: #primitiveNativeCall module: #NativeBoostPlugin>
+                (tokenType == #Symbol) ifTrue:[
+                    (parserFlags allowSqueakExtensions
+                    or:[ parserFlags allowSqueakPrimitives]) ifFalse:[
+                        self parseError:'Squeak primitives not allowed - see settings'.
+                    ]. 
+                    self nextToken.
+                    ((tokenType == #Keyword) and:[token = 'module:']) ifFalse:[
+                        self parseError:'Squeak primitives not allowed - see settings'.
+                    ]. 
+                    self nextToken.
+                    (tokenType == #Symbol) ifFalse:[
+                        self parseError:'Squeak primitives not allowed - see settings'.
+                    ]. 
+                    self nextToken.
+                    self checkForClosingAngle.
+                    ^ -1.
+                ] ifFalse:[    
+                    self parseError:'primitive number expected'.
+                ].
             ].
         ].
 "/        (parserFlags allowSqueakExtensions
@@ -10042,6 +10083,7 @@
 
     "Modified: / 03-11-2009 / 17:14:48 / Jan Travnicek <travnja3@fel.cvut.cz>"
     "Modified: / 07-02-2012 / 17:22:52 / cg"
+    "Modified: / 04-10-2018 / 18:50:57 / Claus Gittinger"
 !
 
 parseVWTypeOrExternalFunctionDeclarationFrom:aStream definitionType:definitionType knownDefinitions:dictionaryOfTypesOrNil lineNr:lineNr