A lot of you have wondered why I'd don't use enum types for token types in the 
generated Java-based parsers:

enum TokenType { ID(3), INT(4) };

I gave it my best shot but once again I found that enums just don't seem to 
work for me. For example, without inheritance how can I define the match method?

void match(TokenType t) {....}

Unfortunately this is in the superclass not the generated class so TokenType is 
not yet defined. Without inheritance, I have to use match(int). That means that 
there's no point in using the enum.

But, you say, I should be using generics on the parser to pass in the token 
type enum type. Fair enough, And I'll try once I tried to generic'ize the v3 
runtime for v4. We've had some discussion of this on the dev list.

Ter

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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to