At 20:40 28/02/2009, Gary R. Van Sickle wrote: >Bug or feature though? It seems inconsistent for what appear >to be two semantically equivalent constructs to be totally >fine in the one case and a silent failure in the other.
I consider it to be a bug in the ANTLR compiler, that it doesn't actually tell you "you can't do that", but I don't think it's a bug that you can't do that (if that makes sense) :) Tokens are fairly simple beasts, and a label on a token is invariably referring to the token itself, which you can then use to insert into an AST, or get its text, or position, or whatever. Rules are more complex, though, since rules consist of a collection of tokens, which have their own positions, and can also contain a subtree or a template fragment, as well as parameters and return values. That's why the storage type of the label is context-sensitive, and varies depending on which rule you use it on. And that's why it's only safe to reuse a label name on a rule of the same type as it was previously used on. It's still an advance over ANTLR v2, which didn't let you reuse label names at all :) 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 -~----------~----~----~----~------~----~------~--~---
