[antlr-interest] Accessing lexer characters programmatically?

Susan Jolly easjolly at ix.netcom.com
Mon Apr 28 06:42:16 PDT 2008


The user of my application has to supply a table (used by the tree parser)
that specifies conversions for the characters in the document that is
processed.

It would be useful if I could determine prior to scanning whether or not the
supplied table is consistent with the lexer; i.e. whether it includes
conversions for the (non-ASCII) characters used in certain of the lexer
rules such as 

TYPE1: '\u20AC'|'\u00A5'|'\u2026';
TYPE2: '\u201D'|'\u2019';

Typically one can avoid an extra maintenance point in such a situation by
using parameters.  However, ANTLR lexer grammars don't allow such
indirection.

I could, of course, keep a separate list of the characters of concern but
that would create an extra maintenance point.   Is there a better way?
 




More information about the antlr-interest mailing list