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

Terence Parr parrt at cs.usfca.edu
Fri Aug 3 12:12:27 PDT 2007


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



More information about the antlr-interest mailing list