--- a/Parser.st Wed Apr 24 13:17:06 1996 +0200
+++ b/Parser.st Wed Apr 24 13:34:02 1996 +0200
@@ -652,20 +652,24 @@
parseExpression:aString
"parse aString as an expression;
Return the parseTree (if ok), nil (for an empty string
- or comment only) or #Error (syntactic error)."
+ 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
+ parseExpression:aString
+ notifying:nil
+ ignoreErrors:true "silence on Transcript"
+ ignoreWarnings:true
+
+ "Modified: 24.4.1996 / 13:18:21 / cg"
!
parseMethod:aString
"parse a method.
Return a parser (if ok), nil (empty) or #Error (syntax).
The parser can be queried for selector, receiver, args, locals,
- used selectors etc."
+ used selectors etc.
+ Error and warning messages are sent to the Transcript."
^ self parseMethod:aString in:nil
@@ -673,12 +677,12 @@
|p|
p := Parser
- parseMethod:'
- foo:arg1 bar:arg2 baz:arg3
- |l1 l2|
- l1 := 0.
- l2 := arg1.
- ^ self'.
+ parseMethod:'
+ foo:arg1 bar:arg2 baz:arg3
+ |l1 l2|
+ l1 := 0.
+ l2 := arg1.
+ ^ self'.
'nArgs: ' print. p numberOfMethodArgs printNL.
'args: ' print. p methodArgs printNL.
@@ -687,13 +691,16 @@
'locals: ' print. p methodVars printNL.
'tree: ' printNL. p tree printAllOn:Stdout. Stdout cr.
"
+
+ "Modified: 24.4.1996 / 13:18:02 / cg"
!
parseMethod:aString in:aClass
"parse a method in a given class.
Return a parser (if ok), nil (empty) or #Error (syntax).
The parser can be queried for selector, receiver, args, locals,
- used selectors, modified instvars, referenced classvars etc."
+ used selectors, modified instvars, referenced classvars etc.
+ Error and warning messages are sent to the Transcript."
^ self
parseMethod:aString
@@ -701,28 +708,32 @@
ignoreErrors:false
ignoreWarnings:false
- "Modified: 24.4.1996 / 13:15:40 / cg"
+ "Modified: 24.4.1996 / 13:18:34 / cg"
!
parseMethod:aString in:aClass ignoreErrors:noErrors ignoreWarnings:noWarnings
"parse a method in a given class.
Return a parser (if ok), nil (empty) or #Error (syntax).
The parser can be queried for selector, receiver, args, locals,
- used selectors, modified instvars, referenced classvars etc."
+ used selectors, modified instvars, referenced classvars etc.
+ The noErrors and noWarnings arguments specify if error and warning
+ messages should be sent to the Transcript or suppressed."
|parser tree|
aString isNil ifTrue:[^ nil].
parser := self for:(ReadStream on:aString) in:aClass.
noErrors ifTrue:[
- parser ignoreErrors
+ parser ignoreErrors
].
noWarnings ifTrue:[
- parser ignoreWarnings
+ parser ignoreWarnings
].
tree := parser parseMethod.
(parser errorFlag or:[tree == #Error]) ifTrue:[^ nil].
^ parser
+
+ "Modified: 24.4.1996 / 13:19:23 / cg"
!
parseMethod:aString in:aClass warnings:warnBoolean
@@ -730,28 +741,38 @@
Return a parser (if ok), nil (empty) or #Error (syntax).
The parser can be queried for selector, receiver, args, locals,
used selectors, modified instvars, referenced classvars etc.
- This method is obsolete, and left in for backward compatibility."
-
+ The warnBoolean arguments specifies if warning
+ messages should be sent to the Transcript or suppressed.
+
+ This method is OBSOLETE, and left in for backward compatibility."
+
+ self obsoleteMethodWarning.
^ self
- parseMethod:aString in:aClass
- ignoreErrors:false
- ignoreWarnings:warnBoolean not
+ parseMethod:aString
+ in:aClass
+ ignoreErrors:false
+ ignoreWarnings:warnBoolean not
+
+ "Modified: 24.4.1996 / 13:28:05 / cg"
!
parseMethodArgAndVarSpecification:aString
"parse a methods selector, arg and var spec (i.e. locals);
Return a parser (if ok), nil (empty) or #Error (syntax).
- The parser can be queried for selector, receiver etc."
-
+ The parser can be queried for selector, receiver etc.
+ Error and warning messages are sent to the Transcript.
+ This method is OBSOLETE."
+
+ self obsoleteMethodWarning.
^ self parseMethodArgAndVarSpecification:aString in:nil
"
|p|
p := Parser
- parseMethodArgAndVarSpecification:'
- foo:arg1 bar:arg2 baz:arg3
- |l1 l2|'.
+ parseMethodArgAndVarSpecification:'
+ foo:arg1 bar:arg2 baz:arg3
+ |l1 l2|'.
'nArgs: ' print. p numberOfMethodArgs printNL.
'args: ' print. p methodArgs printNL.
@@ -759,26 +780,33 @@
'nLocal: ' print. p numberOfMethodVars printNL.
'locals: ' print. p methodVars printNL.
"
+
+ "Modified: 24.4.1996 / 13:29:43 / cg"
!
parseMethodArgAndVarSpecification:aString in:aClass
"parse a methods selector, arg and var spec in a given class;
Return a parser (if ok), nil (empty) or #Error (syntax).
- The parser can be queried for selector, receiver, args and locals"
-
+ The parser can be queried for selector, receiver, args and locals.
+ Error and warning messages are sent to the Transcript.
+ This method is OBSOLETE."
+
+ self obsoleteMethodWarning.
^ self parseMethodArgAndVarSpecification:aString
in:aClass
ignoreErrors:false
ignoreWarnings:false
parseBody:false
- "Modified: 24.4.1996 / 13:15:03 / cg"
+ "Modified: 24.4.1996 / 13:30:03 / cg"
!
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).
+ The noErrors and noWarnings arguments specify if error and warning
+ messages should be sent to the Transcript or suppressed.
Return a parser (if ok), nil (empty) or #Error (syntax).
The parser can be queried for selector, receiver, args and locals"
@@ -807,18 +835,20 @@
parser errorFlag ifTrue:[^ nil].
^ parser
- "Modified: 20.4.1996 / 20:09:42 / cg"
"Created: 24.4.1996 / 13:13:06 / cg"
+ "Modified: 24.4.1996 / 13:31:41 / cg"
!
parseMethodArgAndVarSpecificationSilent:aString
"parse a methods selector, arg and var spec (i.e. locals);
Return a parser (if ok), nil (empty) or #Error (syntax).
The parser can be queried for selector, receiver etc.
- Like #parseMethodArgAndVarSpecification:, but does not
+ Like #parseMethodArgAndVarSpecification:, but does NOT
display error/warning messages on the transcript."
^ self parseMethodArgAndVarSpecificationSilent:aString in:nil
+
+ "Modified: 24.4.1996 / 13:30:54 / cg"
!
parseMethodArgAndVarSpecificationSilent:aString in:aClass
@@ -842,10 +872,11 @@
Return a parser (if ok), nil (empty) or #Error (syntax).
The parser can be queried for selector, receiver, args, locals,
used selectors etc.
- Like #parseMethod:, but does not display warning/error messages on the
- transcript."
+ Like #parseMethod:, but warning/error messages are suppressed."
^ self parseMethodSilent:aString in:nil
+
+ "Modified: 24.4.1996 / 13:32:44 / cg"
!
parseMethodSilent:aString in:aClass
@@ -853,12 +884,15 @@
Return a parser (if ok), nil (empty) or #Error (syntax).
The parser can be queried for selector, receiver, args, locals,
used selectors, modified instvars, referenced classvars etc.
- Like #parseMethod:in:, but does not display any error/warning
- messages on the transcript."
-
- ^ self parseMethod:aString in:aClass
- ignoreErrors:true
- ignoreWarnings:true
+ Like #parseMethod:in:, but warning/error messages are suppressed."
+
+ ^ self
+ parseMethod:aString
+ in:aClass
+ ignoreErrors:true
+ ignoreWarnings:true
+
+ "Modified: 24.4.1996 / 13:32:57 / cg"
!
parseMethodSpecification:aString
@@ -3404,6 +3438,6 @@
!Parser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.74 1996-04-24 11:17:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.75 1996-04-24 11:34:02 cg Exp $'
! !
Parser initialize!