'From Squeak3.8 of ''5 May 2005'' [latest update: #6665] on 28 September 2005 at 2:13:01 pm'! Object subclass: #Compiler instanceVariableNames: 'sourceStream requestor class category context parserClass cacheDoItNode' classVariableNames: '' poolDictionaries: '' category: 'Compiler-Kernel'! !Compiler methodsFor: 'error handling' stamp: 'ar 9/27/2005 19:21'! notify: aString at: location "Refer to the comment in Object|notify:." requestor == nil ifTrue: [^SyntaxErrorNotification inClass: class category: category withCode: (sourceStream contents copyReplaceFrom: location to: location - 1 with: aString) doitFlag: false] ifFalse: [^requestor notify: aString at: location in: sourceStream]! ! !Compiler methodsFor: 'public access' stamp: 'ar 9/27/2005 19:20'! compile: textOrStream in: aClass classified: aCategory notifying: aRequestor ifFail: failBlock "Answer a MethodNode for the argument, textOrStream. If the MethodNode can not be created, notify the argument, aRequestor; if aRequestor is nil, evaluate failBlock instead. The MethodNode is the root of a parse tree. It can be told to generate a CompiledMethod to be installed in the method dictionary of the argument, aClass." self from: textOrStream class: aClass classified: aCategory context: nil notifying: aRequestor. ^self translate: sourceStream noPattern: false ifFail: failBlock ! ! !Compiler methodsFor: 'public access' stamp: 'ar 9/27/2005 19:20'! from: textOrStream class: aClass classified: aCategory context: aContext notifying: req (textOrStream isKindOf: PositionableStream) ifTrue: [sourceStream := textOrStream] ifFalse: [sourceStream := ReadStream on: textOrStream asString]. class := aClass. context := aContext. requestor := req. category := aCategory ! ! !Compiler methodsFor: 'private' stamp: 'ar 9/27/2005 19:21'! translate: aStream noPattern: noPattern ifFail: failBlock | tree | tree := self parserClass new parse: aStream class: class category: category noPattern: noPattern context: context notifying: requestor ifFail: [^ failBlock value]. ^ tree ! !