Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.128.mcz ==================== Summary ==================== Name: Compiler-nice.128 Author: nice Time: 26 February 2010, 12:23:36.467 am UUID: d8c8b1f6-f75a-554d-9277-cb68ee0202f7 Ancestors: Compiler-nice.127 1) Cuis 2.2 ParserSmallFix 2) simplification method:context:encoder: replaced by method:context: =============== Diff against Compiler-nice.127 =============== Item was changed: ----- Method: Parser>>method:context:encoder: (in category 'expression types') ----- method: doit context: ctxt encoder: encoderToUse " pattern [ | temporaries ] block => MethodNode." - | sap blk prim temps messageComment methodNode | encoder := encoderToUse. + ^self method: doit context: ctxt! - sap := self pattern: doit inContext: ctxt. - "sap={selector, arguments, precedence}" - self properties selector: (sap at: 1). - encoder selector: (sap at: 1). - (sap at: 2) do: [:argNode | argNode beMethodArg]. - doit ifFalse: [self pragmaSequence]. - temps := self temporaries. - messageComment := currentComment. - currentComment := nil. - doit ifFalse: [self pragmaSequence]. - prim := self pragmaPrimitives. - self statements: #() innerBlock: doit. - blk := parseNode. - doit ifTrue: [blk returnLast] - ifFalse: [blk returnSelfIfNoOther: encoder]. - hereType == #doIt ifFalse: [^self expected: 'Nothing more']. - self interactive ifTrue: [self removeUnusedTemps]. - methodNode := self newMethodNode comment: messageComment. - ^methodNode - selector: (sap at: 1) - arguments: (sap at: 2) - precedence: (sap at: 3) - temporaries: temps - block: blk - encoder: encoder - primitive: prim - properties: properties! Item was added: + ----- Method: Parser>>method:context: (in category 'expression types') ----- + method: doit context: ctxt + " pattern [ | temporaries ] block => MethodNode." + + | sap blk prim temps messageComment methodNode | + sap := self pattern: doit inContext: ctxt. + "sap={selector, arguments, precedence}" + self properties selector: (sap at: 1). + encoder selector: (sap at: 1). + (sap at: 2) do: [:argNode | argNode beMethodArg]. + doit ifFalse: [self pragmaSequence]. + temps := self temporaries. + messageComment := currentComment. + currentComment := nil. + doit ifFalse: [self pragmaSequence]. + prim := self pragmaPrimitives. + self statements: #() innerBlock: doit. + blk := parseNode. + doit ifTrue: [blk returnLast] + ifFalse: [blk returnSelfIfNoOther: encoder]. + hereType == #doIt ifFalse: [^self expected: 'Nothing more']. + self interactive ifTrue: [self removeUnusedTemps]. + methodNode := self newMethodNode comment: messageComment. + ^methodNode + selector: (sap at: 1) + arguments: (sap at: 2) + precedence: (sap at: 3) + temporaries: temps + block: blk + encoder: encoder + primitive: prim + properties: properties! Item was changed: ----- Method: Parser>>fail (in category 'error handling') ----- fail | exitBlock | + (encoder == nil or: [encoder == self]) - encoder == nil ifFalse: [encoder release. encoder := nil]. "break cycle" exitBlock := failBlock. failBlock := nil. ^exitBlock value! Item was changed: ----- Method: Parser>>parse:class:category:noPattern:context:notifying:ifFail: (in category 'public access') ----- parse: sourceStream class: class category: aCategory noPattern: noPattern context: ctxt notifying: req ifFail: aBlock "Answer a MethodNode for the argument, sourceStream, that is the root of a parse tree. Parsing is done with respect to the argument, class, to find instance, class, and pool variables; and with respect to the argument, ctxt, to find temporary variables. Errors in parsing are reported to the argument, req, if not nil; otherwise aBlock is evaluated. The argument noPattern is a Boolean that is true if the the sourceStream does not contain a method header (i.e., for DoIts)." | methNode repeatNeeded myStream s p | category := aCategory. myStream := sourceStream. [repeatNeeded := false. p := myStream position. s := myStream upToEnd. myStream position: p. self encoder init: class context: ctxt notifying: self. self init: myStream notifying: req failBlock: [^ aBlock value]. doitFlag := noPattern. failBlock:= aBlock. [methNode := self method: noPattern + context: ctxt] - context: ctxt - encoder: self encoder] on: ReparseAfterSourceEditing do: [ :ex | repeatNeeded := true. myStream := ReadStream on: requestor text string]. repeatNeeded] whileTrue: [encoder := self encoder class new]. methNode sourceText: s. ^methNode ! |
Free forum by Nabble | Edit this page |