[antlr-interest] How to tell antlr to use stg in generated __Test__.java?

John Leung jklemail at gmail.com
Fri Aug 3 13:26:54 PDT 2007


Hmm, ok, so I got it to work by casting it to StringTemplate.  But this
means the code from the book won't work as is, and readers won't be able to
get around it without digging into the parser file..

But returning to the main point.  You say using stg requires remote
debugging.  I've looked at
http://www.antlr.org/wiki/display/ANTLR3/Antlr+3+CSharp+Target
and some other pages but still have a hard time trying to see how to get
remote debugging to work.  For example, can you please let me know how to
get remote debugging to work for the simple T.g example in chap.9?

Also, how difficult would it be for AW to let user to specify the
test.javato use instead of forcing them to use either __Test__.java or
remote
debugging?  If it's simple pointing to user file instead of __Test__.java,
then would you please make it happen?

thanks,
john

On 8/3/07, Terence Parr <parrt at cs.usfca.edu> wrote:
>
>
> On Aug 3, 2007, at 11:58 AM, John Leung wrote:
>
> > Thanks for the fast reply!
> >
> > I tried to do my own test rig exactly the same as is in the book,
> > but I'm getting the following compilation error msg:
> >
> > incompatible types
> > found: java.lang.Object
> > Required: org.antlr.stringtemplate
> > .StringTemplate
> >   StringTemplate output = r.getTemplate();
> >                                                          ^
> >
> > I found the reason for this is that the generated parser.java
> > declares getTemplate() to be:
> >         public Object getTemplate() { return st; }
> >
> > Do you know why it's not declared as StringTemplate instead?
> >
>
> yep. to avoid a type dependence on ST lib if you don't use it.
>
> Ter
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070803/37607c48/attachment.html 


More information about the antlr-interest mailing list