[antlr-interest] newbie question: throwing an exception from parsing behavior
Olivier Lefevre
lefevrol at yahoo.com
Sun Feb 24 17:40:33 PST 2008
Blake Meike wrote:
> It all works fine, except that I can't figure our how to throw a useful
> exception, when the input is invalid.
From within an action. Subclass RecognitionException to add a message
string or whatever and, in the action, do
if (bad) throw new MyException(input, myMsg);
All parsers have an input variable (inherited from Parser).
-- O.L.
More information about the antlr-interest
mailing list