[Pharo-users] RBPattern syntax
leuenberger at inf.unibe.ch
Thu Feb 7 08:49:45 EST 2019
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
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:
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?
More information about the Pharo-users