[antlr-interest] Help please

John B. Brodie jbb at acm.org
Thu Mar 24 11:05:15 PDT 2011


Greetings!

On Thu, 2011-03-24 at 17:22 +0100, wael sellami wrote:
> Hello,

...stuff snipped...

> book : ^(BOOKDEF name (xmltag)+)
> {
> System.out.println("Begin book tag");
> System.out.println("END book tag");
> };
> 

...snipped...

short answer, place actions properly:

book : ^(BOOKDEF name
      { System.out.println("Begin book tag"); }
    (xmltag)+
      { System.out.println("END book tag"); }
  ) ;

preferred answer, use StringTemplate to compose your output.

hope this helps...
   -jbb




More information about the antlr-interest mailing list