[antlr-interest] C Runtime Error Handling Problems

Bot Tiger bottiger1 at gmail.com
Wed Jan 28 17:01:10 PST 2009


Well I think I may have found the source of the problem. I had
backtrack=true enabled, and that may have caused any error reporting
capabilities to disappear.

On Wed, Jan 28, 2009 at 4:24 PM, Bot Tiger <bottiger1 at gmail.com> wrote:

> Dear Jim and ANTLR community,
>
> >Are you saying that this aborts when trying to print an error message if
> >you do not try to override the reporting function with your own, or that >
> >it aborts with your own reporting function?
>
>
> It does not abort in either my handler or the default one. It reports a token at offset -1 which does not make sense if it is EOF.
>
>
> Here is an example using the default handlers.
>
>
> >> 1++2
>
> -memory-(1)  : error 5 : Unexpected token, at offset -1
>     near [Index: 0 (Start: 1369936-Stop: 1369936) ='1', type<15> Line: 1 LinePos:-1]
>      : missing elements...
> -memory-(1)  : error 5 : Unexpected token, at offset -1
>
>     near [Index: 0 (Start: 1369936-Stop: 1369936) ='1', type<15> Line: 1 LinePos:-1]
>      : missing elements...
>
> As you can see here, the default error reporter here says that there is an unexpected token at offset -1. You said that this means it is expecting an EOF token.
>
> I thought it would be expecting a number token.
>
> I expected the error report to say something like:
>
> Unexpected token at offset 2. Expected NUMBER token.
>
> Thank you again.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090128/b5fb1196/attachment.html 


More information about the antlr-interest mailing list