Jeff Martin wrote: > > I've just checked in a proposal for the next version of JXR. Basically, I'm > not happy with some of the internals of JXR and want to move it to an event > based system. Also I'm to lazy to write a java parser so I think that using > something like ANTLR is a good idea. Antlr and JavaCC both have full java grammars as part of the distribution, and both create an AST with which you can do almost anything you want. Either create a self walking AST, or use Visitors to do various tasks. I highly recommend using a parser generator. And the ones for java are already done. > > Following on from the idea of an event based model it struck me that there's > already a fairly good system for handling even based tree info (Java source > files can be looked at as trees) and that's SAX. So the code I've got here > generates SAX events from a Java source file, it's then should be possible > to apply XSL style sheets to them to view the code in different ways e.g. > Javadoc or JXR style. It also seems like quite a good way of handling things > like metrics as people can write DocumentHandlers to listen to documents and > then generate metrics. You could easily make a visitor that transformed a java source file into whatever XML format you wanted. Or you could simply use a single visitor that fires off events to listeners. Either way a parser generator is definitely the way to go IMHO. You don't want to get into hand-coding a java parser, that's nasty business :-) -- jvz. Jason van Zyl [EMAIL PROTECTED] http://jakarta.apache.org/velocity http://jakarta.apache.org/turbine http://tambora.zenplex.org --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
