--- a/Parser.st Sat Oct 12 20:14:08 1996 +0200
+++ b/Parser.st Mon Oct 14 19:05:01 1996 +0200
@@ -27,7 +27,7 @@
category:'System-Compiler'
!
-!Parser class methodsFor:'documentation'!
+!Parser class methodsFor:'documentation'!
copyright
"
@@ -210,7 +210,7 @@
"
! !
-!Parser class methodsFor:'instance creation'!
+!Parser class methodsFor:'instance creation'!
for:aStringOrStream in:aClass
"return a new parser, reading code for aClass from aStringOrStream"
@@ -222,7 +222,7 @@
^ parser
! !
-!Parser class methodsFor:'changes'!
+!Parser class methodsFor:'changes'!
flushNameCache
"unconditional flush name caches"
@@ -248,7 +248,7 @@
]
! !
-!Parser class methodsFor:'controlling compilation'!
+!Parser class methodsFor:'controlling compilation'!
arraysAreImmutable
"return true if arrays are immutable literals"
@@ -335,7 +335,7 @@
"
! !
-!Parser class methodsFor:'evaluating expressions'!
+!Parser class methodsFor:'evaluating expressions'!
evaluate:aStringOrStream
"return the result of evaluating an expression in aStringOrStream.
@@ -653,7 +653,7 @@
compile:compile
! !
-!Parser class methodsFor:'initialization '!
+!Parser class methodsFor:'initialization '!
initialize
LazyCompilation := false. "/ usually set to true in your .rc file
@@ -665,7 +665,7 @@
"Modified: 9.2.1996 / 17:33:49 / cg"
! !
-!Parser class methodsFor:'parsing'!
+!Parser class methodsFor:'parsing'!
parseExpression:aString
"parse aString as an expression;
@@ -1103,7 +1103,7 @@
^ tree
! !
-!Parser class methodsFor:'unparsing'!
+!Parser class methodsFor:'unparsing'!
methodSpecificationForSelector:aSelector
"given a selector such as #foo:bar:, return a string that could
@@ -1551,7 +1551,7 @@
or has the same name as a variable or cannot be understood.
Simple, but catches many typos"
- |ok err sym rec superCls|
+ |ok err sym rec superCls names|
"
if compiling lazy, or errors are to be ignored, or there
@@ -1567,9 +1567,9 @@
"
((methodVarNames notNil and:[methodVarNames includes:aSelectorString])
or:[(methodArgNames notNil and:[methodArgNames includes:aSelectorString])
- or:[(self instVarNames notNil and:[self instVarNames includes:aSelectorString])
- or:[(self classInstVarNames notNil and:[self classInstVarNames includes:aSelectorString])
- or:[(self classVarNames notNil and:[self classVarNames includes:aSelectorString])]]]]) ifTrue:[
+ or:[((names := self classesInstVarNames) notNil and:[names includes:aSelectorString])
+ or:[((names := self classesClassInstVarNames) notNil and:[names includes:aSelectorString])
+ or:[((names := self classesClassVarNames) notNil and:[names includes:aSelectorString])]]]]) ifTrue:[
err := ' is currently nowhere implemented ..
.. but a variable with that name is defined.
@@ -1676,7 +1676,7 @@
^ aSelectorString
"Modified: 5.9.1995 / 17:02:11 / claus"
- "Modified: 18.9.1996 / 15:20:40 / cg"
+ "Modified: 14.10.1996 / 18:03:43 / cg"
! !
!Parser methodsFor:'error handling'!
@@ -1798,10 +1798,10 @@
alredy warned about this one ?
"
warnedUndefVars notNil ifTrue:[
- (warnedUndefVars includes:aName) ifTrue:[
- "already warned about this one"
- ^ false
- ].
+ (warnedUndefVars includes:aName) ifTrue:[
+ "already warned about this one"
+ ^ false
+ ].
].
"/ (classToCompileFor notNil
@@ -1812,37 +1812,39 @@
"/ ].
(requestor isNil or:[requestor isStream]) ifTrue:[
- aName first isUppercase ifFalse:[
- self showErrorMessage:('Error: ' , aName , ' is undefined') position:pos1.
- ].
- doCorrect := false.
+ aName first isUppercase ifFalse:[
+ self showErrorMessage:('Error: ' , aName , ' is undefined') position:pos1.
+ ].
+ doCorrect := false.
] ifFalse:[
- "
- ask requestor for correct/continue/abort ...
- it is supposed to raise abort or return true/false.
- True return means that correction is wanted.
- "
- msg := 'Warning: ' , aName , ' is undefined'.
- classToCompileFor notNil ifTrue:[
- "is it an instance-variable marked inaccessable ?"
-
- idx := (self instVarNames) indexOf:(aName , '*') startingAt:1.
- idx ~~ 0 ifTrue:[
- msg := 'Warning: ' , aName , ' is a hidden instvar (not accessable from ST-code)'.
- ]
- ].
-
- doCorrect := self correctableError:msg position:pos1 to:pos2
+ "
+ ask requestor for correct/continue/abort ...
+ it is supposed to raise abort or return true/false.
+ True return means that correction is wanted.
+ "
+ msg := 'Warning: ' , aName , ' is undefined'.
+ classToCompileFor notNil ifTrue:[
+ "is it an instance-variable marked inaccessable ?"
+
+ idx := (self classesInstVarNames) indexOf:(aName , '*') startingAt:1.
+ idx ~~ 0 ifTrue:[
+ msg := 'Warning: ' , aName , ' is a hidden instvar (not accessable from ST-code)'.
+ ]
+ ].
+
+ doCorrect := self correctableError:msg position:pos1 to:pos2
].
doCorrect ifFalse:[
- warnedUndefVars isNil ifTrue:[
- warnedUndefVars := Set new.
- ].
- warnedUndefVars add:aName.
+ warnedUndefVars isNil ifTrue:[
+ warnedUndefVars := Set new.
+ ].
+ warnedUndefVars add:aName.
].
^ doCorrect
+
+ "Modified: 14.10.1996 / 18:00:50 / cg"
! !
!Parser methodsFor:'parsing'!
@@ -2324,10 +2326,12 @@
aClass := classToCompileFor.
[aClass notNil] whileTrue:[
- (aClass class instVarNames includes:aString) ifTrue:[ ^ aClass].
- aClass := aClass superclass
+ (aClass class classesInstVarNames includes:aString) ifTrue:[ ^ aClass].
+ aClass := aClass superclass
].
^ nil
+
+ "Modified: 14.10.1996 / 18:00:38 / cg"
!
inWhichClassIsClassVar:aString
@@ -3243,7 +3247,7 @@
classToCompileFor notNil ifTrue:[
"is it an instance-variable ?"
- instIndex := (self instVarNames) lastIndexOf:varName.
+ instIndex := (self classesInstVarNames) lastIndexOf:varName.
instIndex ~~ 0 ifTrue:[
parseForCode ifFalse:[self rememberInstVarUsed:varName].
^ VariableNode type:#InstanceVariable
@@ -3254,7 +3258,7 @@
"is it a class-instance-variable ?"
- instIndex := (self classInstVarNames) lastIndexOf:varName.
+ instIndex := (self classesClassInstVarNames) lastIndexOf:varName.
instIndex ~~ 0 ifTrue:[
aClass := self inWhichClassIsClassInstVar:varName.
aClass notNil ifTrue:[
@@ -3268,7 +3272,7 @@
"is it a class-variable ?"
- instIndex := (self classVarNames) lastIndexOf:varName.
+ instIndex := (self classesClassVarNames) lastIndexOf:varName.
instIndex ~~ 0 ifTrue:[
aClass := self inWhichClassIsClassVar:varName.
aClass notNil ifTrue:[
@@ -3293,23 +3297,26 @@
^ VariableNode type:#GlobalVariable name:tokenSymbol
]
].
+
^ #Error
- "Modified: 11.10.1996 / 19:22:42 / cg"
+ "Modified: 14.10.1996 / 18:03:47 / cg"
! !
!Parser methodsFor:'queries'!
-classInstVarNames
+classesClassInstVarNames
"caching allInstVarNames for next compilation saves time ..."
PrevClassInstVarNames isNil ifTrue:[
- PrevClassInstVarNames := classToCompileFor class allInstVarNames
+ PrevClassInstVarNames := classToCompileFor class allInstVarNames
].
^ PrevClassInstVarNames
+
+ "Created: 14.10.1996 / 18:03:35 / cg"
!
-classVarNames
+classesClassVarNames
"caching allClassVarNames for next compilation saves time ..."
|aClass className|
@@ -3332,6 +3339,26 @@
"Modified: 17.6.1996 / 17:15:53 / stefan"
"Modified: 21.6.1996 / 15:21:17 / cg"
+ "Created: 14.10.1996 / 18:02:41 / cg"
+!
+
+classesInstVarNames
+ "caching allInstVarNames for next compilation saves time ..."
+
+ (PrevInstVarNames isNil or:[PrevClass ~~ classToCompileFor]) ifTrue:[
+ PrevClass notNil ifTrue:[
+ PrevClass removeDependent:Parser
+ ].
+ PrevClass := classToCompileFor.
+ PrevInstVarNames := classToCompileFor allInstVarNames.
+ PrevClassInstVarNames := nil.
+ PrevClassVarNames := nil.
+ PrevClass addDependent:Parser
+ ].
+
+ ^ PrevInstVarNames
+
+ "Created: 14.10.1996 / 18:00:26 / cg"
!
hasNonOptionalPrimitiveCode
@@ -3346,23 +3373,6 @@
^ hasPrimitiveCode
!
-instVarNames
- "caching allInstVarNames for next compilation saves time ..."
-
- (PrevInstVarNames isNil or:[PrevClass ~~ classToCompileFor]) ifTrue:[
- PrevClass notNil ifTrue:[
- PrevClass removeDependent:Parser
- ].
- PrevClass := classToCompileFor.
- PrevInstVarNames := classToCompileFor allInstVarNames.
- PrevClassInstVarNames := nil.
- PrevClassVarNames := nil.
- PrevClass addDependent:Parser
- ].
-
- ^ PrevInstVarNames
-!
-
methodArgs
"return an array with methodarg names (valid after parsing spec)"
@@ -3540,9 +3550,9 @@
usedVars add:name
! !
-!Parser class methodsFor:'documentation'!
+!Parser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.87 1996-10-11 18:26:08 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.88 1996-10-14 17:05:01 cg Exp $'
! !
Parser initialize!