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

Petteri Räty betelgeuse at gentoo.org
Wed May 25 11:49:14 PDT 2011


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



More information about the antlr-interest mailing list