try setting ASTLabelType option in grammar but that .text stuff should work. i 
use it all the time.
Ter
On Dec 14, 2010, at 7:10 PM, Scott Stevenson wrote:

> I learning how to use templates in a tree grammar.  I'm mimicking some of
> the examples in the ANTLR Reference.  I have a rule:
> 
> primary
> :    INT          -> primaryTemplate(text={$INT.text})
> |    DECIMAL -> primaryTemplate(text={$DECIMAL.text})
> |    ID            -> primaryTemplate(text={$ID.text})
> ;
> 
> where primaryTemplate is the name of the template to evaluate.
> 
> In the tree parser code it declares $INT to be type Object.
> Object INT4;
> 
> and later tries to invoke INT4.getText().  This gives an error because
> Object does not have method getText().
> 
> Can anyone tell me what am I doing wrong?  This looks just like the example
> in the book.
> 
> Thanks in advance.
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to