[antlr-interest] Trouble modifying Java source w/ ANTLR

Robert Colquhoun rjc at trump.net.au
Thu Feb 19 13:13:39 PST 2004


Hello,

At 07:08 AM 20/02/2004, cliftonccraig wrote:
>I just picked up ANTLR and I'm trying to determine the easiest way to
>build a Java Parser that can insert and replace VERSION strings in my
>Java source files. I have the Java grammar available on the ANTLR web
>site and I have the source files from the TokenRewriting article also
>on the site. Could someone walk me through where in the Java grammar I
>should put logic to do the insert? I really need help on this and I
>appreciate any and all help provided.

Have you considered using ant(see the replace task) or sed or something to 
do this?

IF you you antlr possibly you could just lex it provided you knew the 
version string you were looking for was unique enough  Otherwise you will 
need to parse it and then search through the resulting AST, do the replace 
then print the AST  out again....remembering to preserve whitespace etc

  - Robert




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list