[antlr-interest] Tokenising for context specific reserved words

Gavin Lambert antlr at mirality.co.nz
Sun Jul 20 13:23:46 PDT 2008


At 04:03 21/07/2008, Raphael Reitzig wrote:
 >To be consequent, one could generate one class per token type.
 >Subtyping would give you what you want, I suppose.

Well, yeah, you *could* do it that way, but that seems far too 
heavyweight (and wouldn't work for the C target anyway).

 >Anyway, what about predefining often used tokens like
 >(DOUBLE|SINGLE)_QUOTED_STRING, INT, FLOAT, WHITESPACE, 
LINEBREAK,
 >...?
 >With the option to overwrite them, of course.

No, I don't think that's a good idea.  Although having them as 
easily-insertable templates in ANTLRworks could be useful.



More information about the antlr-interest mailing list