additional entry, passing the namespace
authorClaus Gittinger <cg@exept.de>
Sat, 08 Feb 1997 20:00:43 +0100
changeset 492 fe778fd0ce46
parent 491 b05dc84e74c0
child 493 77e0d6979865
additional entry, passing the namespace
Parser.st
--- a/Parser.st	Fri Jan 31 14:29:28 1997 +0100
+++ b/Parser.st	Sat Feb 08 20:00:43 1997 +0100
@@ -462,6 +462,32 @@
      reading and simple sends, where the overhead of compilation is bigger
      than the interpretation overhead."
 
+    ^ self
+        evaluate:aStringOrStream 
+        in:aContext 
+        receiver:anObject 
+        notifying:requestor 
+        logged:logged 
+        ifFail:failBlock 
+        compile:compile 
+        defaultNameSpace:nil
+
+    "Modified: 8.2.1997 / 19:35:40 / cg"
+!
+
+evaluate:aStringOrStream in:aContext receiver:anObject notifying:requestor logged:logged ifFail:failBlock compile:compile defaultNameSpace:aNameSpaceOrNil
+    "return the result of evaluating aStringOrStream, errors are reported to requestor. 
+     Allow access to anObject as self and to its instVars (used in the inspector).
+     If logged is true, an entry is added to the change-file. If the failBlock argument
+     is non-nil, it is evaluated if an error occurs.
+     Finally, compile specifies if the string should be compiled down to 
+     bytecode or instead be interpreted from the parseTree.
+     The first should be done for doIts etc, where a readable walkback is
+     required.
+     The latter is better done for constants, styleSheet and resource
+     reading and simple sends, where the overhead of compilation is bigger
+     than the interpretation overhead."
+
     |parser tree mustBackup loggedString chgStream value s sReal spc|
 
     aStringOrStream isNil ifTrue:[^ nil].
@@ -480,6 +506,7 @@
     parser setContext:aContext.
     parser notifying:requestor.
     parser nextToken.
+    parser currentNameSpace:aNameSpaceOrNil.
     tree := parser parseMethodBodyOrEmpty.
 
     "if reading from a stream, backup for next expression"
@@ -514,6 +541,7 @@
          This, if its a class definition expression, the class will
          be installed there.
         "
+        spc := aNameSpaceOrNil.
         Class nameSpaceQuerySignal handle:[:ex |
             spc isNil ifTrue:[
                 spc := parser getNameSpace.
@@ -608,7 +636,8 @@
     parser release.
     ^ value
 
-    "Modified: 24.1.1997 / 19:13:59 / cg"
+    "Created: 8.2.1997 / 19:34:44 / cg"
+    "Modified: 8.2.1997 / 19:37:41 / cg"
 !
 
 evaluate:aStringOrStream logged:logged
@@ -3668,6 +3697,12 @@
     "Created: 19.12.1996 / 23:47:58 / cg"
 !
 
+currentNameSpace:aNameSpace
+    currentNamespace := aNameSpace.
+
+    "Created: 8.2.1997 / 19:37:03 / cg"
+!
+
 currentUsedNameSpaces
     |spaces|
 
@@ -3997,6 +4032,6 @@
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.125 1997-01-24 22:54:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.126 1997-02-08 19:00:43 cg Exp $'
 ! !
 Parser initialize!