Am Freitag, den 28.01.2011, 02:08 +0100 schrieb charbel elkaed: > I am using ANTLR to parse a Java File, then do some treatment on the > imports, on some declarations and method invocation then regenerate > an output a Java File. > > So far I can retrieve the imports but I think the declarations > treatment will be a bit more complex. For the imports, I using a list > in the Java.g. > > Any idea how can I do that? > Is there any ANTLR API : Java->To->Java that I can use ?
Hi, Charbel. 1) A parser generates an AST to have the whole java code structure in memory. 2) Some code would then modify that AST to 'rearrange' the imports - whatever you need. 3) Finally you have to create code to serialise the AST, meaning to generate your output java file. ANTLR will help you in step 1. The other two are up to you. Hiran List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
