Hi,
I wanted to use RewriteTool to rewrite dynamic arrays Source AST: | base | base := {#Department -> {710 @ 255. Color lightMagenta}} matching AST: | base | base := {#Department -> {``@first. ``@second}} transformation: | base | base := {#Department -> (Array with: ``@first with: ``@second)} However when I tried to execute it I was met with DNU OrderedCollection>>parent: It seems that the @first/@second part are not matched properly. Any way to fix this? Or am I doing it wrong? Thanks, Peter |
Hi Peter, I tried to perform this transformation with RewriteTool and got the same DNU.
Actually they are matched properly, because if you try to put in transformation part, for example, {``@first.``@second} everything works fine.
I believe you are doing everything just fine. However, it is definately the problem of RBParseTreeRewriter or something related to it. Try to execute following code in playground and you will get the same DNU: | rewriter | rewriter := RBParseTreeRewriter new replace: '| base | base := {(#Department -> {``@first. ``@second})}' with: '| base | base := {#Department -> (Array with: ``@first with: ``@second)}'. (rewriter executeTree: (RBParser parseRewriteExpression: '| base | base := {(#Department -> {(1 @ 255). (Color lightMagenta)})}')) ifTrue: [ rewriter tree asString inspect ]. This code does exactly the same that RewriteTool should do when you put all the parts into it. Thus, I think, it is not a problem with the tool. Cheers, Mark |
I get the exact same error when executing the script, I am running this on Pharo 5 (50760) btw. On Thu, Aug 11, 2016 at 3:15 PM, Mark Rizun <[hidden email]> wrote:
|
Nvm, I've misread it. Ok, I will do it manually then, and submit a bug report. :) Thanks, Peter On Thu, Aug 11, 2016 at 3:31 PM, Peter Uhnák <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |