[antlr-interest] Write comments to templates

Chris Sekszczynska Development at chrissek.de
Mon Nov 24 09:53:27 PST 2008


Hi Jared,

this could be a good and elegant solution :)

I think you mean the TokenStreamRewriteEngine? There, I can add a  
String before and after a hidden token. But how can I access the  
String which is produced by a specific template? And how can I map the  
template output to the hidden token? I see no way to access the  
template output within the grammar and no way to access the token  
within my main() method.

I'm not very familiar with ANTLRs internals, so I don't see any  
starting point :(

Kind regards,

Chris


On 23.11.2008 at 05:34 Jared Bunting wrote:

> Not sure if it will meet your needs or not, but you might want to  
> look at the rewrite functionality.  It should allow you to use your  
> source file as a starting point, and replace code in it with your  
> template output.  By ignoring comments in your parser, I would think  
> the rewrite would simply leave those where they are.



More information about the antlr-interest mailing list