Hi Peter,

I tried to perform this transformation with RewriteTool and got the same
DNU.


> 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.
>

Actually they are matched properly, because if you try to put in
transformation part, for example, {``@first.``@second} everything works
fine.


> Any way to fix this? Or am I doing it wrong?
>

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

Reply via email to