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

John Leung jklemail at gmail.com
Fri Aug 3 11:58:40 PDT 2007


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?

thanks,
john


On 8/3/07, Terence Parr <parrt at cs.usfca.edu> wrote:
>
> AW's test harness cannot possibly know where your templates are.  Use
> -debug and use your own test rig.  Then debug remote with AW.Ter
> On Aug 3, 2007, at 11:08 AM, John Leung wrote:
>
> Hi,
>   I tried the simple T.g grammar in chapter 9 of the book that uses stg.
> When I debug it, it gives me the error "Can't find template assign.st"
> (from rule ... -> assign(x=...); ).  I know I can specify it to use "
> T.stg" instead in __Test__.java, but everytime I do that, it overwrites my
> editing when I run debug.  Is there anyway to tell antlrworks to debug using
> my Test.java instead?   Better yet, why can't antlr generate a
> __Test__.java that uses stg instead of st, or at least let me specify it to
> do so..  I couldn't believe that no one's been asking this yet (I can't find
> it).  Maybe I'm just missing something here?
>
> thanks so much,
> john
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070803/bf772ea7/attachment-0001.html 


More information about the antlr-interest mailing list