how to find all occurrances of a string in a package?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to find all occurrances of a string in a package?

Paul DeBruicker
Hi -

I'm trying to learn how to use the RBParseTreeSearcher.

I'd like to find all the occurrances of the string 'tabs' in a package
I've written.

Is there something I can read to learn how to do that?

Thanks

Paul

Reply | Threaded
Open this post in threaded view
|

Re: how to find all occurrances of a string in a package?

Mariano Martinez Peck


On Tue, Dec 21, 2010 at 11:28 PM, Paul DeBruicker <[hidden email]> wrote:
Hi -

I'm trying to learn how to use the RBParseTreeSearcher.

I'd like to find all the occurrances of the string 'tabs' in a package I've written.


That's something I would like to know also.
What I always do is select the text (suppose 'tabs'), right click -> extended search -> method source with it

the problem is that is seraches in all the image, not a particular package. So...having this, integrated in RB, and being able to select a scope would be awesome (maybe it is present already)
 
...update....

I have just check and there is something "literals matching" in RB....so maybe for literals at least it works.  Maybe it would be nice to extend it so that it works like "method source with it". This functionality used to be too slow but with some optimizations from Levente now this is much faster.

Is there something I can read to learn how to do that?

Thanks

Paul


Reply | Threaded
Open this post in threaded view
|

Re: how to find all occurrances of a string in a package?

Lukas Renggli
In reply to this post by Paul DeBruicker
> I'd like to find all the occurrances of the string 'tabs' in a package I've
> written.

If you really just want the string 'tabs', the string 'tabs' with the
quotes is the search expression.

If you want to find it as part of a substring use something along:

    `#string `{ :node | node value isString and: [ node value
includesSubString: 'tabs' ] }

The `#string is a literal pattern (booleans, characters, arrays,
strings, numbers, ...) and `{ ... adds a constraint on the preceding
match.

Lukas

>
> Is there something I can read to learn how to do that?
>
> Thanks
>
> Paul
>
>



--
Lukas Renggli
www.lukas-renggli.ch