[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 12:39:10 PDT 2011


Why would you need to use a virtual token to issue an error?

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 11:49 AM
> 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/24/2011 07:46 PM, Jim Idle wrote:
> > There can be multiple streams and you should reallty be using the
> file
> > name in the filestream, which you get from the token. Originally, we
> > could not get back to the filestream from the token and now we can,
> > hence the example error code uses what was available when I wrote it
> > and also avoids (at the time) dealing with stringstreams that might
> > not have a name (though now they always do of course).
> >
>
> The problem seems related to virtual tokens. They seem to be missing
> association back to the filestream. Is this a bug or a limitation?
>
> Breakpoint 1, antlr3RecognitionExceptionNew (recognizer=0x8100dd0) at
> src/antlr3baserecognizer.c:382
> 382      if      (tnode->token->input == NULL)
> (gdb) p tnode->token->input
> $2 = (pANTLR3_INPUT_STREAM) 0x0
>
> Here tnode->token is a token that is declared in the tokens { } block
> in the grammar header.
>
> 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