[antlr-interest] ANTLR-2.7.6: how to catch an exception inside Lexer

ning dong ningd2004 at gmail.com
Tue Mar 20 15:16:51 PDT 2007


Hi all,
  Is there any way to catch an exception inside Lexer and do something
(ie, catch the exception thrown by nextToken()). The online document
only shows how to do it in parser.
  What I really want to do is to rewind the CharBuffer and try new
rules when something is wrong. Or Can anyone tell me how to do that?
Seems the rewind() in Parser is to rewind the TokenStreamBuffer, not
the CharBuffer.
  Thanks!
-- 
Best Regards!
Ning Dong


More information about the antlr-interest mailing list