Hi Bill. try setting ASTLabelType in tree grammar.
T
On Jul 22, 2010, at 12:26 PM, Bill Andersen wrote:

> Hi Folks,
> 
> This is my second attempt at asking this question.  Hopefully it is clear.  
> If not, please let me know.
> 
> I'm interested in using a custom AST node class to carry type information.
> 
> I do not want to build a custom TreeAdaptor to determine node type based on 
> token id because only a few AST nodes will have to be of the custom class.
> 
> Here's a sample production from the tree generating grammar.
> 
> rule
>       : ... match something ...
>       -> ^(NODE<CustomType>[param] ...)
>       ;
> 
> So far so good.  I know how to do this.  
> 
> Let's say CustomType looks like this
> 
> class CustomType extends CommonTree {
>       public T param;
>       public CustomType(int ttype, T param) { ... }
>       public T getParam() { ... }
>       ...
> }
> 
> Now I have another grammar that consumes ASTs from the first grammar.  I want 
> to do this:
> 
> rule
>       : ^(NODE ...)
>         { ... do something with this information ... }
>       ;
> 
> So, what syntax do I need in the action to get a T-typed param value from 
> this node?
> 
> Any help appreciated 
> 
> 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