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

Mu Qiao qiaomuf at gmail.com
Tue May 24 07:36:17 PDT 2011


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


More information about the antlr-interest mailing list