Scanner.st
changeset 1202 95abdd4272cd
parent 1195 a3015ee52730
child 1226 c0c9fcf964fb
--- a/Scanner.st	Wed Oct 10 18:48:41 2001 +0200
+++ b/Scanner.st	Wed Oct 17 15:09:13 2001 +0200
@@ -21,7 +21,8 @@
 		scanColonAsKeyword warnSTXSpecialComment
 		warnUnderscoreInIdentifier warnOldStyleAssignment
 		warnCommonMistakes outStream outCol warnSTXNameSpaceUse
-		warnPossibleIncompatibilities warnDollarInIdentifier'
+		warnPossibleIncompatibilities warnDollarInIdentifier
+		inArrayLiteral'
 	classVariableNames:'TypeArray ActionArray AllowUnderscoreInIdentifier Warnings
 		WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier
 		WarnCommonMistakes WarnPossibleIncompatibilities
@@ -586,6 +587,10 @@
     "Modified: 23.5.1997 / 12:14:45 / cg"
 !
 
+inArrayLiteral:aBoolean
+    inArrayLiteral := aBoolean
+!
+
 lineNumber
     ^ lineNr
 !
@@ -1557,6 +1562,19 @@
             (ch2 == $:) ifFalse:[
                 tokenName := token := string copyWith:nextChar.
                 tokenType := #Keyword.
+                inArrayLiteral == true ifTrue:[
+                    (ch2 isLetter 
+                    or:[ch2 == $_ and:[allowUnderscoreInIdentifier]]) ifTrue:[
+                        "/ kludge: recurse to read the rest.
+                        self nextIdentifier.
+                        tokenName := token := (string copyWith:nextChar) , token.   
+                        tokenType ~~ #Keyword ifTrue:[
+                            self syntaxError:'invalid keyword symbol in array constant'
+                                    position:tokenPosition to:(source position - 1).
+                        ].
+                        tokenType := #Keyword.
+                    ].
+                ].
                 ^ tokenType
             ].
             peekChar := $:.
@@ -2130,6 +2148,6 @@
 !Scanner class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.128 2001-10-02 11:38:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.129 2001-10-17 13:09:13 cg Exp $'
 ! !
 Scanner initialize!