[antlr-interest] How to throw an exception from the lexer to the caller rule
Terence Parr
parrt at jguru.com
Sat Oct 27 12:45:51 PDT 2001
On Wednesday, October 17, 2001, at 05:46 AM, lemoine at multimania.com
wrote:
> Hi,
> I had specified the testLiterals option to true for the IDENT rule in
> the Lexer to test each token against the literals table.
> But when the literal does not match with the lexer IDENT rule, it
> generates an Exception and exits of the lexer.
> I want to catch the exception in the caller rule of the parser to
> specify my own error message.
It should not be generating an exception if it's not a literal...it
should simply return as IDENT. Are you sure that is what is happening?
Ter
--
Chief Scientist & Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list