Yeah, I remember this is a pain. When I did years ago what 
you're doing now with QA, I ended up practicing black magic, 
sacrificing chickens and other things you'd better not to know.

IIRC, the trick is to turn rewrite rules in ParseTreeEnvironment 
into search rules and then run the searches. Now this is tricky
as these rules quite often refers to blocks, which then refers to outer
contexts and you need these blocks do something different now (report
nodes rather then transform stuff). This is the main problem. 

If you have the guts, you may find the code here: 

https://bitbucket.org/janvrany/stx-goodies-smallsense
and here:
http://swing.fit.cvut.cz/hg/stx.goodies.refactoryBrowser/

(alternatively, downlaod https://swing.fit.cvut.cz/projects/stx-jv/
 and browse the code in Smalltalk browser). 

You may want to trace the code starting from
ParseTreeEnvironment>>selectionIntervalsForSource:tree:do: 
RBParseTreeRule>>copyMatchDo: and implementors is also
worth mentioning. 

After doing this, I concluded that SmallLint as it's now is not
well designed for this task and it would need a significant
refactoring. However, as always, I was never given time to do it.

HTH, Jan


On Tue, 2015-09-22 at 17:56 +0200, Yuriy Tymchuk wrote:
> Hi everyone,
> 
> I need someone who knows how RBParseTreeRewriter & co. work. May of
> quality rules are implemented as rewrite rules which is cool. But
> they don’t report the interval in source code which can be
> highlighted to help with understanding of the issue.
> 
> Now… the check happens in RBTransformationRule>>#checkMethod:. Is it
> possible to obtain the matched string there? Because in that case we
> can get highlighting working which will be very useful.
> 
> Cheers!
> Uko
> 

Reply via email to