[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 12:57:05 PDT 2011


On 05/25/2011 10:39 PM, Jim Idle wrote:
> Why would you need to use a virtual token to issue an error?
> 
> Jim
> 

The situation happens at least when a tree grammar detects a tree it's
not prepared for. This of course is more common during development than
in production but can't see why bugs couldn't leak there too. An example:

-unknown source-(32)  : error 3 : , at offset 8, near (STRING autotools)
: cannot match to any predicted input...

first frames from an another error:

(gdb) bt
#0  antlr3RecognitionExceptionNew (recognizer=0xb74e1978) at
src/antlr3baserecognizer.c:382
#1  0xb7dc7baf in recoverFromMismatchedToken (recognizer=0xb74e1978,
ttype=3, follow=0x0) at src/antlr3baserecognizer.c:1469
#2  0xb7dc6c72 in match (recognizer=0xb74e1978, ttype=3, follow=0x0) at
src/antlr3baserecognizer.c:478

Regards,
Petteri



More information about the antlr-interest mailing list