[antlr-interest] Modifying Java Source

Terence Parr parrt at cs.usfca.edu
Sun Aug 9 22:31:01 PDT 2009


Hiya. Use the tokenrewrite stream and Java.g combo. add actions to  
replace between { } with new action. :)
Ter
On Aug 9, 2009, at 6:18 PM, Ismet Ozalp wrote:

> Hello everybody,
>
> I am a newbie; I am trying to modify java sources. What I am trying  
> to do is
>
> clear the codes in the methods and change them with one line of code
>
> example method
>
>     public void delete(T t) {
>         PersistenceManager pm = PMF.get().getPersistenceManager();
>
>         try {
>             pm.deletePersistent(t);
>
>         } finally {
>             pm.close();
>         }
>
>     }
>
> changed method
>
>   public void delete(T t) {
>     throw new UnsupportedOperationException();
>   }
>
> So i need to modify the grammar some how to do this for methods in  
> the source file
> currently I am trying to do something with http://www.antlr.org/grammar/1152141644268/Java.g
> which is written by Terence Parr. But I am a little bit lost, if  
> anybody can point me to the right direction
> where I can find more information or examples about how to achieve  
> this, it would be great....
>
> Thank you very much
> Ismet
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090809/7c687a5b/attachment.html 


More information about the antlr-interest mailing list