--- a/Parser.st Fri Dec 20 00:30:23 1996 +0100
+++ b/Parser.st Fri Dec 20 01:16:34 1996 +0100
@@ -2932,6 +2932,12 @@
(tokenType == #'::') ifTrue:[
globlName := name.
+ "is it in a namespace ?"
+ nameSpace := self findNameSpaceWith:globlName.
+ nameSpace notNil ifTrue:[
+ globlName := nameSpace name , '::' , globlName
+ ].
+
[tokenType == #'::'] whileTrue:[
nameSpace := globlName.
@@ -3242,7 +3248,7 @@
^ #Error
"Created: 13.9.1995 / 12:50:50 / claus"
- "Modified: 16.12.1996 / 18:11:56 / cg"
+ "Modified: 20.12.1996 / 00:03:40 / cg"
!
statement
@@ -3444,7 +3450,7 @@
"parse a variable; return a node-tree, nil or #Error"
|var instIndex aClass searchBlock args vars
- tokenSymbol currentSpace usedSpaces|
+ tokenSymbol space|
"is it a block-arg or block-var ?"
searchBlock := currentBlock.
@@ -3552,54 +3558,13 @@
parseForCode ifFalse:[self rememberGlobalUsed:(aClass name , '::' , varName)].
^ VariableNode type:#PrivateClass class:aClass name:varName
].
-
- "is it in the classes namespace ?"
-
- currentSpace := classToCompileFor nameSpace.
- (currentSpace notNil
- and:[currentSpace ~~ Smalltalk]) ifTrue:[
- (currentSpace privateClassesAt:varName) notNil ifTrue:[
- parseForCode ifFalse:[self rememberGlobalUsed:(currentSpace name , '::' , varName)].
- ^ VariableNode type:#PrivateClass class:currentSpace name:varName
- ]
- ].
].
- "is it in the current namespace ?"
- currentSpace := currentNamespace.
- currentSpace isNil ifTrue:[
- (requestor respondsTo:#currentNameSpace) ifTrue:[
- currentSpace := requestor currentNameSpace
- ] ifFalse:[
- currentSpace := Class nameSpaceQuerySignal raise.
- ].
- currentNamespace := currentSpace.
- ].
- (currentSpace notNil
- and:[currentSpace ~~ Smalltalk]) ifTrue:[
- (currentSpace privateClassesAt:varName) notNil ifTrue:[
- parseForCode ifFalse:[self rememberGlobalUsed:(currentSpace name , '::' , varName)].
- ^ VariableNode type:#PrivateClass class:currentSpace name:varName
- ]
- ].
-
- "is it in one of the used namespaces ?"
- usedSpaces := currentUsedNamespaces.
- usedSpaces isNil ifTrue:[
- (requestor respondsTo:#usedNameSpaces) ifTrue:[
- usedSpaces := requestor usedNameSpaces
- ] ifFalse:[
- usedSpaces := Class usedNameSpaceQuerySignal raise.
- ].
- currentUsedNamespaces := usedSpaces.
- ].
- usedSpaces notNil ifTrue:[
- usedSpaces do:[:aNameSpace |
- (aNameSpace privateClassesAt:varName) notNil ifTrue:[
- parseForCode ifFalse:[self rememberGlobalUsed:(aNameSpace name , '::' , varName)].
- ^ VariableNode type:#PrivateClass class:aNameSpace name:varName
- ]
- ]
+ "is it in a namespace ?"
+ space := self findNameSpaceWith:varName.
+ space notNil ifTrue:[
+ parseForCode ifFalse:[self rememberGlobalUsed:(space name , '::' , varName)].
+ ^ VariableNode type:#PrivateClass class:space name:varName
].
"is it a global-variable ?"
@@ -3613,7 +3578,82 @@
^ #Error
- "Modified: 20.12.1996 / 00:29:42 / cg"
+ "Modified: 19.12.1996 / 23:53:37 / cg"
+! !
+
+!Parser methodsFor:'private'!
+
+currentNameSpace
+ |spc|
+
+ spc := currentNamespace.
+ spc isNil ifTrue:[
+ (requestor respondsTo:#currentNameSpace) ifTrue:[
+ spc := requestor currentNameSpace
+ ] ifFalse:[
+ spc := Class nameSpaceQuerySignal raise.
+ ].
+ currentNamespace := spc.
+ ].
+ ^ spc
+
+ "Created: 19.12.1996 / 23:47:58 / cg"
+!
+
+currentUsedNameSpaces
+ |spaces|
+
+ spaces := currentUsedNamespaces.
+ spaces isNil ifTrue:[
+ (requestor respondsTo:#usedNameSpaces) ifTrue:[
+ spaces := requestor usedNameSpaces
+ ] ifFalse:[
+ spaces := Class usedNameSpaceQuerySignal raise.
+ ].
+ currentUsedNamespaces := spaces.
+ ].
+ ^ spaces
+
+ "Created: 19.12.1996 / 23:49:10 / cg"
+!
+
+findNameSpaceWith:aVariableName
+ |currentSpace usedSpaces|
+
+ classToCompileFor notNil ifTrue:[
+ "is it in the classes namespace ?"
+
+ currentSpace := classToCompileFor nameSpace.
+ (currentSpace notNil
+ and:[currentSpace ~~ Smalltalk]) ifTrue:[
+ (currentSpace privateClassesAt:aVariableName) notNil ifTrue:[
+ ^ currentSpace
+ ]
+ ].
+ ].
+
+ "is it in the current namespace ?"
+ currentSpace := self currentNameSpace.
+ (currentSpace notNil
+ and:[currentSpace ~~ Smalltalk]) ifTrue:[
+ (currentSpace privateClassesAt:aVariableName) notNil ifTrue:[
+ ^ currentSpace
+ ]
+ ].
+
+ "is it in one of the used namespaces ?"
+ usedSpaces := self currentUsedNameSpaces.
+ usedSpaces notNil ifTrue:[
+ usedSpaces do:[:aNameSpace |
+ (aNameSpace privateClassesAt:aVariableName) notNil ifTrue:[
+ ^ aNameSpace
+ ]
+ ]
+ ].
+ ^ nil
+
+ "Created: 19.12.1996 / 23:51:02 / cg"
+ "Modified: 19.12.1996 / 23:52:25 / cg"
! !
!Parser methodsFor:'queries'!
@@ -3875,6 +3915,6 @@
!Parser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.115 1996-12-19 23:30:23 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.116 1996-12-20 00:16:34 cg Exp $'
! !
Parser initialize!