[antlr-interest] TokenStreamException does not contain Line numbers. Alternative suggestions?

Akshay Kini kga.official at gmail.com
Mon Feb 27 00:08:51 PST 2012


Hi All,

I am using Antlr 2.7.6 (Due to requirements, I cannot go to v3, although
2.7.7 should be okay).

I need an error message displayed with line number for Invalid Characters
(according to my input language) in the input file.

So far I have tried:

a) Setting 'charVocabulary'  to the correct input characters.
This causes an Exception of the type "TokenStreamException". This is a
problem as it does not have the line number information.

Any workaround for this?

b) I tried to ensure that the invalid character does not become a token
(many of my rules accept all characters inside comments of my language). So
I prevented this.
Now I get an error, but that is also of type "TokenStreamException".

What do I do?

Is there anything I can do to get Line Numbers for this type of an issue?

Thanks,
Regards,
KGA.


More information about the antlr-interest mailing list