[antlr-interest] Why stream name can't be printed out when error occurs(ANTLR C)?

Jim Idle jimi at temporal-wave.com
Wed May 25 13:02:05 PDT 2011


So, it is a bug in the tree grammar and you have not implemented an error
message handler that can help you in development. I cannot create an error
handler that is all things to all men - hence the supplied default just
tries to use lots of ways to gather information, so you can decide what is
needed for your specific case.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Petteri Räty
> Sent: Wednesday, May 25, 2011 12:57 PM
> To: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Why stream name can't be printed out when
> error occurs(ANTLR C)?
>
> On 05/25/2011 10:39 PM, Jim Idle wrote:
> > Why would you need to use a virtual token to issue an error?
> >
> > Jim
> >
>
> The situation happens at least when a tree grammar detects a tree it's
> not prepared for. This of course is more common during development than
> in production but can't see why bugs couldn't leak there too. An
> example:
>
> -unknown source-(32)  : error 3 : , at offset 8, near (STRING
> autotools)
> : cannot match to any predicted input...
>
> first frames from an another error:
>
> (gdb) bt
> #0  antlr3RecognitionExceptionNew (recognizer=0xb74e1978) at
> src/antlr3baserecognizer.c:382
> #1  0xb7dc7baf in recoverFromMismatchedToken (recognizer=0xb74e1978,
> ttype=3, follow=0x0) at src/antlr3baserecognizer.c:1469
> #2  0xb7dc6c72 in match (recognizer=0xb74e1978, ttype=3, follow=0x0) at
> src/antlr3baserecognizer.c:478
>
> Regards,
> Petteri
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list