[antlr-interest] FW: Basic Questions - again!

Jeff Stroup imaband at comcast.net
Sat Aug 4 18:01:11 PDT 2007


 
 
-----Original Message-----
From: Jeff Stroup [mailto:imaband at comcast.net] 
Sent: Saturday, August 04, 2007 7:20 PM
To: 'antlr-interest at antlr.org'
Subject: Basic Questions
 
Hi,
 
I've loaded up the jars and have successfully ran a simple template by
loading the template from a template group, assigning it's attributes,
and then outputting it. I want to go a few steps further.
 
1.	I want to grab the attribute values for the template from a file
as well - or do I have to read and parse the file myself? No big deal if
I have to but thought there might be some mechanism that I just haven't
discovered. Specifically I'm writing Java wrapper classes for database
tables and want to suck in the create script and spit out the wrapper.
It would also be nice to suck in an alter script and have it diff the
wrapper as well. Wouldn't THAT be cool?! 
 
2.	Is there a mechanism in ST to specify where the output will go?
Right now I just have a string in a variable. Can I surround existing
source files with special tokens that can be replace with that output?
Or do I have to copy and paste the text in manually from the generated
file. If I do it's not big deal because it beats manually typing it all.
It's always disturbed me that developers are perfectly happy to fat
finger in what is basically THE SAME data - with the only real
difference being syntax or slight nomenclature disconnects - in multiple
places. Speaking of which, would the mapping feature of ST handle the
case where the same concept is referred to by different names? 


3.	Ultimately I'd like to trigger the template engine from within
Eclipse by invoking it from a custom plug in where I have access to the
AST (Abstract Syntax Tree) and insert template output directly into the
source. Does anyone know if something like this already exists? XDoclet
seems to be able to generate NEW code (if you can wire it correctly to
ANT), but falls down when you


a.	Want to regenerate only a section of a source file or add a
single field - e.g. a getter, setter, field combination.


b.	Have added comments and annotations to your template generated
source and want to run the generation again (entirely or partially) but
don't want to destroy the comments.
 
Thanks in advance for any response or direction.
 
Back to experimenting! :-)
 
 
Jeff
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070804/8de0e227/attachment-0001.html 


More information about the antlr-interest mailing list