[antlr-interest] Error handling in Antlr
Warren Wong
wawong at bea.com
Tue Aug 22 12:13:09 PDT 2006
Hi,
I've written a SQL Parser, but since I'm using LA(4), something like the
following:
SELECT x,<keyword> from...
Throws the error invalid token x found.
This is because in the translated code, we have the line:
if ((((LA(1) >=
LITERAL_leading && LA(1) <= LITERAL_both)) &&
(_tokenSet_45.member(LA(2))) && (_tokenSet_46.member(LA(3))) &&
(_tokenSet_11.member(LA(4))))) {
which when fails, displays the error
throw new NoViableAltException(LT(1), getFilename());
In this case, token x matches, but the error is at the keyword.
Is there an easy fix for this in pre ANTLR 3.0?
Thanks,
Warren
_______________________________________________________________________
Notice: This email message, together with any attachments, may contain
information of BEA Systems, Inc., its subsidiaries and affiliated
entities, that may be confidential, proprietary, copyrighted and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.
More information about the antlr-interest
mailing list