Hi,
i followed the video and opened the RewriteToolbuilder on some code in pharo4.0. i then tried to keep things simple and made a transformationrule,which i thought would not change anything, by just copying "‘@.Statements." into the lower left & right panels (without the " of course).i then press 'generate rule' and get a 'Syntax Error: end of Statement list encountered' with this specification: ^ ArithmeticError signal: 'Negative numbers canEnd of statement list encountered -> ''t be raised to float powers.' . but this part of the code in the upper left panel is just a copy of some unchanged standard pharo4.0 code. where did i go wrong? werner |
I don't know much about RewriteToolbuilder, so probably won't be the one to give a proper answer, but to help someone else answer... could you narrow down which video with a link? cheers -ben On Thu, Jun 8, 2017 at 12:05 AM, werner kassens <[hidden email]> wrote: Hi, |
Hi Werner, I believe that I am the one to answer this question, but I need more information. Please, could you send the code that you have in upper left panel. Cheers, Mark 2017-06-07 18:46 GMT+02:00 Ben Coman <[hidden email]>:
|
Hi Mark,
the code from Number>>raisedTo: aNumber isInteger ifTrue: [ "Do the special case of integer power" ^ self raisedToInteger: aNumber]. aNumber isFraction ifTrue: [ "Special case for fraction power" ^ (self nthRoot: aNumber denominator) raisedToInteger: aNumber numerator ]. self < 0 ifTrue: [ ^ ArithmeticError signal: 'Negative numbers can''t be raised to float powers.' ]. 0 = aNumber ifTrue: [^ self class one]. "Special case of exponent=0" 1 = aNumber ifTrue: [^ self]. "Special case of exponent=1" 0 = self ifTrue: [ "Special case of self = 0" aNumber < 0 ifTrue: [^ (ZeroDivide dividend: self) signal] ifFalse: [^ self]]. ^ (aNumber * self ln) exp "Otherwise use logarithms" Werner p.s. Hi Ben, <g> yes, i wrote that email a bit too fast, the video from http://www.screencast.com/t/LCEl0hFl On 06/07/2017 07:03 PM, Mark Rizun wrote:
|
At first, I was not able to reproduce the error, but then I realised that you probably don't save the content of lower left and right parts (`@.Statements).Use cmd+s to save changes. The error is raised because parser tries to parse the old code (same as in upper left part) with a method intended for rewrite rules. That should fix it. If you have any other questions related to RewriteTool don't hesitate to ask. 2017-06-07 19:25 GMT+02:00 werner kassens <[hidden email]>:
|
On 06/07/2017 08:11 PM, Mark Rizun wrote:
> At first, I was not able to reproduce the error, but then I realised > that you probably don't save the content of lower left and right parts > (`@.Statements).Use cmd+s to save changes. > The error is raised because parser tries to parse the old code (same > as in upper left part) with a method intended for rewrite rules. > That should fix it. > If you have any other questions related to RewriteTool don't hesitate > to ask. Thank you, Mark. werner |
Free forum by Nabble | Edit this page |