Parser.st
changeset 257 435dcaed969f
parent 255 13a059f6569d
child 258 8de94646c647
--- a/Parser.st	Sat Apr 20 20:13:18 1996 +0200
+++ b/Parser.st	Wed Apr 24 13:17:06 1996 +0200
@@ -695,9 +695,13 @@
      The parser can be queried for selector, receiver, args, locals,
      used selectors, modified instvars, referenced classvars etc."
 
-    ^ self parseMethod:aString in:aClass 
-	ignoreErrors:false 
-	ignoreWarnings:false
+    ^ self 
+        parseMethod:aString 
+        in:aClass 
+        ignoreErrors:false 
+        ignoreWarnings:false
+
+    "Modified: 24.4.1996 / 13:15:40 / cg"
 !
 
 parseMethod:aString in:aClass ignoreErrors:noErrors ignoreWarnings:noWarnings
@@ -763,13 +767,19 @@
      The parser can be queried for selector, receiver, args and locals"
 
     ^ self parseMethodArgAndVarSpecification:aString 
-	   in:aClass 
-	   ignoreErrors:false
-	   ignoreWarnings:false 
+           in:aClass 
+           ignoreErrors:false
+           ignoreWarnings:false 
+           parseBody:false
+
+    "Modified: 24.4.1996 / 13:15:03 / cg"
 !
 
-parseMethodArgAndVarSpecification:aString in:aClass ignoreErrors:noErrors ignoreWarnings:noWarnings
+parseMethodArgAndVarSpecification:aString in:aClass ignoreErrors:noErrors ignoreWarnings:noWarnings parseBody:body
     "parse a methods selector, arg and var spec in a given class;
+     If parseBody is true, also parse the statements 
+     (for primitives & resourceSpecs).
+
      Return a parser (if ok), nil (empty) or #Error (syntax).
      The parser can be queried for selector, receiver, args and locals"
 
@@ -785,11 +795,20 @@
     ].
 "/    parser nextToken.
     (parser parseMethodSpec == #Error) ifTrue:[^ nil].
-    (parser parseMethodBodyOrEmpty "parseMethodBodyVarSpec" == #Error) ifTrue:[^ nil].
+    "/
+    "/ used to be #parseMethodBodyVarSpec
+    "/ - now, alternatively parse body for resource & primitive specs ..
+    "/
+    body ifTrue:[
+        (parser parseMethodBodyOrEmpty == #Error) ifTrue:[^ nil].
+    ] ifFalse:[
+        (parser parseMethodBodyVarSpec == #Error) ifTrue:[^ nil].
+    ].
     parser errorFlag ifTrue:[^ nil].
     ^ parser
 
     "Modified: 20.4.1996 / 20:09:42 / cg"
+    "Created: 24.4.1996 / 13:13:06 / cg"
 !
 
 parseMethodArgAndVarSpecificationSilent:aString
@@ -810,9 +829,12 @@
      display error/warning messages on the transcript."
 
     ^ self parseMethodArgAndVarSpecification:aString 
-	   in:aClass 
-	   ignoreErrors:true 
-	   ignoreWarnings:true 
+           in:aClass 
+           ignoreErrors:true 
+           ignoreWarnings:true 
+           parseBody:false
+
+    "Modified: 24.4.1996 / 13:14:27 / cg"
 !
 
 parseMethodSilent:aString
@@ -3382,6 +3404,6 @@
 !Parser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.73 1996-04-20 18:12:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.74 1996-04-24 11:17:06 cg Exp $'
 ! !
 Parser initialize!