Don't confuse real tokens with what you put in the tree. Just rewrite
using an imaginary token once you disambiguate the declaration. Also, make
sure that you left factor qualifiers and things like that. Also, remember
that these are all type declarations. See here for some pointers:

http://www.temporal-wave.com/index.php?option=com_psrrun&view=psrrun&Itemi
d=58



Jim

> -----Original Message-----
> From: [email protected] [mailto:antlr-interest-
> [email protected]] On Behalf Of Christian
> Sent: Friday, October 28, 2011 4:27 AM
> Cc: [email protected]
> Subject: Re: [antlr-interest] Are token aliases possible?
>
> CLASS is only the token name. However, CLASS_DECL represents the
> semantics of what was parsed. It allows to be more consequent when
> analyzing the generated AST by names like CLASS_DECL, METHOD_DECL,
> FIELD_DECL etc.
>
> Example:
>
> switch (node.getType()) {
>    case CsRewriteRulesParser.NAMESPACE_DECL:
>       // TODO
>       break;
>    case CsRewriteRulesParser.METHOD_DECL:
>       // TODO
>       break;
>    case CsRewriteRulesParser.CLASS_DECL:
>       // TODO
>       break;
> }
>
> It would be just another name for the integer constant CLASS.
>
> Am 28.10.2011 13:19, schrieb Sam Barnett-Cormack:
> > I think the immediate answer is, "why?"
> >
> > On 28/10/2011 09:02, Christian wrote:
> >> Hi community,
> >>
> >> if there is a real token, say
> >>      CLASS : 'class';
> >> can a define an alias, say
> >>      CLASS_DECL = CLASS
> >> in some way?
> >>
> >> Regards,
> >> Christian
> >>
> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> >> Unsubscribe:
> >> http://www.antlr.org/mailman/options/antlr-interest/your-email-
> addres
> >> s
> >
>
>
> 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