added entry to parse an expression in a specific nameSpace
authorClaus Gittinger <cg@exept.de>
Tue, 24 Jun 1997 16:50:40 +0200
changeset 548 79948fed91a7
parent 547 5a51414daf36
child 549 e403281da682
added entry to parse an expression in a specific nameSpace
Parser.st
--- a/Parser.st	Fri Jun 20 18:55:14 1997 +0200
+++ b/Parser.st	Tue Jun 24 16:50:40 1997 +0200
@@ -856,13 +856,33 @@
      or comment only) or #Error (syntactic error).
      Error and warning messages are suppressed."
 
-    ^ self withSelf:nil 
-           parseExpression:aString 
-           notifying:nil 
-           ignoreErrors:true       "silence on Transcript"
-           ignoreWarnings:true
-
-    "Modified: 24.4.1996 / 13:18:21 / cg"
+    ^ self 
+        withSelf:nil 
+        parseExpression:aString 
+        notifying:nil 
+        ignoreErrors:true       "silence on Transcript"
+        ignoreWarnings:true
+        inNameSpace:nil
+
+    "Modified: 24.6.1997 / 16:44:00 / cg"
+!
+
+parseExpression:aString inNameSpace:aNameSpaceOrNil
+    "parse aString as an expression; 
+     Return the parseTree (if ok), nil (for an empty string 
+     or comment only) or #Error (syntactic error).
+     Error and warning messages are suppressed."
+
+    ^ self 
+        withSelf:nil 
+        parseExpression:aString 
+        notifying:nil 
+        ignoreErrors:true       "silence on Transcript"
+        ignoreWarnings:true
+        inNameSpace:aNameSpaceOrNil
+
+    "Modified: 24.6.1997 / 16:44:00 / cg"
+    "Created: 24.6.1997 / 16:44:26 / cg"
 !
 
 parseMethod:aString
@@ -1236,11 +1256,15 @@
      Errors and warnings are forwarded to someOne (usually some
      codeView) which can highlight it and show a popup box."
 
-    ^ self withSelf:anObject 
-	   parseExpression:aString 
-	   notifying:someOne 
-	   ignoreErrors:false 
-	   ignoreWarnings:false 
+    ^ self 
+        withSelf:anObject 
+        parseExpression:aString 
+        notifying:someOne 
+        ignoreErrors:false 
+        ignoreWarnings:false 
+        inNameSpace:nil
+
+    "Modified: 24.6.1997 / 16:43:37 / cg"
 !
 
 withSelf:anObject parseExpression:aString notifying:someOne ignoreErrors:ignore
@@ -1251,11 +1275,15 @@
      Errors and warnings are forwarded to someOne (usually some
      codeView) which can highlight it and show a popup box."
 
-    ^ self withSelf:anObject
-	   parseExpression:aString 
-	   notifying:someOne 
-	   ignoreErrors:ignore 
-	   ignoreWarnings:ignore 
+    ^ self 
+        withSelf:anObject
+        parseExpression:aString 
+        notifying:someOne 
+        ignoreErrors:ignore 
+        ignoreWarnings:ignore 
+        inNameSpace:nil
+
+    "Modified: 24.6.1997 / 16:43:26 / cg"
 !
 
 withSelf:anObject parseExpression:aString notifying:someOne ignoreErrors:ignoreErrors ignoreWarnings:ignoreWarnings
@@ -1267,10 +1295,34 @@
      codeView) which can highlight it and show a popup box,
      iff ignoreErrors/ignoreWarnings is true respectively."
 
+    ^ self
+        withSelf:anObject 
+        parseExpression:aString 
+        notifying:someOne 
+        ignoreErrors:ignoreErrors 
+        ignoreWarnings:ignoreWarnings 
+        inNameSpace:nil
+
+    "Modified: 24.6.1997 / 16:43:12 / cg"
+!
+
+withSelf:anObject parseExpression:aString notifying:someOne ignoreErrors:ignoreErrors ignoreWarnings:ignoreWarnings inNameSpace:aNameSpaceOrNil
+    "parse aString as an expression with self set to anObject;
+     Return the parseTree (if ok), nil (for an empty string 
+     or comment only ) or #Error (syntactic error).
+
+     Errors and warnings are forwarded to someOne (usually some
+     codeView) which can highlight it and show a popup box,
+     iff ignoreErrors/ignoreWarnings is true respectively."
+
     |parser tree token|
 
     aString isNil ifTrue:[^ nil].
+
     parser := self for:(ReadStream on:aString).
+    aNameSpaceOrNil notNil ifTrue:[
+        parser currentNameSpace:aNameSpaceOrNil
+    ].
     parser setSelf:anObject.
     parser notifying:someOne.
     ignoreErrors ifTrue:[parser ignoreErrors].
@@ -1282,6 +1334,8 @@
     tree := parser expression.
     (parser errorFlag or:[tree == #Error]) ifTrue:[^ #Error].
     ^ tree
+
+    "Created: 24.6.1997 / 16:42:14 / cg"
 ! !
 
 !Parser class methodsFor:'unparsing'!
@@ -4079,6 +4133,6 @@
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.137 1997-06-20 16:55:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.138 1997-06-24 14:50:40 cg Exp $'
 ! !
 Parser initialize!