[antlr-interest] Can ANTLR be used for renaming a method or class/interface and all its invocations/references ?

Laurent Caillette laurent.caillette at gmail.com
Wed Mar 4 01:54:28 PST 2009


For what you describe, you need to build symbol tables with a
dependency graph, and perform various checks to avoid symbol collision
after the renaming. Parsing is the easy part here!
A language expert may craft this in one week, depending on the real
need. But if you're discovering the area, I suggest you to use an
existing tool.

After two minutes of Googling on "java refactoring command-line tool"
I found this one:
http://jrefactory.sourceforge.net/csr-commandline.html

Hope this helps,

c.


On Wed, Mar 4, 2009 at 12:03 AM,  <swedish_man_2007-antlr at yahoo.se> wrote:
> Thank you Laurent for the answer,
> but I was more interested in a more general (GUI independent) library
> (which, for example, might be reused for creating refactoring plugins for
> different IDE/editors)
> but then ANTLR is not what I am loking for, or is it ?
>
> Another way to phrase my question::
> If my goal is to be able to parse/modify source code, with
> easy-to-use-methods (for renaming operations) as I described in my original
> question, then there is no point of learning ANTLR since that is not going
> to help me ?
>
> / Tom
>
> --- Den tis 2009-03-03 skrev Laurent Caillette
> <laurent.caillette at gmail.com>:
>
> Från: Laurent Caillette <laurent.caillette at gmail.com>
> Ämne: Re: [antlr-interest] Can ANTLR be used for renaming a method or
> class/interface and all its invocations/references ?
> Till: swedish_man_2007-antlr at yahoo.se
> Kopia: antlr-interest at antlr.org
> Datum: tisdag 3 mars 2009 00.10
>
> Sun's Jackpot offers an API for doing that. But it seems designed to
> run as a NetBeans plugin. If you need to apply your changes as a kind
> of batch in a headless environnment, fooling NetBeans could become a
> hard job. If you need a fine customization of the renaming, Jackpot
> looks ok for you.
>
> http://jackpot.netbeans.org/docs/index.html
>
>
> On Mon, Mar 2, 2009 at 11:23 PM,  <swedish_man_2007-antlr at yahoo.se>
> wrote:
>> I am searching for a library that you can use for programatically renaming
>> classes/interfaces or renaming methods, including automatic renaming all
>> references to the methods/types in the source code files/directories that
>> you specify.
>>
>> In other words, I am looking for a
>  library that can do the same kind of
>> rename-refactoring that you can do in some IDE environments (e.g.
> Eclipse).
>>
>> Is ANTLR the tool I am looking for (?) or does somebody here know of
> another
>> library that could help you to implement a method like this:
>> public void renameMethod(
>>    string nameOfClassOrInterfaceWithTheMethodToBeRenamed,
>>    string currentNameOfTheMethodToBeRenamed,
>>    string newMethodName,
>>    string[] sourceCodeDirectoriesWhereAllMethodUsagesShouldBeRenamed
>> )
>>
>> If the answer is yes, then is it simple and is there any code example
>> illustrating how to do it ?
>>
>> / Tom
>
>
> ________________________________
> Ta semester! - sök efter resor hos Kelkoo.
> Jämför pris på flygbiljetter och hotellrum:
> http://www.kelkoo.se/c-169901-resor-biljetter.html
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>


More information about the antlr-interest mailing list