[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
382      if      (tnode->token->input == NULL)
(gdb) p tnode->token->input

Here tnode->token is a token that is declared in the tokens { } block in
the grammar header.


More information about the antlr-interest mailing list