[antlr-interest] Accessing lexer characters programmatically?

Gavin Lambert antlr at mirality.co.nz
Mon Apr 28 14:08:40 PDT 2008


At 08:56 29/04/2008, Susan Jolly wrote:
 >Is there any way to obtain a list of all of the characters
 >_explicitly_ referenced by all of the rules in a given lexer
 >grammar?

I doubt it.  There's not really much call for that sort of thing.

 >(Please note that I'd prefer not to parse the lexer grammar 
file.)

You may have to.

Alternatively, you could always create a custom lexer which does 
keep track of this sort of thing.  No reason why you can't feed 
tokens from a non-ANTLR lexer into an ANTLR parser -- you just 
need to provide an ANTLR token stream and vocabulary.



More information about the antlr-interest mailing list