there is lexer state ! look in the doc: antlr-2.7.2a2/doc/streams.html#lexerstates Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/