[antlr-interest] Add fields, getter, setter, ... into existing java file with antlr?

David Holroyd dave at badgers-in-foil.co.uk
Tue Jan 16 09:28:32 PST 2007


On Tue, Jan 16, 2007 at 01:57:21PM +0100, Angelo zerr wrote:
> I'm developping eclipse plugin Akrogen http://akrogen.sourceforge.net/ which
> generate code (Freemarker, XSL,...) .
> Today I would like manage the update of a file with generated content (ex :
> generate content for getter and add it
> to the existing file java class).
> 
> Is it possible to do that with antlr. If it's it possible, could you help
> me, give me suggestion  (I'm new user with antlr).

I've written an ANTLRv3-based tool to do this kind of thing with
ActionScript, and might give you some ideas:

  http://www.badgers-in-foil.co.uk/projects/metaas/


I think that the JaxMeJS may do this for Java, to some extent (and it's
parser is ANTLR-based) but I'm not sure how pretty the resulting code
is, as I've never tried round-tripping with that lib, only straight code
generation,

  http://ws.apache.org/jaxme/js/index.html

However, if you are modifying Java files, and doing it in Eclipse too, I
suspect you'd be best off using the Eclipse JDT platform's inherent support
for Java code manipulation (not that I know which API's you need to look
at though ;)


ta,
dave

-- 
http://david.holroyd.me.uk/


More information about the antlr-interest mailing list