Parser.st
changeset 1006 ffce16b01b0a
parent 1003 37badd2eb5b0
child 1008 88d4d5002fb8
--- a/Parser.st	Fri Dec 10 16:12:42 1999 +0100
+++ b/Parser.st	Tue Dec 14 15:30:28 1999 +0100
@@ -1568,27 +1568,19 @@
      codeView) which can highlight it and show a popup box,
      iff ignoreErrors/ignoreWarnings is true respectively."
 
-    |parser tree token|
+    |parser|
 
     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].
-    ignoreWarnings ifTrue:[parser ignoreWarnings].
-    token := parser nextToken.
-    (token == $^) ifTrue:[
-	parser nextToken.
-    ].
-    tree := parser expression.
-    (parser errorFlag or:[tree == #Error]) ifTrue:[^ #Error].
-    ^ tree
-
-    "Created: 24.6.1997 / 16:42:14 / cg"
+    ^ parser 
+        parseExpressionWithSelf:anObject 
+        notifying:someOne 
+        ignoreErrors:ignoreErrors 
+        ignoreWarnings:ignoreWarnings 
+        inNameSpace:aNameSpaceOrNil.
+
+    "Modified: / 14.12.1999 / 15:12:16 / cg"
 ! !
 
 !Parser class methodsFor:'unparsing'!
@@ -2916,6 +2908,35 @@
     "Modified: / 16.7.1998 / 20:38:25 / cg"
 !
 
+parseExpressionWithSelf:anObject 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."
+
+    |tree token|
+
+    aNameSpaceOrNil notNil ifTrue:[
+        self currentNameSpace:aNameSpaceOrNil
+    ].
+    self setSelf:anObject.
+    self notifying:someOne.
+    ignoreErrors ifTrue:[self ignoreErrors].
+    ignoreWarnings ifTrue:[self ignoreWarnings].
+    token := self nextToken.
+    (token == $^) ifTrue:[
+        self nextToken.
+    ].
+    tree := self expression.
+    (self errorFlag or:[tree == #Error]) ifTrue:[^ #Error].
+    ^ tree
+
+    "Created: / 14.12.1999 / 15:11:37 / cg"
+!
+
 parseMethod
     "parse a method.
      Return the parseTree or #Error.
@@ -5300,6 +5321,6 @@
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.232 1999-12-10 12:08:59 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.233 1999-12-14 14:30:28 cg Exp $'
 ! !
 Parser initialize!