Hi,

I am looking into the RB pattern language for refactoring and I am having 
trouble matching and replacing non-trivial pattern. Given the following 
excerpt, I want to match "b shape <rest>." and replace it with "b shape: [ :x | 
x <rest> ]"

        b shape circle
                size: 15;
                color: (Color veryLightGray alpha: 0.4);
                if: [ :value | toBeRed includes: value ] fillColor: Color red.

How can I do this? I tried using "b shape ``@messages", but this only matches 
"b shape circle". Using "b shape `message `;middle; `;last" for some reason 
then also matches the following, which I think it should not:

        b edges
                moveBehind;
                connectToAll: [ :v | 
                        v \\ 20 ~~ 0
                                ifTrue: [ Array with: v + 1 with: v + 20 ]
                                ifFalse: [ Array with: v + 20 ] ].

There seems not be too much documentation about the pattern language, only 
found tests, some short help description from RB and Yuriy's MatchTool.
How can I match the node correctly?

Cheers,
Manuel


Reply via email to