[antlr-interest] Access to lexer warning/error messages after parsing
Terence Parr
parrt at cs.usfca.edu
Wed Jul 2 10:31:49 PDT 2008
howdy!
p237 of TDAR: "To get these rich error messages, override two methods
from BaseRecognizer, displayRecognitionError() and
getTokenErrorDisplay(), ..."
That pretty much says what you need to override to completely change
how errors are displayed. If you don't care about the message, just
where it goes, then simply override the display method. Making it safe
instead of printing is the only hook I can imagine a computer
scientist needing to do anything they want.
print vs add. do we really need a listener for this? ANTLR itself has
a listener for errors and I suppose there could be one for the
recognizers themselves, but I am not sure it is worth the extra
complexity.
Ter
On Jul 2, 2008, at 3:18 AM, Ana Nelson wrote:
> I think this topic calls for a Wiki page.
>
> :-)
>
> (No, sorry, I'm not volunteering, but I will add my workaround to it
> if anyone's interested.)
>
>
>
>
> 2008/7/2 Ian Moor <iwm at doc.ic.ac.uk>:
>>> My intention was that you override one method and do what you want.
>>> Not sure what else anybody would want. Replace System.err in
>>> override
>>> with errors.add(...) and you're done. Not sure what the long
>>> conversation is about. Can't think of an easier way.
>>>
>>> Ter
>>
>> I would use the java logger, or if the compiler has to
>> run on java 1.3 or earlier log4j, rather than write my own code
>> Ian W Moor Department of Computing,
>> iwm at doc.ic.ac.uk Imperial College.
>> 180 Queensgate
>> London SW7 2AZ UK.
>>
>>
>>
More information about the antlr-interest
mailing list