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).

Jim



> -----Original Message-----
> From: [email protected] [mailto:antlr-interest-
> [email protected]] On Behalf Of Mu Qiao
> Sent: Tuesday, May 24, 2011 7:36 AM
> To: [email protected]
> Subject: [antlr-interest] Why stream name can't be printed out when
> error occurs(ANTLR C)?
>
> I set the fileName for ANTLR3_INPUT_STREAM and the file name can be
> printed out when error occurs. But when the tree parser is involved,
> the name can't be always printed out (print unknown-source instead
> sometimes).
>
> I checked the implementation of antlr3baserecognizer.c and I find the
> name is decided by tnode->token. However, as we have
> tns->istream->streamName, why not use that attribute? This will ensure
> the name can be printed out no matter what kind of the current token it
> is.
>
> --
> Best wishes,
> Mu Qiao
> GnuPG fingerprint: 92B1 B0C4 8D14 F8C4 EFA5  3ACC 30B3 0DE4 17B1 57E9
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to