--- a/Parser.st Tue Jul 20 17:58:00 1999 +0200
+++ b/Parser.st Tue Jul 20 17:58:36 1999 +0200
@@ -3791,6 +3791,7 @@
pos2 eMsg exprList|
pos := tokenPosition.
+
(tokenType == #Self) ifTrue:[
self nextToken.
((tokenType == $_) or:[tokenType == #':=']) ifTrue:[
@@ -4029,6 +4030,9 @@
or:[(tokenType == #Character)
or:[(tokenType == #Float)
or:[(tokenType == #Symbol)]]]]) ifTrue:[
+ "/
+ "/ ImmutableStrings are experimental
+ "/
((tokenType == #String)
and:[(StringsAreImmutable == true)
and:[ImmutableString notNil]]) ifTrue:[
@@ -4044,6 +4048,7 @@
].
^ val
].
+
(tokenType == #Nil) ifTrue:[
self nextToken.
((tokenType == $_) or:[tokenType == #':=']) ifTrue:[
@@ -4056,6 +4061,7 @@
].
^ nilNode
].
+
(tokenType == #True) ifTrue:[
self nextToken.
((tokenType == $_) or:[tokenType == #':=']) ifTrue:[
@@ -4074,6 +4080,7 @@
"/ self markBooleanConstantFrom:pos to:pos+4.
^ ConstantNode type:#False value:false
].
+
(tokenType == #Super) ifTrue:[
usesSuper := true.
self nextToken.
@@ -4090,6 +4097,7 @@
self markSelfFrom:pos to:pos+5.
^ superNode
].
+
(tokenType == #Here) ifTrue:[
self nextToken.
((tokenType == $_) or:[tokenType == #':=']) ifTrue:[
@@ -4102,6 +4110,7 @@
self markSelfFrom:pos to:pos+3.
^ SuperNode value:selfValue inClass:classToCompileFor here:true
].
+
(tokenType == #ThisContext) ifTrue:[
self nextToken.
((tokenType == $_) or:[tokenType == #':=']) ifTrue:[
@@ -4109,12 +4118,9 @@
^ #Error
].
self markIdentifierFrom:pos to:pos+10.
- contextToEvaluateIn notNil ifTrue:[
- ^ VariableNode type:#ThisContext context:contextToEvaluateIn
- ] ifFalse:[
- ^ VariableNode type:#ThisContext
- ]
+ ^ VariableNode type:#ThisContext context:contextToEvaluateIn. "/ often nil
].
+
(tokenType == #HashLeftParen) ifTrue:[
self nextToken.
val := self array.
@@ -4125,6 +4131,11 @@
].
^ ConstantNode type:#Array value:val
].
+
+ (tokenType == #HashLeftBrace) ifTrue:[
+ ^ self qualifiedName.
+ ].
+
(tokenType == #HashLeftBrack) ifTrue:[
self nextToken.
val := self byteArray.
@@ -4133,7 +4144,7 @@
self parseError:'assignment to a constant' position:pos to:tokenPosition.
^ #Error
].
- ^ ConstantNode type:#Array value:val
+ ^ ConstantNode type:#ByteArray value:val
].
(tokenType == $() ifTrue:[
@@ -4157,6 +4168,7 @@
val parenthized:true.
^ val
].
+
(tokenType == $[ ) ifTrue:[
self markBracketAt:tokenPosition.
val := self block.
@@ -4240,6 +4252,42 @@
"Modified: / 3.8.1998 / 15:31:52 / cg"
!
+qualifiedName
+ "a vw3.x (and later) feature: QualifiedName is #{ id ... id }
+ and mapped to a global variable here.
+ The initial #{ is supposed to be not yet skipped."
+
+ |elements elem pos1|
+
+ pos1 := tokenPosition.
+ self nextToken.
+ elements := OrderedCollection new.
+ [tokenType ~~ $} ] whileTrue:[
+ elem := self variable.
+ (elem == #Error) ifTrue:[
+ (tokenType == #EOF) ifTrue:[
+ self syntaxError:'unterminated qualifiedName; ''}'' expected'
+ position:pos1 to:tokenPosition
+ ].
+ ^ #Error
+ ].
+ (elem isVariable and:[elem isGlobal]) ifFalse:[
+ self syntaxError:'elements of a qualifiedName must be globalIdentifiers'
+ position:pos1 to:tokenPosition
+ ].
+ elements add:elem.
+ self nextToken
+ ].
+ self nextToken.
+
+ elements size > 1 ifTrue:[
+ self halt.
+ ].
+ ^ elements first.
+
+ "Modified: / 14.4.1998 / 17:03:29 / cg"
+!
+
squeakComputedArray
|expressions elem pos1|
@@ -5061,6 +5109,6 @@
!Parser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.215 1999-07-19 19:25:00 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.216 1999-07-20 15:58:36 cg Exp $'
! !
Parser initialize!